/* Design System & Root Variables */
:root {
    --bg-dark: hsl(230, 24%, 6%);
    --bg-dark-gradient: radial-gradient(circle at 50% 50%, hsl(240, 25%, 10%) 0%, hsl(230, 24%, 4%) 100%);
    
    --card-bg: hsla(230, 25%, 10%, 0.55);
    --card-border: hsla(180, 100%, 50%, 0.12);
    --card-border-active: hsla(280, 100%, 65%, 0.45);
    
    --accent-cyan: hsl(180, 100%, 48%);
    --accent-purple: hsl(276, 100%, 60%);
    --accent-magenta: hsl(320, 100%, 60%);
    --accent-gold: hsl(45, 100%, 55%);
    --accent-gold-dark: hsl(45, 100%, 40%);
    --accent-red: hsl(0, 100%, 60%);
    --whatsapp-green: hsl(142, 70%, 45%);
    --whatsapp-green-hover: hsl(142, 75%, 38%);
    
    --text-primary: hsl(210, 25%, 98%);
    --text-secondary: hsl(215, 16%, 80%);
    --text-muted: hsl(215, 12%, 55%);
    
    --shadow-cyan: 0 0 20px hsla(180, 100%, 50%, 0.2);
    --shadow-purple: 0 0 25px hsla(276, 100%, 60%, 0.25);
    --shadow-gold: 0 0 25px hsla(45, 100%, 55%, 0.3);
    --shadow-whatsapp: 0 0 20px hsla(142, 70%, 45%, 0.3);
    --shadow-text: 0 2px 10px rgba(0, 0, 0, 0.6);
    
    --font-heading: 'Cinzel', serif;
    --font-heading-fancy: 'Cinzel Decorative', serif;
    --font-body: 'Outfit', sans-serif;
    
    --transition-smooth: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    --transition-fast: all 0.2s ease;
}

/* Global Reset & Base Styling */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    font-family: var(--font-body);
    background-color: var(--bg-dark);
    background-image: var(--bg-dark-gradient);
    color: var(--text-primary);
    overflow-x: hidden;
    scroll-behavior: smooth;
    line-height: 1.6;
}

/* Cosmic Background */
.stars-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.star {
    position: absolute;
    background-color: #fff;
    border-radius: 50%;
    animation: twinkle var(--duration, 4s) infinite ease-in-out;
    opacity: var(--opacity, 0.7);
}

