/* Story Creator Modal Styles */

#storyCreatorModal.story-creator-modal {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: #0f1113 !important;
    z-index: 100001 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.story-creator-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f1113;
    z-index: 100001;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

/* Story Creator Page Styles */

.story-creator-container {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: #1a1d21;
    overflow: hidden;
    max-width: 100vw;
    max-height: 100vh;
}

/* Header */
.story-creator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-creator-back {
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.story-creator-back:hover {
    background: rgba(255, 255, 255, 0.08);
}

.story-creator-back svg {
    width: 24px;
    height: 24px;
    stroke: #fff;
}

.story-creator-title {
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.story-creator-post {
    padding: 8px 24px;
    background: #fbbf24;
    color: #000;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.story-creator-post:hover:not(:disabled) {
    background: #f59e0b;
    transform: translateY(-1px);
}

.story-creator-post:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mode Selection */
.story-mode-selection {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    width: 100%;
    height: 100%;
}

.story-mode-selection > div {
    display: flex;
    gap: 16px;
    max-width: 400px;
    width: 100%;
    justify-content: center;
}

.story-mode-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 24px 20px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    width: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.story-mode-card:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: #fbbf24;
    transform: translateY(-4px);
}

.story-mode-icon {
    width: 48px;
    height: 48px;
    background: rgba(251, 191, 36, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-mode-icon svg {
    width: 24px;
    height: 24px;
    stroke: #fbbf24;
}

.story-mode-card h3 {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.story-mode-card p {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
    margin: 0;
    line-height: 1.3;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .story-mode-selection {
        padding: 16px;
    }
    
    .story-mode-selection > div {
        flex-direction: column;
        width: 100%;
        max-width: 280px;
    }
    
    .story-mode-card {
        width: 100%;
        flex-direction: row;
        padding: 20px;
        gap: 16px;
        text-align: left;
    }
    
    .story-mode-card h3 {
        font-size: 18px;
    }
}

/* Story Editor */
.story-editor {
    flex: 1;
    display: flex;
    flex-direction: row;
    min-height: 0;
}

/* Preview Area */
.story-preview {
    flex: 1;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.story-preview-content {
    width: auto;
    height: 100%;
    max-width: 500px;
    aspect-ratio: 9 / 16;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: #000;
}

.story-preview-content img,
.story-preview-content video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-preview-text {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    background: #fbbf24;
}

.story-preview-text-content {
    font-size: 32px;
    font-weight: 600;
    color: #000;
    line-height: 1.4;
    word-wrap: break-word;
    max-width: 100%;
}

/* Vertical Text Story */
.story-preview-text-vertical {
    width: 100% !important;
    height: 100% !important;
}

/* Editing Sidebar */
.story-editing-sidebar {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    background: rgba(26, 29, 33, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    overflow: visible;
    z-index: 10;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

/* Mobile: Move sidebar to bottom */
@media (max-width: 768px) {
    .story-editing-sidebar {
        position: absolute;
        bottom: 16px;
        top: auto;
        left: 50%;
        right: auto;
        transform: translateX(-50%);
        width: auto;
        flex-direction: row;
    }
    
    .story-sidebar-tabs {
        flex-direction: row;
    }
}

.story-sidebar-tabs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.story-sidebar-tab {
    width: 40px;
    height: 40px;
    padding: 0;
    background: transparent;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.story-sidebar-tab svg {
    width: 22px;
    height: 22px;
    stroke: rgba(255, 255, 255, 0.6);
    transition: stroke 0.2s;
}

.story-sidebar-tab:hover {
    background: rgba(255, 255, 255, 0.1);
}

.story-sidebar-tab:hover svg {
    stroke: rgba(255, 255, 255, 0.9);
}

.story-sidebar-tab.active {
    background: rgba(251, 191, 36, 0.2);
}

.story-sidebar-tab.active svg {
    stroke: #fbbf24;
}

/* Sidebar Panels - Centered Modal Popup */
.story-sidebar-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    width: 90%;
    max-width: 450px;
    height: auto;
    max-height: 80vh;
    background: rgba(26, 29, 33, 0.98);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}

.story-sidebar-content.open {
    opacity: 1;
    pointer-events: all;
    transform: translate(-50%, -50%) scale(1);
}

/* Backdrop */
.story-sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 99;
}

.story-sidebar-backdrop.open {
    opacity: 1;
    pointer-events: all;
}

.story-sidebar-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-sidebar-panel-title {
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    margin: 0;
}

.story-sidebar-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.story-sidebar-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.story-sidebar-close svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
}

.story-sidebar-panel {
    display: none;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 60vh;
}

.story-sidebar-panel.active {
    display: block;
}

/* Ensure content doesn't get cut off */
.story-sidebar-panels-wrapper {
    overflow: visible;
    min-height: 0;
}

/* Compact Drawing Tools */
.story-drawing-tools-compact {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.story-tool-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.story-tool-section label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.story-color-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.story-shapes-grid-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.story-enable-drawing-btn-compact {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: #3b82f6;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.story-enable-drawing-btn-compact:hover {
    background: rgba(59, 130, 246, 0.25);
}

.story-enable-drawing-btn-compact svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Text Add Panel */
.story-text-add {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.story-text-overlay-input {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.story-text-overlay-input:focus {
    outline: none;
    border-color: #fbbf24;
}

.story-add-text-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    color: #fbbf24;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.story-add-text-btn:hover {
    background: rgba(251, 191, 36, 0.25);
}

.story-add-text-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Controls */
.story-controls {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 5;
}

.story-controls.show-upload {
    display: flex;
}

/* Upload Section */
.story-upload-section {
    text-align: center;
    padding: 40px;
}

.story-upload-btn {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 32px;
    background: rgba(251, 191, 36, 0.15);
    border: 2px dashed #fbbf24;
    border-radius: 12px;
    color: #fbbf24;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.story-upload-btn:hover {
    background: rgba(251, 191, 36, 0.25);
    transform: translateY(-2px);
}

.story-upload-btn svg {
    width: 24px;
    height: 24px;
    stroke: #fbbf24;
}

.story-upload-hint {
    margin-top: 12px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.5);
}

/* Text Section */
.story-text-section {
    width: 100%;
    max-width: 600px;
    padding: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Text Section */
.story-text-section {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.story-text-input {
    width: 100%;
    min-height: 120px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 16px;
    font-family: inherit;
    resize: vertical;
}

.story-text-input:focus {
    outline: none;
    border-color: #fbbf24;
}

.story-text-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.story-control-group label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.story-bg-colors,
.story-text-colors {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.story-bg-color,
.story-text-color {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.story-bg-color:hover,
.story-text-color:hover {
    transform: scale(1.1);
}

.story-bg-color.active,
.story-text-color.active {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
}

/* Font Select */
.story-font-select {
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.story-font-select:hover {
    border-color: rgba(251, 191, 36, 0.5);
}

.story-font-select:focus {
    outline: none;
    border-color: #fbbf24;
}

.story-font-select option {
    background: #1a1d21;
    color: #fff;
    padding: 8px;
}

/* Text Size Controls */
.story-text-size-controls {
    display: flex;
    gap: 8px;
}

.story-size-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.story-size-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.story-size-btn span {
    font-size: 12px;
    font-weight: 600;
}

.story-size-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(251, 191, 36, 0.5);
}

.story-size-btn.active {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
    color: #fbbf24;
}

/* Text Alignment Controls */
.story-text-align-controls {
    display: flex;
    gap: 8px;
}

.story-align-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.story-align-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.story-align-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(251, 191, 36, 0.5);
}

.story-align-btn.active {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
    color: #fbbf24;
}

/* Stickers Modal */
.story-stickers-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.story-stickers-modal-content {
    background: #1a1d21;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.story-stickers-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-stickers-modal-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.story-stickers-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.story-stickers-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.story-stickers-close svg {
    width: 20px;
    height: 20px;
    stroke: #fff;
}

/* Stickers & Emojis Section */
.story-stickers-section {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    overflow: hidden;
}

.story-stickers-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-sticker-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 2px solid transparent;
}

.story-sticker-tab svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

.story-sticker-tab:hover {
    background: rgba(255, 255, 255, 0.05);
    color: rgba(255, 255, 255, 0.8);
}

.story-sticker-tab.active {
    color: #fbbf24;
    border-bottom-color: #fbbf24;
}

.story-sticker-content {
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

/* Emoji Grid */
.story-emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 4px;
    padding-bottom: 20px;
}

.story-emoji-item {
    font-size: 28px;
    padding: 6px;
    text-align: center;
    cursor: pointer;
    border-radius: 6px;
    transition: all 0.2s;
    user-select: none;
}

.story-emoji-item:hover {
    background: rgba(251, 191, 36, 0.15);
    transform: scale(1.15);
}

/* Giphy Search */
.story-giphy-search {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.story-giphy-input {
    flex: 1;
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
}

.story-giphy-input:focus {
    outline: none;
    border-color: #fbbf24;
}

.story-giphy-search-btn {
    width: 44px;
    height: 44px;
    background: #fbbf24;
    border: none;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.story-giphy-search-btn:hover {
    background: #f59e0b;
}

.story-giphy-search-btn svg {
    width: 20px;
    height: 20px;
    stroke: #000;
}

.story-giphy-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding-bottom: 20px;
}

.story-giphy-item {
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    background: rgba(255, 255, 255, 0.05);
}

.story-giphy-item:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.story-giphy-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.story-giphy-hint {
    text-align: center;
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
    padding: 40px 20px;
    grid-column: 1 / -1;
}

/* Add Stickers Button */
.story-add-stickers-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: 8px;
    color: #fbbf24;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.story-add-stickers-btn:hover {
    background: rgba(251, 191, 36, 0.25);
}

.story-add-stickers-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Drawing Tools */
.story-drawing-tools {
    margin-top: 20px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    padding: 16px;
}

/* Fix SVG rendering */
.story-draw-tool svg,
.story-draw-action svg,
.story-shape-btn svg,
.story-enable-drawing-btn-compact svg {
    stroke-linecap: round;
    stroke-linejoin: round;
}

.story-drawing-toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.story-tool-group {
    display: flex;
    gap: 6px;
    align-items: center;
}

.story-draw-tool,
.story-draw-action {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.story-draw-tool svg,
.story-draw-action svg {
    width: 20px;
    height: 20px;
    stroke: rgba(255, 255, 255, 0.6);
}

.story-draw-tool:hover,
.story-draw-action:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(251, 191, 36, 0.5);
}

.story-draw-tool.active {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
}

.story-draw-tool.active svg {
    stroke: #fbbf24;
}

.story-draw-color {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.story-draw-color:hover {
    transform: scale(1.1);
}

.story-draw-color.active {
    border-color: #fbbf24;
    box-shadow: 0 0 0 2px rgba(251, 191, 36, 0.3);
}

.story-draw-size {
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.story-draw-size:hover {
    background: rgba(255, 255, 255, 0.08);
}

.story-draw-size.active {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
    color: #fbbf24;
}

.story-shapes-toolbar {
    margin-top: 16px;
}

.story-shapes-label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.story-shapes-grid {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.story-shape-btn {
    width: 44px;
    height: 44px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.story-shape-btn svg {
    width: 24px;
    height: 24px;
    stroke: rgba(255, 255, 255, 0.6);
}

.story-shape-btn:hover {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
}

.story-shape-btn:hover svg {
    stroke: #fbbf24;
}

.story-enable-drawing-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px;
    margin-top: 12px;
    background: rgba(59, 130, 246, 0.15);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 8px;
    color: #3b82f6;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.story-enable-drawing-btn:hover {
    background: rgba(59, 130, 246, 0.25);
}

.story-enable-drawing-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Drawing Canvas */
.story-drawing-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    cursor: crosshair;
    z-index: 5;
}

/* Shape Overlays */
.story-shape-overlay {
    position: absolute;
    cursor: move;
    user-select: none;
    z-index: 10;
}

.story-shape-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.story-shape-overlay:hover .story-shape-remove {
    opacity: 1;
}

.story-shape-remove svg {
    width: 12px;
    height: 12px;
    stroke: #fff;
    stroke-width: 3;
}

/* Stickers on Preview */
.story-sticker-overlay {
    position: absolute;
    cursor: move;
    user-select: none;
    z-index: 10;
}

.story-sticker-overlay.emoji {
    font-size: 48px;
}

.story-sticker-overlay.gif {
    min-width: 80px;
    min-height: 80px;
}

.story-sticker-overlay.gif img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 8px;
    pointer-events: none;
}

/* Resize handles for GIFs */
.story-sticker-resize-handle {
    position: absolute;
    bottom: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    background: #fbbf24;
    border: 2px solid #fff;
    border-radius: 50%;
    cursor: nwse-resize;
    z-index: 11;
    opacity: 0;
    transition: opacity 0.2s;
}

.story-sticker-overlay:hover .story-sticker-resize-handle {
    opacity: 1;
}

.story-sticker-remove {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 24px;
    height: 24px;
    background: #ef4444;
    border: 2px solid #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.2s;
}

.story-sticker-overlay:hover .story-sticker-remove {
    opacity: 1;
}

.story-sticker-remove svg {
    width: 12px;
    height: 12px;
    stroke: #fff;
    stroke-width: 3;
}

/* Loading State */
.story-creator-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.story-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(251, 191, 36, 0.2);
    border-top-color: #fbbf24;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.story-creator-loading p {
    color: rgba(255, 255, 255, 0.8);
    font-size: 16px;
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .story-mode-selection > div {
        flex-direction: column;
    }

    .story-preview-text-content {
        font-size: 24px;
        padding: 20px;
    }

    .story-controls {
        padding: 16px;
    }
}

/* Text Editor Compact Styles */
.story-text-editor {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* Editable Text Overlay */
.story-text-overlay-editable {
    width: 100%;
    height: 100%;
    padding: 40px;
    outline: none;
    cursor: text;
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
    line-height: 1.4;
}

.story-text-overlay-editable:empty:before {
    content: 'Tap to type...';
    color: rgba(0, 0, 0, 0.4);
}

/* Vertical Text Story */
.story-preview-text-vertical {
    width: auto !important;
    height: 100% !important;
    max-width: 500px;
    aspect-ratio: 9 / 16;
    margin: 0 auto;
}

.story-control-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.story-control-group label {
    font-size: 12px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.story-text-input-compact {
    width: 100%;
    min-height: 100px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
}

.story-text-input-compact:focus {
    outline: none;
    border-color: #fbbf24;
}

.story-bg-colors-compact {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
}

.story-text-colors-compact {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.story-font-select-compact {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.story-font-select-compact:hover {
    border-color: rgba(251, 191, 36, 0.5);
}

.story-font-select-compact:focus {
    outline: none;
    border-color: #fbbf24;
}

.story-font-select-compact option {
    background: #1a1d21;
    color: #fff;
    padding: 8px;
}

.story-text-size-controls-compact {
    display: flex;
    gap: 8px;
}

.story-text-size-controls-compact .story-size-btn {
    flex: 1;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.story-text-size-controls-compact .story-size-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(251, 191, 36, 0.5);
}

.story-text-size-controls-compact .story-size-btn.active {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
    color: #fbbf24;
}

.story-text-align-controls-compact {
    display: flex;
    gap: 8px;
}

.story-text-align-controls-compact .story-align-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    transition: all 0.2s;
}

.story-text-align-controls-compact .story-align-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.story-text-align-controls-compact .story-align-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(251, 191, 36, 0.5);
}

.story-text-align-controls-compact .story-align-btn.active {
    background: rgba(251, 191, 36, 0.15);
    border-color: #fbbf24;
    color: #fbbf24;
}

/* Accessibility */
.story-creator-back:focus-visible,
.story-creator-post:focus-visible,
.story-mode-card:focus-visible,
.story-upload-btn:focus-visible {
    outline: 2px solid #fbbf24;
    outline-offset: 2px;
}

/* Prevent body scroll */
body.story-creator-open {
    overflow: hidden;
}
