/* SHORT STORY MAGIC v45.0 – STYLE (PAYMENT TWEAKED) */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&family=Nunito:wght@400;600;700&family=Comic+Neue:wght@700&display=swap');

:root {
    --purple: #8B5CF6;
    --purple-dark: #7C3AED;
    --pink: #F472B6;
    --yellow: #FBBF24;
    --green: #10B981;
    --red: #EF4444;
    --text: #1F2937;
    --text-light: #6B7280;
    --radius: 16px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: 'Nunito', sans-serif;
    background: linear-gradient(135deg, #FEF3C7, #FCE7F3, #DDD6FE);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    margin: 0;
    padding-bottom: 60px;
}

.hidden { display: none !important; }
.app-container { min-height: 100vh; display: flex; flex-direction: column; }

/* --- NAVBAR --- */
.navbar {
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.logo {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.logo-icon {
    font-size: 1.6rem;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
}

.logo span span {
    background: linear-gradient(135deg, var(--purple), var(--pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.nav-links { display: flex; gap: 10px; }

.nav-links button {
    padding: 8px 16px;
    border: none;
    border-radius: 50px;
    background: transparent;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    color: var(--text);
}

.nav-links button:hover {
    background: rgba(139,92,246,0.1);
    color: var(--purple);
}

.btn-premium {
    background: linear-gradient(135deg, var(--yellow), #F97316) !important;
    color: white !important;
    box-shadow: 0 4px 10px rgba(249, 115, 22, 0.3);
}

.btn-menu {
    display: none;
    font-size: 1.2rem;
    background: none;
    border: none;
    cursor: pointer;
}

/* --- HOME / CREATOR --- */
.creator {
    flex: 1;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    text-align: center;
}

.hero h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.5rem;
    margin-bottom: 10px;
    color: #1F2937;
}

.hero p {
    color: var(--text-light);
    font-size: 1.2rem;
}

.input-wrapper {
    display: flex;
    align-items: center;
    background: white;
    border-radius: 50px;
    padding: 8px;
    box-shadow: 0 8px 30px rgba(139,92,246,0.15);
    margin: 30px auto;
    max-width: 600px;
    border: 2px solid transparent;
    transition: 0.3s;
}

.input-wrapper:focus-within {
    border-color: var(--purple);
    transform: scale(1.02);
}

.input-icon {
    padding-left: 15px;
    font-size: 1.5rem;
}

.input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    padding: 15px;
    font-size: 1.1rem;
    font-family: 'Nunito', sans-serif;
}

.btn-create {
    padding: 15px 30px;
    border: none;
    border-radius: 50px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: white;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-create:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.4);
}

.idea-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin: 15px 0;
}

.idea-buttons button {
    padding: 10px 20px;
    border: 2px solid #E5E7EB;
    border-radius: 50px;
    background: white;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    color: var(--text-light);
    cursor: pointer;
    transition: 0.2s;
}

.idea-buttons button:hover {
    border-color: var(--purple);
    color: var(--purple);
    background: #F3E8FF;
    transform: translateY(-2px);
}

.btn-refresh {
    margin-top: 15px;
    padding: 12px 25px;
    border: 2px solid var(--purple);
    border-radius: 50px;
    background: white;
    color: var(--purple);
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.btn-refresh:hover {
    background: var(--purple);
    color: white;
}

.features-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin-top: 50px;
}

.feature-box {
    background: white;
    padding: 20px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.05);
    transition: 0.2s;
}

.feature-box:hover { transform: translateY(-5px); }

.feature-box span {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.feature-box strong {
    display: block;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    margin-bottom: 5px;
}

/* LOADING */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.loading-spinner {
    width: 70px;
    height: 70px;
    border: 6px solid #f3f3f3;
    border-top: 6px solid var(--purple);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#loadingText {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    color: var(--purple);
    margin-top: 25px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* --- STORY DISPLAY --- */
.story-section {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.story-controls {
    position: sticky;
    top: 70px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(10px);
    padding: 15px;
    border-radius: 20px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    z-index: 900;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 30px;
    border: 1px solid rgba(255,255,255,0.5);
}

.btn-control {
    padding: 12px 24px;
    border: none;
    border-radius: 50px;
    background: #F3F4F6;
    color: var(--text);
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: 0.2s;
}

.btn-control:hover { transform: translateY(-2px); }

.btn-control.primary {
    background: var(--purple);
    color: white;
    box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3);
}

/* STORYBOOK FRAME */
.story-book {
    background: white;
    border-radius: 24px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(139, 92, 246, 0.15);
    border: 8px solid #F3E8FF;
    margin-bottom: 40px;
}

.book-header {
    background: linear-gradient(135deg, #8B5CF6, #F472B6);
    padding: 60px 20px;
    text-align: center;
    color: white;
}

.book-header h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.5rem;
    margin: 10px 0 0;
    text-shadow: 0 2px 10px rgba(0,0,0,0.2);
}

.story-pages {
    padding: 40px 30px;
    background: #FFFAFA;
}

.story-page {
    margin-bottom: 60px;
    padding: 30px;
    background: white;
    border: 4px solid #E0F2FE;
    border-radius: 30px;
    box-shadow: 12px 12px 0 #BAE6FD;
}

.story-page:last-child { margin-bottom: 0; }

.chapter-heading h3 {
    font-family: 'Comic Neue', cursive;
    font-size: 2rem;
    color: var(--purple);
    margin-bottom: 20px;
    text-align: center;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Story image */
.chapter-image {
    position: relative;
    width: 100%;
    aspect-ratio: 4/3;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 25px;
    background: #F3E8FF;
    box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

.chapter-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.spinner-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(243, 232, 255, 0.8);
    font-size: 2.5rem;
    color: var(--purple);
    z-index: 10;
}

.watermark {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(255,255,255,0.9);
    padding: 6px 12px;
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--purple);
    z-index: 20;
}

.chapter-text {
    font-size: 1.25rem;
    line-height: 1.9;
    color: #374151;
    text-align: justify;
    text-justify: inter-word;
    padding: 20px;
    background: #FFFBEB;
    border: 2px dashed #FCD34D;
    border-radius: 20px;
    position: relative;
}

.chapter-text::first-letter {
    float: left;
    font-family: 'Fredoka', sans-serif;
    font-size: 4rem;
    line-height: 0.8;
    font-weight: 700;
    color: var(--purple);
    padding-right: 12px;
    margin-top: 6px;
}

/* EXTRAS UNDER STORY */
.book-footer {
    background: #FFF7ED;
    padding: 40px 20px;
    text-align: center;
    border-top: 2px dashed #FED7AA;
}

.book-footer h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    color: #F97316;
    margin-bottom: 10px;
}

.book-footer p {
    font-size: 1.2rem;
    color: #4B5563;
    font-style: italic;
}

.interactive-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 40px;
}

.interactive-card {
    background: white;
    padding: 25px;
    border-radius: 24px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
    border: 1px solid #F3F4F6;
}

.interactive-card h2 {
    font-family: 'Fredoka', sans-serif;
    color: var(--text);
    font-size: 1.4rem;
    margin-bottom: 5px;
}

.interactive-card > p {
    color: var(--text-light);
    font-size: 0.95rem;
    margin-bottom: 20px;
}

/* Flashcards & Quiz */
.flashcards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
}

.word-card {
    background: #DCFCE7;
    border: 2px solid #86EFAC;
    padding: 15px 10px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
    box-shadow: 0 4px 0 #86EFAC;
}

.word-card:hover { transform: translateY(-4px); }

.word-card strong {
    display: block;
    color: #15803D;
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    margin-bottom: 5px;
}

.quiz-block {
    background: #F9FAFB;
    padding: 20px;
    border-radius: 16px;
    border: 2px solid #E5E7EB;
}

.quiz-answers button {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    border: 2px solid #E5E7EB;
    background: white;
    border-radius: 12px;
    font-family: 'Nunito', sans-serif;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: 0.2s;
    text-align: left;
}

.quiz-answers button.correct {
    background: #D1FAE5;
    border-color: #22C55E;
    color: #15803D;
}

.quiz-answers button.wrong {
    background: #FEE2E2;
    border-color: #EF4444;
    color: #991B1B;
}

.share-bar {
    background: white;
    padding: 30px;
    border-radius: 24px;
    text-align: center;
    box-shadow: 0 8px 30px rgba(0,0,0,0.08);
}

.share-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 15px;
}