@keyframes twinkle {
    0%, 100% { opacity: 0.2; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

.cosmic-glow {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 80vmax;
    height: 80vmax;
    background: radial-gradient(circle, hsla(276, 100%, 60%, 0.04) 0%, hsla(180, 100%, 50%, 0.02) 45%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

/* Layout Framework */
body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    z-index: 1;
}

/* Header & Logo styling */
.app-header {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.5rem 2rem;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    text-decoration: none;
    cursor: pointer;
}

.floating-logo {
    width: 50px;
    height: 50px;
    object-fit: contain;
    filter: drop-shadow(0 0 8px hsla(180, 100%, 50%, 0.3));
    animation: floatLogo 6s infinite ease-in-out;
}

.logo-text {
    display: flex;
    flex-direction: column;
}

.logo-subtitle {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.3em;
    color: var(--accent-cyan);
    text-shadow: 0 0 10px hsla(180, 100%, 50%, 0.3);
    text-transform: uppercase;
}

.logo-title {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: var(--shadow-text);
}

.nav-links {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.nav-btn {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: var(--transition-fast);
    padding: 0.5rem 1rem;
    border-radius: 8px;
}

.nav-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Page Containers & Router Transitions */
.page {
    display: none;
    opacity: 0;
    transform: translateY(15px);
    transition: opacity 0.5s cubic-bezier(0.16, 1, 0.3, 1), transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem 4rem 2rem;
    z-index: 2;
}

.page.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

/* Glassmorphism Panel */
.glass-panel {
    background: var(--card-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    transition: var(--transition-smooth);
}

/* Page 1: Homepage Styles */
.hero-section {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 3rem;
    align-items: center;
    padding: 3rem 0;
    margin-bottom: 4rem;
}

.hero-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    background: hsla(276, 100%, 60%, 0.1);
    border: 1px solid hsla(276, 100%, 60%, 0.3);
    color: var(--accent-purple);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
}

.badge-pulse {
    width: 8px;
    height: 8px;
    background: var(--accent-cyan);
    border-radius: 50%;
    box-shadow: 0 0 8px var(--accent-cyan);
    animation: pulseGlow 2s infinite ease-in-out;
}

.hero-title {
    font-family: var(--font-heading-fancy);
    font-size: 3.25rem;
    line-height: 1.15;
    font-weight: 700;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 30%, var(--accent-cyan) 75%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.01em;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 2.5rem;
    font-weight: 300;
    line-height: 1.7;
    max-width: 600px;
}

.hero-visual {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.hero-image-wrapper {
    position: relative;
    border-radius: 24px;
    padding: 8px;
    background: linear-gradient(135deg, var(--card-border) 0%, var(--card-border-active) 100%);
    box-shadow: var(--shadow-purple);
    animation: floatBook 6s infinite ease-in-out;
}

.hero-image {
    width: 100%;
    max-width: 420px;
    border-radius: 18px;
    display: block;
    object-fit: cover;
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
}

.hero-image-glow {
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    background: radial-gradient(circle, hsla(180, 100%, 50%, 0.15) 0%, transparent 60%);
    z-index: -1;
    pointer-events: none;
}

/* Features Section */
.features-section {
    padding: 2rem 0;
    margin-bottom: 4rem;
}

.section-header {
    text-align: center;
    margin-bottom: 3.5rem;
}

.section-title {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    background: linear-gradient(135deg, #fff 60%, var(--accent-purple) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.section-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 300;
    max-width: 500px;
    margin: 0 auto;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.feature-card {
    padding: 2.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.feature-card:hover {
    border-color: var(--card-border-active);
    transform: translateY(-5px);
    box-shadow: 0 15px 35px rgba(0,0,0,0.4), 0 0 25px hsla(276, 100%, 60%, 0.1);
}

.feature-icon-box {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.5rem;
}

.feature-icon-box.cyan {
    background: hsla(180, 100%, 50%, 0.1);
    color: var(--accent-cyan);
    border: 1px solid hsla(180, 100%, 50%, 0.2);
}

.feature-icon-box.purple {
    background: hsla(276, 100%, 60%, 0.1);
    color: var(--accent-purple);
    border: 1px solid hsla(276, 100%, 60%, 0.2);
}

.feature-icon-box.magenta {
    background: hsla(320, 100%, 60%, 0.1);
    color: var(--accent-magenta);
    border: 1px solid hsla(320, 100%, 60%, 0.2);
}

.feature-icon-box.gold {
    background: hsla(45, 100%, 55%, 0.1);
    color: var(--accent-gold);
    border: 1px solid hsla(45, 100%, 55%, 0.2);
}

.feature-title {
    font-family: var(--font-heading);
    font-size: 1.35rem;
    font-weight: 700;
}

.feature-desc {
    color: var(--text-secondary);
    font-size: 0.98rem;
    line-height: 1.6;
    font-weight: 300;
}

/* Call to Action Banner */
.cta-banner {
    padding: 4rem 3rem;
    text-align: center;
    border-radius: 28px;
    position: relative;
    overflow: hidden;
    margin-bottom: 2rem;
    border: 1px solid hsla(45, 100%, 55%, 0.2);
}

.cta-banner::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, hsla(45, 100%, 55%, 0.08) 0%, transparent 70%);
    z-index: 0;
    pointer-events: none;
}

.cta-banner-content {
    position: relative;
    z-index: 2;
    max-width: 650px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.cta-banner-title {
    font-family: var(--font-heading);
    font-size: 2.25rem;
    font-weight: 700;
    margin-bottom: 1rem;
    background: linear-gradient(135deg, #fff 40%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cta-banner-desc {
    color: var(--text-secondary);
    font-size: 1.1rem;
    margin-bottom: 2.5rem;
    font-weight: 300;
}

/* Page 2: Sample Request Page (Form) */
.page-sample {
    max-width: 800px;
}

.sample-header {
    text-align: center;
    margin-bottom: 3rem;
    padding-top: 1rem;
}

.sample-title {
    font-family: var(--font-heading);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.8rem;
    background: linear-gradient(135deg, #fff 50%, var(--accent-cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sample-subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    font-weight: 300;
}

.form-container {
    padding: 3rem;
    border-radius: 28px;
}

.form-group {
    margin-bottom: 2.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.form-label {
    font-weight: 600;
    font-size: 1.05rem;
    color: var(--text-primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-label-hint {
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--text-muted);
}

.form-helper {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 0.2rem;
}

/* Custom inputs styling */
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.95rem 1.2rem;
    border-radius: 12px;
    border: 1px solid var(--card-border);
    background: hsla(230, 25%, 6%, 0.5);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.98rem;
    transition: var(--transition-fast);
    outline: none;
}

.form-textarea {
    resize: vertical;
    min-height: 110px;
}

.form-input:focus, .form-textarea:focus, .form-select:focus {
    border-color: var(--accent-cyan);
    box-shadow: 0 0 15px hsla(180, 100%, 50%, 0.15), inset 0 1px 1px rgba(255, 255, 255, 0.05);
    background: hsla(230, 25%, 8%, 0.7);
}

.form-input::placeholder, .form-textarea::placeholder {
    color: rgba(255, 255, 255, 0.35);
}

.form-input.error, .form-textarea.error, .form-select.error {
    border-color: var(--accent-red);
    box-shadow: 0 0 15px hsla(0, 100%, 60%, 0.15);
}

/* Dynamic Characters Section */
.characters-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.08);
    padding-bottom: 0.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.character-count-badge {
    font-size: 0.8rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.character-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
    margin-bottom: 1.5rem;
}

.character-row {
    display: grid;
    grid-template-columns: 1.2fr 1.2fr 0.8fr auto;
    gap: 1rem;
    align-items: flex-end;
    padding: 1.2rem;
    border-radius: 16px;
    background: hsla(230, 25%, 15%, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.04);
    animation: characterEnter 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    position: relative;
}

@keyframes characterEnter {
    0% { opacity: 0; transform: scale(0.9) translateY(10px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

.character-field {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.character-field label {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Dropdown select custom style styling for options */
.form-select option {
    background-color: var(--bg-dark);
    color: var(--text-primary);
}

/* Remove Character Button */
.btn-remove {
    background: rgba(255, 50, 50, 0.1);
    border: 1px solid rgba(255, 50, 50, 0.2);
    color: var(--accent-red);
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition-fast);
    padding: 0;
}

.btn-remove:hover {
    background: var(--accent-red);
    color: white;
    box-shadow: 0 0 10px hsla(0, 100%, 60%, 0.3);
}

/* Stylized Add Character Button */
.btn-add-character {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.8rem 1.5rem;
    border-radius: 12px;
    border: 1px dashed var(--accent-cyan);
    background: hsla(180, 100%, 50%, 0.03);
    color: var(--accent-cyan);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    width: auto;
    align-self: flex-start;
}

.btn-add-character:hover {
    background: hsla(180, 100%, 50%, 0.08);
    border-style: solid;
    transform: translateY(-1px);
    box-shadow: var(--shadow-cyan);
}

.btn-add-character:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    border-color: var(--text-muted);
    color: var(--text-muted);
    background: transparent;
    box-shadow: none;
    transform: none;
}

/* General button layouts */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.8rem;
    padding: 1.1rem 2.2rem;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    position: relative;
    overflow: hidden;
    text-decoration: none;
}

.btn span {
    z-index: 2;
}

.btn-icon {
    width: 20px;
    height: 20px;
    z-index: 2;
    transition: var(--transition-smooth);
}

/* Primary buttons with gold cosmic gradient */
.btn-primary {
    background: linear-gradient(135deg, var(--accent-gold) 0%, var(--accent-gold-dark) 100%);
    border: none;
    color: hsl(230, 24%, 6%);
    box-shadow: var(--shadow-gold);
}

.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--accent-cyan) 0%, var(--accent-purple) 100%);
    opacity: 0;
    z-index: 1;
    transition: var(--transition-smooth);
}

.btn-primary:hover::before {
    opacity: 1;
}

.btn-primary:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: var(--shadow-purple);
}

.btn-primary:hover .btn-icon {
    transform: translateX(4px);
}

/* WhatsApp branded Submit Button */
.btn-whatsapp-submit {
    background: linear-gradient(135deg, var(--whatsapp-green) 0%, var(--whatsapp-green-hover) 100%);
    border: none;
    color: #fff;
    width: 100%;
    font-size: 1.15rem;
    padding: 1.2rem;
    border-radius: 14px;
    box-shadow: var(--shadow-whatsapp);
    margin-top: 1rem;
}

.btn-whatsapp-submit::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, hsl(142, 80%, 52%) 0%, hsl(142, 85%, 43%) 100%);
    opacity: 0;
    z-index: 1;
    transition: var(--transition-smooth);
}

.btn-whatsapp-submit:hover::before {
    opacity: 1;
}

.btn-whatsapp-submit:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px hsla(142, 70%, 45%, 0.45);
}

.btn-whatsapp-submit:active {
    transform: translateY(-1px);
}

.btn-whatsapp-submit .btn-icon {
    fill: currentColor;
    width: 24px;
    height: 24px;
}

/* Footer Styling */
.app-footer {
    width: 100%;
    max-width: 1200px;
    margin: auto auto 0 auto;
    padding: 3rem 2rem;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    color: var(--text-muted);
    z-index: 10;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    opacity: 0.7;
}

.footer-logo-img {
    width: 32px;
    height: 32px;
}

.footer-logo-text {
    font-family: var(--font-heading);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.glowing-text {
    color: var(--accent-cyan);
    text-shadow: 0 0 5px hsla(180, 100%, 50%, 0.3);
}

/* Animations */
@keyframes floatLogo {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-5px) rotate(2deg); }
}

@keyframes floatBook {
    0%, 100% { transform: translateY(0) scale(1) rotate(0deg); }
    50% { transform: translateY(-10px) scale(1.01) rotate(-1.5deg); }
}

@keyframes pulseGlow {
    0%, 100% { transform: scale(1); opacity: 0.6; box-shadow: 0 0 8px var(--accent-cyan); }
    50% { transform: scale(1.2); opacity: 1; box-shadow: 0 0 15px var(--accent-cyan); }
}

/* Responsiveness Settings */
@media (max-width: 992px) {
    .hero-section {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
        padding: 2rem 0;
    }
    
    .hero-content {
        align-items: center;
    }
    
    .hero-title {
        font-size: 2.75rem;
    }
    
    .hero-visual {
        order: -1;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

@media (max-width: 768px) {
    .app-header {
        padding: 1.5rem 1rem;
    }
    
    .page {
        padding: 1rem 1rem 3rem 1rem;
    }
    
    .hero-title {
        font-size: 2.25rem;
    }
    
    .hero-subtitle {
        font-size: 1.1rem;
    }
    
    .form-container {
        padding: 2rem 1.5rem;
    }
    
    .character-row {
        grid-template-columns: 1fr;
        gap: 0.8rem;
    }
    
    .btn-remove {
        width: 100%;
        margin-top: 0.5rem;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
}
