/**
 * Story Viewer CSS - LoveToRead.AI
 * Clean, minimal story reading experience
 * Version: 3.4.0
 * Last Updated: Story Text Edit Feature Added
 */

/* ===================================
   CSS VARIABLES
   =================================== */
:root {
    --primary-green: #2e7d32;
    --primary-green-light: #4caf50;
    --primary-green-lighter: #66bb6a;
    --primary-green-dark: #1b5e20;
    --accent-green: #81c784;
    --bg-green-light: #e8f5e9;
    
    --text-dark: #1a1a1a;
    --text-medium: #4a4a4a;
    --text-light: #6a6a6a;
    
    --white: #ffffff;
    --off-white: #fafafa;
    --border-light: #e0e0e0;
    
    --shadow-sm: 0 2px 4px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s ease;
    
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 16px;
}

/* ===================================
   BASE STYLES
   =================================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #f1f8e9 0%, #e8f5e9 100%);
    color: var(--text-dark);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    margin: 0;
}

/* ===================================
   LOADING STATE
   =================================== */
.loading-state {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid var(--border-light);
    border-top-color: var(--primary-green-light);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    color: var(--text-medium);
    font-weight: 500;
}

/* ===================================
   ERROR STATE
   =================================== */
.error-state {
    min-height: calc(100vh - 70px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
}

.error-content {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 60px 40px;
    max-width: 500px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.error-icon {
    width: 80px;
    height: 80px;
    background: var(--bg-green-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 36px;
    color: var(--primary-green-light);
}

.error-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.error-message {
    font-size: 16px;
    color: var(--text-medium);
    margin-bottom: 32px;
    line-height: 1.6;
}

.btn-back-home {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 14px 28px;
    background: var(--primary-green);
    color: var(--white);
    text-decoration: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-md);
}

.btn-back-home:hover {
    background: var(--primary-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* ===================================
   STORY VIEWER
   =================================== */
.story-viewer {
    min-height: 100vh;
}

/* ===================================
   STORY TOP BAR
   =================================== */
.story-top-bar {
    background: var(--white);
    border-bottom: 1px solid var(--border-light);
    box-shadow: var(--shadow-sm);
}

.story-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px 32px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 32px;
}

.story-info-group {
    display: flex;
    align-items: center;
    gap: 20px;
    flex: 1;
    min-width: 0;
}

.story-icon {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-green), var(--primary-green-lighter));
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--white);
    font-size: 28px;
    flex-shrink: 0;
}

.story-details {
    flex: 1;
    min-width: 0;
}

.story-title-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    min-width: 0;
}

.story-name {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Edit Title Button */
.edit-title-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: none;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
    opacity: 0.5;
}

.story-title-wrapper:hover .edit-title-btn,
.edit-title-btn:focus {
    opacity: 1;
}

.edit-title-btn:hover {
    background: var(--bg-green-light);
    color: var(--primary-green);
}

.edit-title-btn i {
    font-size: 12px;
}

/* Title Edit Input */
.title-edit-input {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    background: var(--white);
    border: 2px solid var(--primary-green);
    border-radius: var(--border-radius-sm);
    padding: 4px 10px;
    width: 100%;
    min-width: 0;
    font-family: inherit;
    outline: none;
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

.title-edit-input:disabled {
    opacity: 0.6;
}

/* Title Edit Actions */
.title-edit-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.title-edit-save,
.title-edit-cancel {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.title-edit-save {
    background: var(--primary-green);
    color: var(--white);
}

.title-edit-save:hover {
    background: var(--primary-green-dark);
    transform: scale(1.1);
}

.title-edit-cancel {
    background: #f44336;
    color: var(--white);
}

.title-edit-cancel:hover {
    background: #e53935;
    transform: scale(1.1);
}

.title-edit-save i,
.title-edit-cancel i {
    font-size: 13px;
}

.story-badges {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.info-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: var(--bg-green-light);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-medium);
}

.info-badge i {
    color: var(--primary-green-light);
    font-size: 12px;
}

/* Action Buttons */
.story-actions-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.icon-action-btn {
    width: 44px;
    height: 44px;
    background: transparent;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    color: var(--text-medium);
    font-size: 18px;
}

.icon-action-btn:hover {
    background: var(--bg-green-light);
    border-color: var(--primary-green-light);
    color: var(--primary-green);
    transform: translateY(-2px);
}

.icon-action-btn:disabled {
    cursor: not-allowed !important;
    opacity: 0.6 !important;
}

.icon-action-btn .fa-spinner {
    color: var(--primary-green);
}

.download-pdf-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--primary-green);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.download-pdf-btn:hover {
    background: var(--primary-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.order-book-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #ff9800;
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-sm);
}

.order-book-btn:hover {
    background: #f57c00;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.order-book-btn i {
    font-size: 16px;
}

/* Generate Videos Button */
#generateVideosBtn,
#downloadVideoBookBtn {
    background: transparent;
    color: var(--text-medium);
    border: 2px solid var(--border-light);
    padding: 0;
    width: 44px;
    height: 44px;
    border-radius: var(--border-radius-md);
    font-size: 18px;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
}

#generateVideosBtn:hover,
#downloadVideoBookBtn:hover {
    background: var(--bg-green-light);
    border-color: var(--primary-green-light);
    color: var(--primary-green);
    transform: translateY(-2px);
}

#generateVideosBtn:disabled,
#downloadVideoBookBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    background: transparent;
}

#generateVideosBtn i,
#downloadVideoBookBtn i {
    font-size: 18px;
}

/* ===================================
   SPELLING WORDS BAR
   =================================== */
.spelling-words-bar {
    background: var(--bg-green-light);
    border-bottom: 2px solid var(--primary-green-light);
    padding: 16px 0;
}

.spelling-bar-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 32px;
    display: flex;
    align-items: center;
    gap: 20px;
}

.spelling-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 15px;
    color: var(--primary-green);
    white-space: nowrap;
}

.spelling-title i {
    font-size: 18px;
}

.word-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.spelling-word-chip {
    padding: 6px 14px;
    background: var(--white);
    border: 2px solid var(--primary-green-light);
    border-radius: 24px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-green);
    transition: all var(--transition-fast);
}

.spelling-word-chip:hover {
    background: var(--primary-green-light);
    color: var(--white);
    transform: translateY(-1px);
}

/* ===================================
   STORY BOOK
   =================================== */
.story-book-wrapper {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 32px 60px;
}

.story-book {
    position: relative;
    display: flex;
    align-items: center;
    gap: 20px;
}

/* Navigation Arrows */
.nav-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 56px;
    height: 56px;
    background: var(--white);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    z-index: 10;
    color: var(--text-dark);
    font-size: 20px;
    box-shadow: var(--shadow-md);
}

.nav-arrow:hover:not(:disabled) {
    background: var(--primary-green);
    color: var(--white);
    border-color: var(--primary-green);
    transform: translateY(-50%) scale(1.1);
}

.nav-arrow:disabled {
    cursor: not-allowed;
    opacity: 0.3;
}

.nav-prev {
    left: -28px;
}

.nav-next {
    right: -28px;
}

/* Book Container */
.book-container {
    flex: 1;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.pages-wrapper {
    position: relative;
    height: 600px;
}

/* ===================================
   INTRO SCREEN (COVER PAGE)
   =================================== */
.intro-screen-wrapper {
    display: none;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 24px 20px 48px;
    box-sizing: border-box;
    overflow: hidden;
}

.intro-screen-wrapper.active {
    display: block;
}

.intro-cover-container {
    position: relative;
    width: 100%;
    margin: 0 auto;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 20px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.15);
}

.intro-cover-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

.intro-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.75) 0%, rgba(0,0,0,0.3) 60%, transparent 100%);
    padding: 60px 24px 24px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.intro-content {
    text-align: center;
    max-width: 100%;
    width: 100%;
}

.intro-title {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin: 0 0 12px 0;
    line-height: 1.15;
    text-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.intro-meta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 0;
}