.share-buttons button {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: none;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- MODALS --- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.modal:not(.hidden) {
    opacity: 1;
    pointer-events: auto;
}

.modal-bg {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(5px);
}

.modal-box {
    position: relative;
    background: white;
    width: 95%;
    max-width: 500px;
    border-radius: 24px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    overflow: hidden;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

/* large modals (payment, library) – allow scroll */
.modal-box.large-modal {
    max-width: 800px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* HEADER */
.modal-header {
    background: linear-gradient(135deg, #8B5CF6, #F472B6);
    padding: 20px 25px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-header h2 {
    margin: 0;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    color: white;
}

/* CLOSE BUTTON */
.modal-close {
    background: rgba(255,255,255,0.25) !important;
    border: none !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    border-radius: 50% !important;
    color: white !important;
    font-size: 1.2rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer;
    margin: 0 !important;
    padding: 0 !important;
}

.modal-close:hover {
    background: rgba(255,255,255,0.4) !important;
}

/* CONTENT (login/contact etc.) */
.modal-content {
    padding: 30px;
    overflow-y: auto;
    flex: 1;
}

.modal-box form {
    display: flex;
    flex-direction: column;
    gap: 15px;
    width: 100%;
}

.modal-box input,
.modal-box textarea {
    padding: 15px;
    border: 2px solid #E5E7EB;
    border-radius: 12px;
    font-family: inherit;
    font-size: 1rem;
    width: 100%;
    transition: 0.2s;
    box-sizing: border-box;
}

.modal-box input:focus,
.modal-box textarea:focus {
    border-color: var(--purple);
    outline: none;
}

.modal-box button {
    padding: 15px;
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    width: 100%;
}

.modal-text p {
    margin-bottom: 15px;
    line-height: 1.6;
    color: #4B5563;
}

/* --- PAYMENT SPECIFIC --- */
.premium-banner {
    background: linear-gradient(135deg, #8B5CF6, #F472B6);
    padding: 40px 30px 30px;
    text-align: center;
    color: white;
}

.premium-banner h2 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.8rem;
    margin-bottom: 5px;
}

.premium-banner p {
    margin-top: 4px;
    font-size: 1rem;
    opacity: 0.95;
}

.crown-icon {
    display: block;
    font-size: 2.8rem;
    margin-bottom: 8px;
    animation: float 3s ease-in-out infinite;
}

/* currency pill row */
.currency-buttons {
    margin-top: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
}

.c-btn {
    border-radius: 999px;
    border: 2px solid rgba(255,255,255,0.7);
    background: transparent;
    padding: 8px 18px;
    font-family: 'Fredoka', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    color: #FFFFFF;
    flex: 0 0 auto;
    width: auto;
    cursor: pointer;
    transition: 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.c-btn:hover {
    background: rgba(255,255,255,0.25);
}

.c-btn.active {
    background: #FFFFFF;
    border-color: #FFFFFF;
    color: #8B5CF6;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
}

/* pricing cards */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    padding: 25px;
    background: #F9FAFB;
}

.price-card {
    border: 2px solid #E5E7EB;
    border-radius: 16px;
    padding: 20px;
    text-align: center;
    position: relative;
    background: #FFFFFF;
}

.price-card.featured {
    border-color: #8B5CF6;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.15);
    transform: scale(1.02);
}

.card-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--purple);
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
}

.card-badge.best {
    background: #F97316;
}

.card-price {
    margin: 10px 0 5px;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    color: var(--purple);
}

.card-price span {
    font-size: 2.1rem;
    font-weight: 700;
}

.price-card ul {
    list-style: none;
    margin-top: 10px;
    margin-bottom: 10px;
    padding: 0;
}

.price-card ul li {
    font-size: 0.95rem;
    color: var(--text-light);
    margin: 4px 0;
}

.price-card button {
    width: 100%;
    padding: 12px;
    border-radius: 10px;
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    border: none;
    background: #F3F4F6;
    color: #8B5CF6;
    font-family: 'Fredoka', sans-serif;
}

.price-card button.primary {
    background: linear-gradient(135deg, var(--purple), var(--purple-dark));
    color: #FFF;
}

.price-card.featured button {
    background: #8B5CF6;
    color: white;
}

.secure-text {
    text-align: center;
    padding: 0 25px 25px;
    font-size: 0.9rem;
    color: var(--text-light);
}

/* --- LIBRARY --- */
.library-tools {
    padding: 20px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    gap: 10px;
}

.library-list {
    padding: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.library-item {
    background: #F3F4F6;
    padding: 20px;
    border-radius: 16px;
    text-align: center;
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}

.library-item:hover {
    background: #F3E8FF;
    border-color: var(--purple);
}

/* --- FOOTER --- */
.site-footer {
    background: #111827;
    color: white;
    padding: 40px 20px 80px;
    text-align: center;
    margin-top: auto;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #E5E7EB !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
    transition: 0.2s;
}

.footer-links a:hover {
    color: #FBBF24 !important;
    text-decoration: underline;
}

.stats-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(17, 24, 39, 0.95);
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 0.85rem;
    z-index: 2000;
    border-top: 2px solid var(--purple);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    gap: 20px;
}

/* --- RESPONSIVE --- */
@media (max-width: 768px) {
    .nav-links { display: none; }
    .btn-menu { display: block; }
    .features-row,
    .interactive-row,
    .pricing-grid { grid-template-columns: 1fr; }
    .stats-bar {
        flex-direction: column;
        gap: 2px;
        padding: 5px;
    }
}

/* --- FIX 1: MOBILE NAV MENU STYLES --- */
.mobile-nav {
    background: white;
    border-radius: 0 0 20px 20px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
    padding: 20px;
    margin-top: 5px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    z-index: 9999;
}

.mobile-nav button {
    background: #F3F4F6;
    padding: 14px;
    border-radius: 12px;
    border: none;
    font-family: 'Fredoka', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    cursor: pointer;
    transition: 0.2s;
}

.mobile-nav button:hover {
    background: #EDE9FE;
    color: var(--purple);
}

/* --- FIX 2: INPUT-WRAPPER BUTTON OVERFLOW ON MOBILE --- */
@media (max-width: 480px) {
    .input-wrapper {
        flex-direction: column;
        padding: 12px;
        gap: 12px;
        border-radius: 20px;
    }

    .input-wrapper input {
        width: 100%;
        padding: 14px;
        font-size: 1rem;
    }

    .btn-create {
        width: 100%;
        justify-content: center;
        padding: 14px;
        font-size: 1rem;
    }
}
/* --- FOOTER LINK FIX (StarBizTech) --- */
.site-footer a {
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600;
}

.site-footer a:hover {
    color: #d8b4fe !important; /* soft lavender hover */
    text-decoration: underline;
}

.site-footer small {
    color: #ffffff !important;
}