.intro-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(255,255,255,0.18);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #fff;
}

.intro-badge i {
    font-size: 11px;
}

/* Intro Buttons — below the cover, not overlaid */
.intro-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin: 20px auto 0;
}

.intro-start-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--primary-green);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 16px rgba(46,125,50,0.3);
    width: 100%;
}

.intro-start-btn:hover {
    background: var(--primary-green-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46,125,50,0.4);
}

.intro-start-btn i {
    font-size: 17px;
}

.intro-watch-btn,
.intro-listen-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: #fff;
    color: var(--primary-green-dark);
    border: 1.5px solid #c8e6c9;
    border-radius: 14px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
}

.intro-watch-btn:hover,
.intro-listen-btn:hover {
    background: var(--primary-green);
    color: #fff;
    border-color: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(46,125,50,0.25);
}

.intro-watch-btn i,
.intro-listen-btn i {
    font-size: 17px;
}

/* Generate Audio Button */
.intro-generate-audio-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3);
    margin-top: 12px;
}

.intro-generate-audio-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.intro-generate-audio-btn i {
    font-size: 16px;
}

/* Audio Only Mode Container */
.audio-only-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 600px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: var(--border-radius-lg);
    color: white;
    padding: 40px;
    text-align: center;
    position: relative;
}

.audio-only-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    align-items: center;
    width: 100%;
    max-width: 600px;
}

.audio-now-playing {
    font-size: 14px;
    opacity: 0.9;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.audio-now-playing i {
    font-size: 48px;
    display: block;
    margin-bottom: 12px;
    animation: audioPulse 2s ease-in-out infinite;
}

@keyframes audioPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.1); opacity: 0.8; }
}

.audio-page-indicator {
    font-size: 13px;
    opacity: 0.8;
    margin-bottom: 8px;
}

.audio-only-text {
    font-size: 22px;
    line-height: 1.7;
    font-weight: 500;
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: opacity 0.3s ease;
    word-wrap: break-word;
}

.audio-controls {
    display: flex;
    gap: 16px;
    margin-top: 20px;
}

.audio-controls button {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.audio-controls button:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: white;
}

.audio-controls button.primary {
    background: white;
    color: #764ba2;
    border-color: white;
}

.audio-controls button.primary:hover {
    background: rgba(255, 255, 255, 0.9);
}

/* Audio Generation Modal - LEGACY (keeping for reference, use .audio-modal-legacy if needed) */
.audio-modal-overlay-legacy {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

.audio-modal-legacy {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.audio-modal-legacy h3 {
    font-size: 24px;
    color: #1a1a2e;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.audio-modal-legacy h3 i {
    color: #7c3aed;
}

.audio-modal-legacy p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
}

.audio-modal-legacy .credit-info {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 1px solid #86efac;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
}

.audio-modal-legacy .credit-info .cost {
    font-size: 28px;
    font-weight: 700;
    color: #16a34a;
}

.audio-modal-legacy .credit-info .balance {
    font-size: 14px;
    color: #666;
    margin-top: 4px;
}

.audio-modal-legacy .voice-select {
    margin-bottom: 24px;
}

.audio-modal-legacy .voice-select label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #333;
}

.audio-modal-legacy .voice-select select {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    cursor: pointer;
    transition: border-color 0.2s;
}

.audio-modal-legacy .voice-select select:focus {
    outline: none;
    border-color: #7c3aed;
}

.audio-modal-buttons-legacy {
    display: flex;
    gap: 12px;
}

.audio-modal-buttons-legacy button {
    flex: 1;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.audio-modal-buttons-legacy .cancel-btn {
    background: #f3f4f6;
    color: #374151;
    border: none;
}

.audio-modal-buttons-legacy .cancel-btn:hover {
    background: #e5e7eb;
}

.audio-modal-buttons-legacy .generate-btn {
    background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
    color: white;
    border: none;
}

.audio-modal-buttons-legacy .generate-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}

.audio-modal-buttons-legacy .generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===================================
   STORY PAGE - FIXED FOR 50/50 SPLIT
   =================================== */
.story-page {
    display: none;
    animation: pageTransition 0.4s ease;
    transition: opacity 0.5s ease-in-out;
    will-change: opacity;
}

.story-page.active {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
    height: 600px;
}

@keyframes pageTransition {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Left Side - Image Section */
.page-image-section {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    width: 100%;
    height: 100%;
}

/* Image Wrapper */
.page-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
}

.page-image-wrapper.video-playing {
    will-change: contents;
}

/* Image */
.page-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: opacity 0.6s ease-in-out;
    will-change: opacity;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.page-image-wrapper.video-playing .page-image {
    opacity: 0;
    pointer-events: none;
}

.page-image-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    color: rgba(0, 0, 0, 0.1);
    font-size: 80px;
}

/* Video */
.page-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.6s ease-in-out;
    will-change: opacity;
    preload: auto;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.page-image-wrapper.video-playing .page-video {
    opacity: 1;
    pointer-events: auto;
}

.page-video::before {
    content: '';
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
}

/* Video Play Overlay */
.video-play-overlay {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    transition: opacity 0.4s ease-in-out;
    will-change: opacity;
}

.page-image-wrapper.video-playing .video-play-overlay {
    opacity: 0;
    pointer-events: none;
}

.video-play-btn-overlay {
    width: 56px;
    height: 56px;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid var(--border-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.video-play-btn-overlay:hover {
    background: var(--white);
    border-color: var(--primary-green);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.3);
}

.video-play-btn-overlay i {
    color: var(--primary-green);
    font-size: 20px;
    margin-left: 3px;
}

/* Video Controls Overlay */
.video-controls-overlay {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0) 100%);
    padding: 16px;
    opacity: 0;
    transition: opacity 0.4s ease-in-out;
    pointer-events: none;
    z-index: 15;
    will-change: opacity;
}

.page-image-wrapper.video-playing:hover .video-controls-overlay {
    opacity: 1;
    pointer-events: auto;
}

.video-controls-overlay button {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.video-controls-overlay button:hover {
    background: var(--white);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.video-controls-overlay button i {
    color: var(--text-dark);
    font-size: 16px;
}

/* Right Side - Text Section */
.page-text-section {
    padding: 60px 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.page-text {
    font-size: 22px;
    line-height: 1.8;
    color: var(--text-dark);
    text-align: left;
}

.page-text .spelling-word {
    background: var(--bg-green-light);
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 600;
    color: var(--primary-green);
    border-bottom: 2px solid var(--primary-green-light);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-text .spelling-word:hover {
    background: var(--primary-green-light);
    color: var(--white);
    transform: translateY(-1px);
}

/* ===================================
   PAGE CONTROLS
   =================================== */
.page-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 32px;
    padding: 24px 32px;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-md);
}

.control-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    background: var(--primary-green-light);
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    font-size: 15px;
}

.control-btn:hover {
    background: var(--primary-green);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.control-btn i {
    font-size: 16px;
}

.page-indicator-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.page-counter {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-medium);
}

.page-dots {
    display: flex;
    gap: 8px;
}

.page-dot {
    width: 10px;
    height: 10px;
    background: var(--border-light);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal);
    padding: 0;
}

.page-dot:hover {
    background: var(--accent-green);
    transform: scale(1.2);
}

.page-dot.active {
    background: var(--primary-green);
    transform: scale(1.3);
}

.control-spacer {
    width: 140px;
}

/* ===================================
   AUTO-PLAY INDICATOR
   =================================== */
.autoplay-indicator {
    position: fixed;
    top: 80px;
    right: 20px;
    background: var(--primary-green);
    color: var(--white);
    padding: 12px 20px;
    border-radius: var(--border-radius-md);
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.4);
    z-index: 1000;
    animation: slideInRight 0.3s ease;
}

.autoplay-indicator i {
    animation: pulse 1.5s ease infinite;
}

.autoplay-stop-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: var(--white);
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.autoplay-stop-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* ===================================
   ENDING PAGE
   =================================== */
.ending-page {
    background: linear-gradient(135deg, #f1f8e9 0%, #e8f5e9 100%);
    min-height: 500px;
    padding: 60px 40px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow: visible;
}

.ending-wrapper {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    max-width: 1100px;
    width: 100%;
    align-items: start;
    padding-bottom: 40px;
}

.ending-left {
    display: flex;
}

.ending-card {
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.ending-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: var(--primary-green);
    margin-bottom: 8px;
}

.ending-logo i {
    font-size: 32px;
}

.ending-logo span {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.ending-divider {
    width: 100%;
    height: 1px;
    background: var(--border-light);
    margin: 28px 0;
}

.ending-question {
    font-size: 22px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 20px 0;
}

.ending-text {
    font-size: 16px;
    color: var(--text-medium);
    margin: 0 0 16px 0;
    line-height: 1.5;
}

.ending-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    margin-bottom: 0;
}

.rating-btn {
    flex: 1;
    padding: 14px 24px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.rating-yes {
    background: var(--primary-green);
    color: var(--white);
}

.rating-yes:hover {
    background: var(--primary-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.rating-no {
    background: #f44336;
    color: var(--white);
}

.rating-no:hover {
    background: #e53935;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ending-btn {
    width: 100%;
    max-width: 250px;
    padding: 14px 32px;
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    text-decoration: none;
    display: inline-block;
}

.ending-btn-primary {
    background: var(--primary-green);
    color: var(--white);
}

.ending-btn-primary:hover {
    background: var(--primary-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ending-btn-secondary {
    background: var(--bg-green-light);
    color: var(--primary-green);
    border: 2px solid var(--primary-green-light);
}

.ending-btn-secondary:hover {
    background: var(--primary-green-light);
    color: var(--white);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ending-right {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    justify-content: flex-start;
    min-height: 0;
}

.ending-book-cover {
    position: relative;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 400px;
    flex-shrink: 0;
}

.ending-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ending-book-title {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.7) 70%, transparent 100%);
    color: var(--white);
    padding: 32px 20px 20px;
    font-size: 18px;
    font-weight: 700;
    text-align: center;
}

.ending-order-btn {
    width: 100%;
    max-width: 400px;
    padding: 16px 32px;
    background: #ff9800;
    color: var(--white);
    border: none;
    border-radius: var(--border-radius-md);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    flex-shrink: 0;
}

.ending-order-btn:hover {
    background: #f57c00;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.ending-order-btn i {
    font-size: 20px;
}

/* ===================================
   REGENERATION MODAL
   =================================== */
.regeneration-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

.modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    max-width: 440px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    z-index: 1;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    text-align: center;
    margin-bottom: 32px;
}

.modal-header h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0;
}

.modal-body {
    text-align: center;
}

.regeneration-spinner {
    width: 70px;
    height: 70px;
    border: 5px solid var(--border-light);
    border-top-color: var(--primary-green);
    border-right-color: var(--primary-green-light);
    border-radius: 50%;
    animation: spinModal 1s linear infinite;
    margin: 0 auto 24px;
}

@keyframes spinModal {
    to { transform: rotate(360deg); }
}

.regeneration-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 8px 0;
}

.regeneration-subtext {
    font-size: 14px;
    color: var(--text-light);
    margin: 0;
}

/* ===================================
   REGENERATE BUTTON STYLING
   =================================== */
#regenerateImageBtn,
#regenerateCoverBtn {
    position: relative;
}

#regenerateImageBtn:disabled,
#regenerateCoverBtn:disabled {
    cursor: not-allowed;
    opacity: 0.5 !important;
}

#regenerateImageBtn:not(:disabled):hover,
#regenerateCoverBtn:not(:disabled):hover {
    background: var(--bg-green-light);
    border-color: var(--primary-green);
    color: var(--primary-green);
}

#regenerateImageBtn:not(:disabled):hover i,
#regenerateCoverBtn:not(:disabled):hover i {
    animation: rotateIcon 0.6s ease-in-out;
}

@keyframes rotateIcon {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ===================================
   PRIVACY BADGES & INDICATORS
   =================================== */
.privacy-badge {
    display: flex;
    align-items: center;
    gap: 6px;
}

.privacy-badge.public {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border: 1px solid #2196F3;
}

.privacy-badge.public i {
    color: #2196F3;
}

.privacy-badge.private {
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border: 1px solid #ff9800;
}

.privacy-badge.private i {
    color: #ff9800;
}

/* ===================================
   PRIVACY TOGGLE MODAL
   =================================== */
.privacy-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.privacy-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.privacy-modal .modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 100%;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.privacy-modal .modal-header {
    padding: 24px 24px 16px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.privacy-modal .modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.privacy-modal .modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-medium);
    transition: all var(--transition-fast);
    font-size: 18px;
}

.privacy-modal .modal-close:hover {
    background: var(--bg-green-light);
    color: var(--primary-green);
}

.privacy-modal .modal-body {
    padding: 24px;
}

.privacy-modal .modal-body p {
    margin: 0;
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-medium);
}

.privacy-modal .modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.privacy-modal .btn-cancel {
    padding: 10px 20px;
    background: transparent;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 14px;
    color: var(--text-medium);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.privacy-modal .btn-cancel:hover {
    background: var(--bg-green-light);
    border-color: var(--primary-green-light);
    color: var(--primary-green);
}

.privacy-modal .btn-confirm {
    padding: 10px 20px;
    background: var(--primary-green);
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 14px;
    color: var(--white);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
}

.privacy-modal .btn-confirm:hover {
    background: var(--primary-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.privacy-modal .btn-confirm:disabled {
    cursor: not-allowed !important;
    opacity: 0.7 !important;
}

.privacy-modal .btn-confirm .fa-spinner {
    animation: spin 1s linear infinite;
}

.privacy-modal .btn-confirm i {
    font-size: 16px;
}

/* ===================================
   IMAGE FIX MODAL
   =================================== */
.image-fix-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.image-fix-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    cursor: pointer;
}

.image-fix-modal .modal-content {
    position: relative;
    background: var(--white);
    border-radius: 16px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
    animation: slideUp 0.3s ease;
    z-index: 1;
}

.image-fix-content {
    max-width: 460px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    transition: max-width 0.3s ease;
}

.fix-state {
    display: none;
}

.image-fix-modal .modal-header {
    padding: 20px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.image-fix-modal .modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-dark);
}

.image-fix-modal .modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-medium);
    transition: all 0.15s ease;
    font-size: 16px;
}

.image-fix-modal .modal-close:hover {
    background: #f3f4f6;
    color: var(--text-dark);
}

.image-fix-modal .modal-body {
    padding: 0 24px 8px;
}

.image-fix-modal .modal-footer {
    padding: 12px 24px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Mode Toggle */
.fix-mode-toggle {
    display: flex;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 16px;
}

.fix-toggle-btn {
    flex: 1;
    padding: 10px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: #6b7280;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.fix-toggle-btn:hover {
    color: var(--text-dark);
}

.fix-toggle-btn.active {
    background: var(--primary-green);
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.fix-toggle-btn i {
    font-size: 13px;
}

/* Hint Text */
.fix-hint {
    font-size: 13px;
    color: #6b7280;
    margin: 0 0 12px 0;
    line-height: 1.5;
}

/* Textarea */
.fix-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-dark);
    resize: vertical;
    min-height: 100px;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
    background: #fafafa;
}

.fix-textarea:focus {
    outline: none;
    border-color: var(--primary-green);
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
    background: white;
}

.fix-textarea::placeholder {
    color: #9ca3af;
}

.fix-textarea-sm {
    min-height: 60px;
    margin-bottom: 12px;
}

/* Credit Cost Indicator */
.fix-credit-cost {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 12px;
    padding: 8px 12px;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #15803d;
}

.fix-credit-cost i {
    font-size: 12px;
}

/* Admin Options */
.fix-admin-options {
    margin-top: 16px;
    padding: 12px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 10px;
}

.fix-admin-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #92400e;
    margin-bottom: 8px;
}

.fix-admin-label i {
    font-size: 12px;
    color: #d97706;
}

.fix-admin-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.fix-admin-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary-green);
}

.fix-admin-checkbox label {
    font-size: 13px;
    color: #374151;
    cursor: pointer;
}

/* Admin Video Section */
.fix-admin-video {
    margin-top: 16px;
    padding: 12px;
    background: #faf5ff;
    border: 1px solid #e9d5ff;
    border-radius: 10px;
}

.fix-admin-video .fix-admin-label i {
    color: #7c3aed;
}

.fix-admin-video .fix-admin-label {
    color: #581c87;
}

.fix-admin-hint {
    font-size: 12px;
    color: #6b7280;
    margin: 0 0 8px 0;
}

.fix-admin-divider {
    margin: 14px 0;
    border-top: 1px dashed #e9d5ff;
}

.fix-video-upload-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.fix-video-name {
    font-size: 12px;
    color: #6b7280;
}

.btn-video-regen {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.btn-video-regen:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-video-choose {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-video-upload {
    display: none;
    margin-top: 10px;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: linear-gradient(135deg, #059669, #047857);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

/* Submit / Cancel Buttons */
.btn-fix {
    padding: 10px 20px;
    background: var(--primary-green);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--white);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-fix:hover {
    background: var(--primary-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-fix i {
    font-size: 14px;
}

.image-fix-modal .btn-cancel {
    padding: 10px 20px;
    background: transparent;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.image-fix-modal .btn-cancel:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
    color: var(--text-dark);
}

/* Processing State */
.fix-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid #e5e7eb;
    border-top-color: var(--primary-green);
    border-right-color: var(--primary-green-light);
    border-radius: 50%;
    animation: spinModal 1s linear infinite;
    margin: 0 auto 20px;
}

.fix-processing-text {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 6px 0;
    text-align: center;
}

.fix-processing-subtext {
    font-size: 13px;
    color: #9ca3af;
    margin: 0;
    text-align: center;
}

/* Review state needs more width for side-by-side comparison */
.image-fix-content.review-mode {
    max-width: 680px;
}

/* Review / Comparison State */
.image-comparison {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 16px;
    align-items: center;
    margin-bottom: 20px;
}

.comparison-side {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.comparison-label {
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
    margin: 0;
}

.comparison-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
    border: 2px solid #e5e7eb;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.comparison-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-green);
    font-size: 20px;
}

.review-question {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    margin: 0 0 16px 0;
}

.btn-accept {
    padding: 10px 20px;
    background: var(--primary-green);
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    color: var(--white);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-accept:hover {
    background: var(--primary-green-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3);
}

.btn-accept i {
    font-size: 14px;
}

.btn-reject {
    padding: 10px 20px;
    background: transparent;
    border: 1.5px solid #e5e7eb;
    border-radius: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: inherit;
}

.btn-reject:hover {
    background: #fef2f2;
    border-color: #fca5a5;
    color: #dc2626;
}

.btn-reject i {
    font-size: 14px;
}

/* ===================================
   REDUCED MOTION
   =================================== */
@media (prefers-reduced-motion: reduce) {
    .story-page,
    .page-video,
    .page-image,
    .video-play-overlay,
    .video-controls-overlay {
        transition: none !important;
    }
}

/* ===================================
   RESPONSIVE DESIGN - TABLET
   =================================== */
@media (max-width: 1024px) {
    .story-name {
        font-size: 20px;
    }

    .title-edit-input {
        font-size: 20px;
    }
    
    .page-text {
        font-size: 20px;
        padding: 20px 16px;
    }
    
    .nav-arrow {
        width: 48px;
        height: 48px;
        font-size: 18px;
    }
    
    .intro-title {
        font-size: 36px;
    }
    
    .intro-start-btn {
        padding: 16px 36px;
        font-size: 17px;
    }
    
    .ending-wrapper {
        gap: 40px;
    }
    
    .ending-card {
        padding: 32px;
    }
    
    .ending-logo i {
        font-size: 28px;
    }
    
    .ending-logo span {
        font-size: 24px;
    }
    
    .ending-question {
        font-size: 20px;
    }
}

/* ===================================
   RESPONSIVE DESIGN - MOBILE
   =================================== */
@media (max-width: 768px) {
    .story-bar-inner {
        flex-direction: column;
        padding: 12px 16px;
        gap: 12px;
        align-items: stretch;
    }
    
    .story-info-group {
        width: 100%;
        gap: 12px;
    }
    
    .story-icon {
        width: 48px;
        height: 48px;
        font-size: 22px;
    }
    
    .story-name {
        font-size: 16px;
        white-space: normal;
        line-height: 1.3;
    }

    .story-title-wrapper {
        margin-bottom: 6px;
    }

    .edit-title-btn {
        opacity: 1;
        width: 24px;
        height: 24px;
    }

    .edit-title-btn i {
        font-size: 11px;
    }

    .title-edit-input {
        font-size: 16px;
        padding: 3px 8px;
    }

    .story-badges {
        gap: 6px;
    }
    
    .info-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
    
    .info-badge i {
        font-size: 10px;
    }
    
    .story-actions-group {
        width: 100%;
        justify-content: flex-end;
        gap: 8px;
    }
    
    .icon-action-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .download-pdf-btn {
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .spelling-words-bar {
        display: none !important;
    }
    
    .story-book-wrapper {
        padding: 0;
        margin: 0;
        padding-bottom: 70px;
    }
    
    .story-book {
        position: relative;
    }
    
    .book-container {
        margin: 0;
        border-radius: 0;
        box-shadow: none;
        height: auto;
        min-height: 105vh;
    }
    
    .pages-wrapper {
        min-height: auto;
        max-height: 100%;
        height: auto;
    }
    
    .nav-arrow {
        width: 44px;
        height: 44px;
        font-size: 18px;
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        z-index: 50;
        background: rgba(255, 255, 255, 0.95);
        box-shadow: var(--shadow-lg);
    }
    
    .nav-prev {
        left: 8px;
    }
    
    .nav-next {
        right: 8px;
    }
    
    .intro-screen-wrapper {
        padding: 16px 16px 40px;
    }

    .intro-cover-container {
        border-radius: 16px;
    }

    .intro-overlay {
        padding: 40px 16px 16px;
    }

    .intro-title {
        font-size: 22px;
        margin-bottom: 8px;
    }

    .intro-badge {
        font-size: 11px;
        padding: 4px 10px;
    }

    .intro-buttons {
        margin-top: 16px;
        gap: 8px;
    }

    .intro-start-btn {
        padding: 13px 20px;
        font-size: 15px;
    }

    .intro-watch-btn,
    .intro-listen-btn {
        padding: 11px 20px;
        font-size: 14px;
    }
    
    .story-page.active {
        display: flex;
        flex-direction: column;
        height: auto;
    }
    
    .page-image-section {
        width: 100vw;
        height: auto;
        aspect-ratio: 1 / 1;
        margin: 0;
        padding: 0;
        border-radius: 0;
    }
    
    .page-text-section {
        padding: 0px;
        min-height: auto;
        max-width: 100%;
        height: auto;
    }
    
    .page-text {
        font-size: 17px;
        line-height: 1.7;
        text-align: left;
        max-width: 100%;
        padding: 20px 16px;
    }
    
    .video-play-overlay {
        top: 12px;
        left: 12px;
    }
    
    .video-play-btn-overlay {
        width: 48px;
        height: 48px;
    }
    
    .video-play-btn-overlay i {
        font-size: 18px;
    }
    
    .video-controls-overlay {
        padding: 12px;
    }
    
    .video-controls-overlay button {
        width: 36px;
        height: 36px;
    }
    
    .video-controls-overlay button i {
        font-size: 14px;
    }
    
    #generateVideosBtn,
    #downloadVideoBookBtn {
        width: 40px;
        height: 40px;
    }
    
    #generateVideosBtn i,
    #downloadVideoBookBtn i {
        font-size: 16px;
    }
    
    .page-controls {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 12px;
        padding: 12px 16px;
        margin: 0;
        background: var(--white);
        border-top: 1px solid var(--border-light);
        box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
        z-index: 40;
    }
    
    .control-btn {
        padding: 10px 16px;
        font-size: 14px;
        flex-shrink: 0;
    }
    
    .page-indicator-container {
        gap: 8px;
        flex-shrink: 0;
    }
    
    .page-counter {
        font-size: 14px;
        font-weight: 600;
    }
    
    .page-dots {
        gap: 6px;
    }
    
    .page-dot {
        width: 8px;
        height: 8px;
    }
    
    .control-spacer {
        display: none;
    }
    
    .autoplay-indicator {
        top: 70px;
        right: 10px;
        padding: 10px 16px;
        font-size: 14px;
    }
    
    .ending-page {
        padding: 40px 20px;
        height: auto;
        min-height: 100vh;
        overflow-y: auto;
    }
    
    .ending-wrapper {
        display: flex;
        flex-direction: column;
        gap: 32px;
        height: auto;
    }
    
    .ending-left,
    .ending-right {
        width: 100%;
        max-width: 100%;
    }
    
    .ending-card {
        padding: 28px 24px;
    }
    
    .ending-logo i {
        font-size: 24px;
    }
    
    .ending-logo span {
        font-size: 22px;
    }
    
    .ending-divider {
        margin: 24px 0;
    }
    
    .ending-question {
        font-size: 18px;
        margin-bottom: 16px;
    }
    
    .ending-text {
        font-size: 15px;
    }
    
    .rating-btn,
    .ending-btn {
        padding: 12px 24px;
        font-size: 15px;
    }
    
    .ending-book-cover {
        max-width: 400px;
        margin: 0 auto;
    }
    
    .ending-order-btn {
        font-size: 16px;
        padding: 14px 28px;
    }
    
    .modal-content {
        padding: 32px 24px;
        max-width: 90%;
    }
    
    .modal-header h3 {
        font-size: 20px;
    }
    
    .regeneration-spinner {
        width: 60px;
        height: 60px;
        border-width: 4px;
    }
    
    .regeneration-text {
        font-size: 15px;
    }
    
    .regeneration-subtext {
        font-size: 13px;
    }
    
    .privacy-modal .modal-content {
        max-width: calc(100% - 32px);
    }
    
    .privacy-modal .modal-header {
        padding: 20px 20px 12px;
    }
    
    .privacy-modal .modal-header h3 {
        font-size: 18px;
    }
    
    .privacy-modal .modal-body {
        padding: 20px;
    }
    
    .privacy-modal .modal-body p {
        font-size: 14px;
    }
    
    .privacy-modal .modal-footer {
        padding: 12px 20px;
        flex-direction: column-reverse;
    }
    
    .privacy-modal .btn-cancel,
    .privacy-modal .btn-confirm {
        width: 100%;
        justify-content: center;
        padding: 12px;
    }
    
    .image-fix-content {
        max-width: calc(100% - 24px);
    }

    .image-fix-modal .modal-header {
        padding: 16px 20px 12px;
    }

    .image-fix-modal .modal-header h3 {
        font-size: 18px;
    }

    .image-fix-modal .modal-body {
        padding: 0 20px 8px;
    }

    .image-fix-modal .modal-footer {
        padding: 10px 20px 16px;
        flex-direction: column-reverse;
        gap: 8px;
    }

    .image-comparison {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .comparison-divider {
        transform: rotate(90deg);
    }

    .btn-fix,
    .btn-accept,
    .btn-reject,
    .image-fix-modal .btn-cancel {
        width: 100%;
        justify-content: center;
    }
}

/* ===================================
   RESPONSIVE DESIGN - SMALL MOBILE
   =================================== */
@media (max-width: 480px) {
    .story-header {
        top: 60px;
    }
    
    .header-container {
        padding: 10px 12px;
    }
    
    .story-title {
        font-size: 15px;
    }
    
    .meta-badge {
        font-size: 10px;
        padding: 2px 6px;
    }
    
    .action-btn-icon {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .action-btn-primary {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .spelling-container {
        padding: 0 12px;
    }
    
    .spelling-label {
        font-size: 13px;
    }
    
    .spelling-word-chip {
        padding: 4px 10px;
        font-size: 12px;
    }
    
    .nav-arrow {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .nav-prev {
        left: 4px;
    }
    
    .nav-next {
        right: 4px;
    }
    
    .intro-title {
        font-size: 24px;
    }
    
    .intro-badge {
        font-size: 12px;
        padding: 5px 12px;
    }
    
    .intro-start-btn,
    .intro-watch-btn {
        padding: 12px 28px;
        font-size: 15px;
    }
    
    .page-image-section {
        min-height: 45vh;
    }
    
    .page-text-section {
        padding: 0px;
    }
    
    .page-text {
        font-size: 16px;
        padding: 20px 16px;
    }
    
    .page-controls {
        padding: 10px 12px;
    }
    
    .control-btn {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .page-counter {
        font-size: 13px;
    }
    
    .ending-page {
        padding: 32px 16px;
        min-height: 100vh;
        height: auto;
    }
    
    .ending-wrapper {
        display: flex;
        flex-direction: column;
    }
    
    .ending-card {
        padding: 24px 20px;
    }
    
    .ending-logo {
        flex-direction: column;
        gap: 8px;
    }
    
    .ending-logo i {
        font-size: 28px;
    }
    
    .ending-logo span {
        font-size: 20px;
    }
    
    .ending-divider {
        margin: 20px 0;
    }
    
    .ending-question {
        font-size: 17px;
    }
    
    .ending-actions {
        flex-direction: column;
        gap: 10px;
    }
    
    .rating-btn {
        width: 100%;
    }
    
    .ending-book-cover {
        max-width: 100%;
    }
    
    .ending-book-title {
        font-size: 16px;
        padding: 24px 16px 16px;
    }
    
    .ending-order-btn {
        font-size: 15px;
    }
    
    .modal-content {
        padding: 28px 20px;
    }
    
    .modal-header {
        margin-bottom: 24px;
    }
    
    .modal-header h3 {
        font-size: 18px;
    }
    
    .regeneration-spinner {
        width: 50px;
        height: 50px;
        margin-bottom: 20px;
    }
    
    .privacy-modal .modal-header h3 {
        font-size: 16px;
    }
    
    .privacy-modal .modal-body p {
        font-size: 13px;
    }
    
    .image-fix-modal {
        padding: 10px;
    }

    .image-fix-content {
        max-width: 100%;
    }

    .image-fix-modal .modal-header h3 {
        font-size: 17px;
    }

    .fix-mode-toggle {
        margin-bottom: 12px;
    }

    .fix-toggle-btn {
        font-size: 13px;
        padding: 8px 10px;
    }

    .fix-hint {
        font-size: 12px;
    }

    .fix-textarea {
        font-size: 13px;
        padding: 10px 12px;
        min-height: 80px;
    }

    .fix-credit-cost {
        font-size: 12px;
    }

    .comparison-label {
        font-size: 11px;
    }

    .comparison-divider {
        font-size: 18px;
    }

    .review-question {
        font-size: 14px;
    }

    .btn-fix,
    .btn-accept,
    .btn-reject,
    .image-fix-modal .btn-cancel {
        font-size: 13px;
        padding: 10px 16px;
    }
}

/* ===================================
   PRINT STYLES
   =================================== */
@media print {
    .story-header,
    .spelling-banner,
    .nav-arrow,
    .page-controls {
        display: none !important;
    }
    
    .story-viewer {
        padding-top: 0;
    }
    
    .story-page {
        display: block !important;
        page-break-after: always;
    }
    
    .story-page.active {
        display: flex;
        flex-direction: column;
    }
}

/* ===================================
   TOAST ANIMATIONS
   =================================== */
@keyframes slideUpToast {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideDownToast {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
    to {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
}



/* ===================================
   VIDEO BOOK MODAL
   =================================== */
.video-book-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 0.2s ease;
}

.video-book-modal .modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    cursor: pointer;
}

.video-book-modal .modal-content {
    position: relative;
    background: var(--white);
    border-radius: var(--border-radius-lg);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    z-index: 1;
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.video-book-state {
    display: none;
}

/* Modal Header */
.video-book-modal .modal-header {
    padding: 28px 28px 20px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.video-book-modal .modal-header h3 {
    margin: 0;
    font-size: 26px;
    font-weight: 700;
    color: var(--text-dark);
}

.video-book-modal .modal-close {
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-medium);
    transition: all var(--transition-fast);
    font-size: 20px;
}

.video-book-modal .modal-close:hover {
    background: var(--bg-green-light);
    color: var(--primary-green);
}

/* Modal Body */
.video-book-modal .modal-body {
    padding: 32px 28px;
}

/* Confirmation State */
.video-book-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 36px;
    color: #2196F3;
}

.video-book-icon.audio-icon {
    background: linear-gradient(135deg, #ede9fe, #ddd6fe);
    color: #7c3aed;
}

.video-book-description {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-medium);
    text-align: center;
    margin: 0 0 28px 0;
}

.video-book-features {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 28px;
    padding: 20px;
    background: var(--bg-green-light);
    border-radius: var(--border-radius-md);
}

.feature-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    color: var(--text-dark);
}

.feature-item i {
    color: var(--primary-green);
    font-size: 18px;
    flex-shrink: 0;
}

/* Voice Selection Styles */
.voice-selection {
    margin-bottom: 20px;
}

.voice-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 12px;
}

.voice-label i {
    color: var(--accent-color);
}

.voice-options {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.voice-option {
    cursor: pointer;
    flex: 1;
    max-width: 160px;
}

.voice-option input[type="radio"] {
    display: none;
}

.voice-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 16px 12px;
    border: 2px solid #e0e0e0;
    border-radius: var(--border-radius-md);
    background: #f9f9f9;
    transition: all 0.2s ease;
}

.voice-option input[type="radio"]:checked + .voice-card {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.voice-icon {
    font-size: 32px;
    margin-bottom: 8px;
}

.voice-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.voice-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-dark);
}

.voice-desc {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}

.voice-option:hover .voice-card {
    border-color: #bdbdbd;
    background: #f5f5f5;
}

.voice-option input[type="radio"]:checked + .voice-card:hover {
    border-color: var(--accent-color);
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
}

.video-book-cost {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 20px;
    background: linear-gradient(135deg, #fff3e0, #ffe0b2);
    border: 2px solid #ff9800;
    border-radius: var(--border-radius-md);
    margin-bottom: 20px;
}

.cost-label {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
}

.cost-amount {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 24px;
    font-weight: 700;
    color: #ff9800;
}

.cost-amount i {
    font-size: 22px;
}

/* Regenerate Audio Modal - smaller cost display */
.regen-audio-cost {
    background: linear-gradient(135deg, #e3f2fd, #bbdefb);
    border-color: #2196f3;
}

.regen-audio-cost .cost-amount {
    color: #2196f3;
}

.btn-audio {
    background: linear-gradient(135deg, #2196f3, #1976d2);
}

.btn-audio:hover {
    background: linear-gradient(135deg, #1976d2, #1565c0);
}

.video-book-note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 16px;
    background: var(--off-white);
    border-left: 3px solid var(--primary-green);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-medium);
    margin: 0;
}

.video-book-note i {
    color: var(--primary-green);
    flex-shrink: 0;
    margin-top: 2px;
}

/* Processing State */
.video-book-spinner {
    width: 80px;
    height: 80px;
    border: 6px solid var(--border-light);
    border-top-color: var(--primary-green);
    border-right-color: var(--primary-green-light);
    border-radius: 50%;
    animation: spinModal 1s linear infinite;
    margin: 0 auto 28px;
}

.video-book-processing-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    margin: 0 0 8px 0;
}

.video-book-processing-subtext {
    font-size: 14px;
    color: var(--text-light);
    text-align: center;
    margin: 0 0 32px 0;
}

.processing-tips {
    padding: 24px;
    background: var(--bg-green-light);
    border-radius: var(--border-radius-md);
    margin-bottom: 24px;
}

.tip-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-green);
    margin: 0 0 12px 0;
}

.tip-label i {
    font-size: 16px;
}

.tip-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-dark);
    margin: 0;
    text-align: center;
    transition: opacity 0.3s ease;
}

.processing-actions {
    display: flex;
    justify-content: center;
}

/* Success State */
.video-book-success-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 40px;
    color: var(--primary-green);
}

.video-book-success-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    margin: 0 0 12px 0;
}

.video-book-success-subtext {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-medium);
    text-align: center;
    margin: 0;
}

/* Error State */
.video-book-error-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    font-size: 40px;
    color: #f44336;
}

.video-book-error-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-dark);
    text-align: center;
    margin: 0 0 12px 0;
}

.video-book-error-subtext {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-medium);
    text-align: center;
    margin: 0;
}

/* Modal Footer */
.video-book-modal .modal-footer {
    padding: 20px 28px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

.video-book-modal .btn-cancel,
.video-book-modal .btn-secondary {
    padding: 12px 24px;
    background: transparent;
    border: 2px solid var(--border-light);
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 15px;
    color: var(--text-medium);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-book-modal .btn-cancel:hover,
.video-book-modal .btn-secondary:hover {
    background: var(--bg-green-light);
    border-color: var(--primary-green-light);
    color: var(--primary-green);
}

.video-book-modal .btn-confirm {
    padding: 12px 24px;
    background: var(--primary-green);
    border: none;
    border-radius: var(--border-radius-md);
    font-weight: 600;
    font-size: 15px;
    color: var(--white);
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    gap: 8px;
}

.video-book-modal .btn-confirm:hover {
    background: var(--primary-green-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.video-book-modal .btn-confirm:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.btn-video {
    background: #2196F3;
}

.btn-video:hover {
    background: #1976D2;
}

.btn-watch {
    background: #ff9800;
}

.btn-watch:hover {
    background: #f57c00;
}

.btn-audio {
    background: #7c3aed;
}

.btn-audio:hover {
    background: #6d28d9;
}

.video-book-modal .btn-confirm i,
.video-book-modal .btn-secondary i {
    font-size: 16px;
}

/* ===================================
   RESPONSIVE - TABLET
   =================================== */
@media (max-width: 1024px) {
    .video-book-modal .modal-content {
        max-width: 520px;
    }
    
    .video-book-modal .modal-header h3 {
        font-size: 24px;
    }
    
    .video-book-icon,
    .video-book-success-icon,
    .video-book-error-icon {
        width: 70px;
        height: 70px;
        font-size: 32px;
    }
    
    .video-book-spinner {
        width: 70px;
        height: 70px;
    }
}

/* ===================================
   RESPONSIVE - MOBILE
   =================================== */
@media (max-width: 768px) {
    .video-book-modal {
        padding: 12px;
    }
    
    .video-book-modal .modal-content {
        max-width: 100%;
        max-height: 95vh;
    }
    
    .video-book-modal .modal-header {
        padding: 20px 20px 16px;
    }
    
    .video-book-modal .modal-header h3 {
        font-size: 20px;
    }
    
    .video-book-modal .modal-close {
        width: 32px;
        height: 32px;
        font-size: 18px;
    }
    
    .video-book-modal .modal-body {
        padding: 24px 20px;
    }
    
    .video-book-icon,
    .video-book-success-icon,
    .video-book-error-icon {
        width: 64px;
        height: 64px;
        font-size: 28px;
        margin-bottom: 20px;
    }
    
    .video-book-description {
        font-size: 15px;
        margin-bottom: 24px;
    }
    
    .video-book-features {
        padding: 16px;
        gap: 10px;
        margin-bottom: 24px;
    }
    
    .feature-item {
        font-size: 14px;
    }
    
    .feature-item i {
        font-size: 16px;
    }
    
    .video-book-cost {
        padding: 16px;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .cost-label {
        font-size: 15px;
    }
    
    .cost-amount {
        font-size: 20px;
    }
    
    .cost-amount i {
        font-size: 18px;
    }
    
    .video-book-note {
        padding: 14px;
        font-size: 13px;
    }
    
    .video-book-spinner {
        width: 60px;
        height: 60px;
        border-width: 5px;
        margin-bottom: 24px;
    }
    
    .video-book-processing-text {
        font-size: 16px;
    }
    
    .video-book-processing-subtext {
        font-size: 13px;
        margin-bottom: 24px;
    }
    
    .processing-tips {
        padding: 20px 16px;
        margin-bottom: 20px;
    }
    
    .tip-label {
        font-size: 13px;
        margin-bottom: 10px;
    }
    
    .tip-text {
        font-size: 14px;
    }
    
    .video-book-success-text,
    .video-book-error-text {
        font-size: 16px;
    }
    
    .video-book-success-subtext,
    .video-book-error-subtext {
        font-size: 14px;
    }
    
    .video-book-modal .modal-footer {
        padding: 16px 20px;
        flex-direction: column-reverse;
        gap: 10px;
    }
    
    .video-book-modal .btn-cancel,
    .video-book-modal .btn-secondary,
    .video-book-modal .btn-confirm {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
        font-size: 15px;
    }
}

/* ===================================
   RESPONSIVE - SMALL MOBILE
   =================================== */
@media (max-width: 480px) {
    .video-book-modal .modal-header h3 {
        font-size: 18px;
    }
    
    .video-book-icon,
    .video-book-success-icon,
    .video-book-error-icon {
        width: 56px;
        height: 56px;
        font-size: 24px;
        margin-bottom: 16px;
    }
    
    .video-book-description {
        font-size: 14px;
    }
    
    .video-book-features {
        padding: 14px;
    }
    
    .feature-item {
        font-size: 13px;
    }
    
    .video-book-cost {
        flex-direction: column;
        gap: 8px;
        padding: 14px;
    }
    
    .cost-label {
        font-size: 14px;
    }
    
    .cost-amount {
        font-size: 18px;
    }
    
    .video-book-spinner {
        width: 50px;
        height: 50px;
        border-width: 4px;
    }
    
    .video-book-processing-text {
        font-size: 15px;
    }
    
    .tip-text {
        font-size: 13px;
    }
}

/* ===================================
   STORY TEXT EDIT FEATURE
   =================================== */

/* Edit Button Container */
.page-text-section {
    position: relative;
}

/* Edit Button - Positioned top-right on desktop, bottom-right on mobile */
.page-edit-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: var(--white);
    border: 2px solid var(--primary-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-normal);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.15);
}

.page-edit-btn:hover {
    background: var(--primary-green);
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(46, 125, 50, 0.3);
}

.page-edit-btn i {
    color: var(--primary-green);
    font-size: 16px;
    transition: color var(--transition-fast);
}

.page-edit-btn:hover i {
    color: var(--white);
}

/* Edit Mode - Button shows save/cancel */
.page-edit-btn.editing {
    width: auto;
    height: auto;
    border-radius: var(--border-radius-md);
    padding: 8px;
    gap: 8px;
    background: var(--white);
    border: 2px solid var(--border-light);
}

.page-edit-btn.editing:hover {
    background: var(--white);
    transform: none;
}

/* Save Button (Green Checkmark) */
.edit-save-btn {
    width: 36px;
    height: 36px;
    background: var(--primary-green);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.edit-save-btn:hover:not(:disabled) {
    background: var(--primary-green-dark);
    transform: scale(1.1);
}

.edit-save-btn:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.edit-save-btn i {
    color: var(--white);
    font-size: 16px;
}

/* Cancel Button (Red X) */
.edit-cancel-btn {
    width: 36px;
    height: 36px;
    background: #f44336;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.edit-cancel-btn:hover {
    background: #e53935;
    transform: scale(1.1);
}

.edit-cancel-btn i {
    color: var(--white);
    font-size: 16px;
}

/* Text Editor (Textarea) */
.page-text-editor {
    width: 100%;
    min-height: 300px;
    padding: 20px;
    font-family: inherit;
    font-size: 22px;
    line-height: 1.8;
    color: var(--text-dark);
    background: var(--white);
    border: 3px solid var(--primary-green);
    border-radius: var(--border-radius-md);
    resize: vertical;
    transition: border-color var(--transition-fast);
    box-sizing: border-box;
}

.page-text-editor:focus {
    outline: none;
    border-color: var(--primary-green-dark);
    box-shadow: 0 0 0 3px rgba(46, 125, 50, 0.1);
}

/* Mobile Responsive - Edit button at bottom-right */
@media (max-width: 768px) {
    .page-edit-btn {
        top: auto;
        bottom: 16px;
        right: 16px;
        width: 48px;
        height: 48px;
    }
    
    .page-edit-btn i {
        font-size: 18px;
    }
    
    .page-edit-btn.editing {
        padding: 10px;
    }
    
    .edit-save-btn,
    .edit-cancel-btn {
        width: 40px;
        height: 40px;
    }
    
    .edit-save-btn i,
    .edit-cancel-btn i {
        font-size: 18px;
    }
    
    .page-text-editor {
        font-size: 17px;
        line-height: 1.7;
        min-height: 250px;
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .page-edit-btn {
        width: 44px;
        height: 44px;
        bottom: 12px;
        right: 12px;
    }
    
    .page-text-editor {
        font-size: 16px;
        min-height: 200px;
        padding: 14px;
    }
}

/* END STORY TEXT EDIT FEATURE */

/* ===================================
   AUDIO CTA BUTTON (Intro Screen)
   =================================== */
.audio-cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    border-radius: 30px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
    margin: 20px auto 0 auto;
}

.audio-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}

.audio-cta-btn i {
    font-size: 16px;
}

.audio-cta-credits {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}

/* ===================================
   AUDIO MODAL - CLEAN REDESIGN
   =================================== */
.audio-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.audio-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.audio-modal-container {
    position: relative;
    z-index: 10001;
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.audio-modal-state {
    display: none;
    flex-direction: column;
    max-height: 100%;
    overflow: hidden;
}

.audio-modal-state[style*="display: block"] {
    display: flex !important;
}

.audio-modal-header {
    padding: 24px 24px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.audio-modal-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    color: #1a1a1a;
}

.audio-modal-close {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    color: #666;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.audio-modal-close:hover {
    background: #e0e0e0;
    color: #333;
}

.audio-modal-body {
    padding: 8px 24px 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.audio-modal-body-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 32px 24px;
    overflow-y: auto;
}

/* Voice List - Minimal Row Design */
.voice-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: visible;
    padding: 2px;
}

/* Custom Scrollbar */
.voice-grid::-webkit-scrollbar,
.audio-modal-body::-webkit-scrollbar {
    width: 6px;
}

.voice-grid::-webkit-scrollbar-track,
.audio-modal-body::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.voice-grid::-webkit-scrollbar-thumb,
.audio-modal-body::-webkit-scrollbar-thumb {
    background: #bdbdbd;
    border-radius: 3px;
}

.voice-grid::-webkit-scrollbar-thumb:hover,
.audio-modal-body::-webkit-scrollbar-thumb:hover {
    background: #9e9e9e;
}

.voice-tile {
    position: relative;
}

.voice-tile input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.voice-tile-content {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: white;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    transition: all 0.15s ease;
    cursor: pointer;
}

.voice-tile-content:hover {
    background: #fafafa;
    border-color: #bdbdbd;
}

.voice-tile input[type="radio"]:checked + .voice-tile-content {
    background: #e8f5e9;
    border-color: #4caf50;
}

/* Voice Avatar - Smaller circle */
.voice-tile-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.voice-tile-avatar-fallback {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 18px;
    font-weight: 700;
}

/* Voice Info - Left side */
.voice-tile-info {
    flex: 1;
    min-width: 0;
}

.voice-tile-name {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.voice-tile-tag {
    font-size: 12px;
    color: #757575;
}

.voice-tile input[type="radio"]:checked + .voice-tile-content .voice-tile-tag {
    color: #2e7d32;
}

/* Play Button */
.voice-tile-play {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5;
    border: none;
    border-radius: 50%;
    color: #424242;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.voice-tile-play:hover {
    background: #4caf50;
    color: white;
    transform: scale(1.1);
}

.voice-tile-play i {
    font-size: 14px;
    margin-left: 2px;
}

.voice-tile-play.playing {
    background: #4caf50;
    color: white;
}

.voice-tile-play.playing i::before {
    content: "\f04c";
}

/* Radio Check Indicator */
.voice-tile-check {
    width: 20px;
    height: 20px;
    border: 2px solid #bdbdbd;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.voice-tile input[type="radio"]:checked ~ .voice-tile-content .voice-tile-check {
    background: #4caf50;
    border-color: #4caf50;
}

.voice-tile-check i {
    color: white;
    font-size: 10px;
    opacity: 0;
    transform: scale(0);
    transition: all 0.15s ease;
}

.voice-tile input[type="radio"]:checked ~ .voice-tile-content .voice-tile-check i {
    opacity: 1;
    transform: scale(1);
}

/* Footer */
.audio-modal-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-top: 1px solid #f0f0f0;
    background: #fafafa;
    flex-shrink: 0;
}

.audio-modal-footer-centered {
    justify-content: center;
}

.audio-modal-cost {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #424242;
}

.audio-modal-cost i {
    color: #ff9800;
    font-size: 18px;
}

.audio-modal-btn-primary {
    padding: 12px 32px;
    background: linear-gradient(135deg, #4caf50 0%, #388e3c 100%);
    color: white;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

.audio-modal-btn-primary:hover {
    background: linear-gradient(135deg, #43a047 0%, #2e7d32 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(76, 175, 80, 0.4);
}

.audio-modal-btn-primary:active {
    transform: translateY(0);
}

.audio-modal-btn-secondary {
    padding: 12px 24px;
    background: white;
    color: #757575;
    border: 2px solid #e0e0e0;
    border-radius: 10px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.audio-modal-btn-secondary:hover {
    background: #fafafa;
    border-color: #bdbdbd;
    color: #424242;
}

/* Spinner */
.audio-spinner {
    width: 56px;
    height: 56px;
    border: 5px solid #e8f5e9;
    border-top-color: #4caf50;
    border-radius: 50%;
    animation: audioSpin 0.7s linear infinite;
    margin-bottom: 24px;
}

@keyframes audioSpin {
    to { transform: rotate(360deg); }
}

/* Status Text */
.audio-status-text {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.audio-status-subtext {
    font-size: 15px;
    color: #757575;
    margin: 0;
    line-height: 1.5;
}

/* Success Icon */
.audio-success-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.audio-success-icon i {
    font-size: 32px;
    color: #4caf50;
}

/* Error Icon */
.audio-error-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #ffebee 0%, #ffcdd2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.audio-error-icon i {
    font-size: 32px;
    color: #f44336;
}

/* ===================================
   AUDIO MODAL - RESPONSIVE
   =================================== */
@media (max-width: 480px) {
    .audio-modal {
        padding: 12px;
    }

    .audio-modal-container {
        max-width: 100%;
    }

    .audio-modal-header {
        padding: 16px 20px;
    }

    .audio-modal-header h2 {
        font-size: 18px;
    }

    .audio-modal-body {
        padding: 20px;
    }

    .voice-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        max-height: 240px;
    }

    .voice-tile-content {
        padding: 14px 10px;
    }

    .voice-tile-avatar {
        width: 40px;
        height: 40px;
    }

    .voice-tile-name {
        font-size: 13px;
    }

    .voice-tile-tag {
        font-size: 10px;
    }

    .audio-modal-footer {
        padding: 14px 20px;
    }

    .audio-modal-btn-primary {
        padding: 10px 20px;
        font-size: 14px;
    }

    .audio-cta-btn {
        padding: 10px 20px;
        font-size: 14px;
    }
}

/* ===================================
   MILESTONE CELEBRATION MODAL
   =================================== */
.milestone-celebration-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: milestoneModalFadeIn 0.3s ease;
    backdrop-filter: blur(4px);
}

@keyframes milestoneModalFadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.milestone-modal-content {
    background: linear-gradient(135deg, #ffffff 0%, #f8fdf8 100%);
    border-radius: var(--border-radius-lg);
    padding: 40px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 4px var(--primary-green);
    animation: milestoneModalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}

@keyframes milestoneModalSlideIn {
    from {
        transform: scale(0.8) translateY(20px);
        opacity: 0;
    }
    to {
        transform: scale(1) translateY(0);
        opacity: 1;
    }
}

.milestone-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--primary-green), var(--primary-green-light), #ffd700, var(--primary-green-light), var(--primary-green));
    background-size: 200% 100%;
    animation: milestoneShimmer 2s linear infinite;
}

@keyframes milestoneShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.milestone-celebration-icon {
    font-size: 72px;
    margin-bottom: 16px;
    animation: milestoneBounce 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes milestoneBounce {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.milestone-modal-content h2 {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary-green-dark);
    margin: 0 0 8px 0;
}

.milestone-books-count {
    font-size: 18px;
    color: var(--text-medium);
    margin-bottom: 24px;
    font-weight: 500;
}

.milestone-books-count strong {
    color: var(--primary-green);
    font-size: 22px;
}

.milestone-rewards-list {
    background: var(--bg-green-light);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-bottom: 24px;
    text-align: left;
}

.milestone-rewards-list h3 {
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-light);
    margin: 0 0 12px 0;
    font-weight: 600;
}

.milestone-reward-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(46, 125, 50, 0.1);
}

.milestone-reward-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.milestone-reward-item:first-of-type {
    padding-top: 0;
}

.milestone-reward-icon {
    width: 36px;
    height: 36px;
    background: var(--white);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: var(--shadow-sm);
}

.milestone-reward-text {
    flex: 1;
    font-size: 15px;
    font-weight: 500;
    color: var(--text-dark);
}

.milestone-close-btn {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--primary-green-dark) 100%);
    color: var(--white);
    border: none;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    transition: all var(--transition-fast);
    box-shadow: 0 4px 15px rgba(46, 125, 50, 0.3);
}

.milestone-close-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(46, 125, 50, 0.4);
}

.milestone-close-btn:active {
    transform: translateY(0);
}

/* Confetti particles animation */
.milestone-modal-content::after {
    content: '🎊';
    position: absolute;
    top: 10px;
    right: 20px;
    font-size: 24px;
    animation: confettiFloat 2s ease-in-out infinite;
}

@keyframes confettiFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(15deg); }
}

/* Mobile responsive */
@media (max-width: 480px) {
    .milestone-modal-content {
        padding: 30px 24px;
        margin: 20px;
    }

    .milestone-celebration-icon {
        font-size: 56px;
    }

    .milestone-modal-content h2 {
        font-size: 24px;
    }

    .milestone-books-count {
        font-size: 16px;
    }

    .milestone-rewards-list {
        padding: 16px;
    }

    .milestone-reward-text {
        font-size: 14px;
    }

    .milestone-close-btn {
        padding: 12px 32px;
        font-size: 15px;
        width: 100%;
    }
}