/* =====================================================
   SOLAIRAÉ INDEX - Complete External CSS
   Cosmic theme with auth integration + MOBILE FIXES
   ===================================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --lavender: #7B68EE;
    --gold: #E8C17C;
    --ivory: #FAF9F7;
    --graphite: #2C2738;
    --rose: #CDB4DB;
    --deep-purple: #1b0937;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: var(--graphite);
    color: var(--ivory);
    overflow-x: hidden;
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, .serif {
    font-family: 'Cinzel', serif;
}

/* ============ AUTH BAR ============ */
.auth-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(18, 15, 30, 0.95);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(232, 193, 124, 0.15);
    z-index: 999;
    display: flex;
    align-items: center;
    padding: 0 2rem;
}

.auth-container-bar {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-left .brand-text {
    font-size: 1.5rem;
    color: var(--gold);
    letter-spacing: 0.1em;
}

.auth-right {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.user-name {
    color: var(--ivory);
    margin-right: 0.5rem;
    opacity: 0.9;
}

.auth-btn {
    padding: 0.5rem 1.2rem;
    background: transparent;
    border: 1px solid rgba(232, 193, 124, 0.3);
    color: var(--gold);
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.auth-btn:hover {
    background: rgba(232, 193, 124, 0.1);
    border-color: var(--gold);
    transform: translateY(-2px);
}

.auth-btn.signup {
    background: linear-gradient(135deg, var(--lavender), var(--gold));
    color: var(--ivory);
    border: none;
}

/* ============ AUTH MODAL ============ */
.auth-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 18, 0.95);
    backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
    padding: 1rem;
}

.auth-modal-content {
    background: linear-gradient(135deg, rgba(250, 249, 247, 0.08) 0%, rgba(123, 104, 238, 0.04) 100%);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(232, 193, 124, 0.25);
    border-radius: 30px;
    padding: 3rem;
    max-width: 400px;
    width: 90%;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: transparent;
    border: none;
    color: var(--gold);
    font-size: 1.5rem;
    cursor: pointer;
    transition: transform 0.3s ease;
}

.modal-close:hover {
    transform: rotate(90deg);
}

.auth-form-modal h3 {
    color: var(--gold);
    text-align: center;
    margin-bottom: 0.5rem;
    font-size: 1.8rem;
}

.modal-subtitle {
    text-align: center;
    color: rgba(250, 249, 247, 0.7);
    margin-bottom: 2rem;
}

.auth-form-modal .form-group {
    margin-bottom: 1.2rem;
}

.auth-form-modal input {
    width: 100%;
    padding: 1rem;
    background: rgba(250, 249, 247, 0.06);
    border: 1px solid rgba(232, 193, 124, 0.25);
    border-radius: 12px;
    color: var(--ivory);
    font-size: 1rem;
}

.auth-form-modal input:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(250, 249, 247, 0.1);
}

.checkbox-label {
    display: flex;
    align-items: center;
    color: rgba(250, 249, 247, 0.8);
    font-size: 0.9rem;
}

.checkbox-label input {
    width: auto;
    margin-right: 0.5rem;
}

.btn-modal-submit {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--lavender), var(--gold));
    color: var(--ivory);
    border: none;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-modal-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(123, 104, 238, 0.4);
}

.auth-switch {
    text-align: center;
    margin-top: 1.5rem;
    color: rgba(250, 249, 247, 0.7);
    font-size: 0.9rem;
}

.auth-link {
    color: var(--gold);
    text-decoration: none;
    transition: color 0.3s ease;
}

.auth-link:hover {
    color: var(--lavender);
}

/* ============ TOAST NOTIFICATION ============ */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: linear-gradient(135deg, rgba(44, 39, 56, 0.98) 0%, rgba(27, 9, 55, 0.95) 100%);
    color: var(--ivory);
    padding: 1rem 1.5rem;
    border-radius: 12px;
    border: 1px solid rgba(232, 193, 124, 0.3);
    transform: translateX(400px);
    transition: transform 0.4s ease;
    z-index: 3000;
    max-width: 350px;
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    border-color: #4CAF50;
}

.toast.error {
    border-color: #FF6B6B;
}

/* ============ DOOR ENTRANCE ============ */
.door-container {
    position: fixed;
    width: 100vw;
    height: 100vh;
    z-index: 998;
    background: radial-gradient(ellipse at top, #2d2545 0%, #1a1625 50%, #0f0d15 100%);
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    perspective: 1200px;
}

.door-container.hidden {
    opacity: 0;
    pointer-events: none;
}

.aurora-layer {
    position: absolute;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, 
        rgba(64, 224, 208, 0.35) 0%, 
        rgba(106, 90, 205, 0.35) 30%, 
        rgba(255, 105, 180, 0.3) 60%, 
        rgba(232, 193, 124, 0.3) 100%);
    filter: blur(60px);
    animation: auroraWave 18s ease-in-out infinite;
    z-index: 0;
}

@keyframes auroraWave {
    0% { transform: translateY(80px) skew(0deg) rotate(0deg) scale(1); opacity: 0.3; }
    50% { transform: translateY(-80px) skew(10deg) rotate(5deg) scale(1.05); opacity: 0.4; }
    100% { transform: translateY(80px) skew(0deg) rotate(0deg) scale(1); opacity: 0.3; }
}

.door {
    position: absolute;
    width: 50%;
    height: 100%;
    transition: transform 2.8s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: 3;
    background: linear-gradient(135deg, 
        rgba(18, 15, 30, 0.98) 0%,
        rgba(28, 23, 45, 0.95) 50%,
        rgba(18, 15, 30, 0.98) 100%);
    box-shadow: inset 0 0 120px rgba(232, 193, 124, 0.1);
}

.door-left {
    left: 0;
    transform-origin: left;
}

.door-right {
    right: 0;
    transform-origin: right;
}

.door-container.open .door-left {
    transform: rotateY(-110deg);
}

.door-container.open .door-right {
    transform: rotateY(110deg);
}

.center-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 450px;
    height: 450px;
    pointer-events: none;
    background: radial-gradient(circle, 
        rgba(232, 193, 124, 0.2) 0%, 
        rgba(123, 104, 238, 0.15) 30%,
        transparent 60%);
    border-radius: 50%;
    animation: celestialPulse 6s ease-in-out infinite;
    filter: blur(70px);
    z-index: 4;
}

@keyframes celestialPulse {
    0%, 100% { transform: translate(-50%, -50%) scale(1); opacity: 0.3; }
    50% { transform: translate(-50%, -50%) scale(1.2); opacity: 0.6; }
}

.logo-entrance {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    z-index: 5;
    cursor: pointer;
}

.logo-text {
    font-size: clamp(4.5rem, 13vw, 9rem);
    font-weight: 400;
    letter-spacing: 0.2em;
    background: linear-gradient(135deg, 
        #E8C17C 0%,
        #FFD700 25%,
        #FFFBF0 50%,
        #FFD700 75%,
        #E8C17C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-size: 200% auto;
    animation: celestialShimmer 5s ease-in-out infinite;
    filter: drop-shadow(0 0 25px rgba(232, 193, 124, 0.5));
}

@keyframes celestialShimmer {
    0%, 100% { background-position: 0% center; transform: scale(1); }
    50% { background-position: 100% center; transform: scale(1.05); }
}

.tagline {
    font-size: 1rem;
    letter-spacing: 0.5em;
    color: rgba(232, 193, 124, 0.9);
    margin-top: 2.5rem;
    text-transform: uppercase;
}

/* ============ MAIN CONTENT ============ */
.main-content {
    opacity: 0;
    transition: opacity 1.8s ease;
    min-height: 100vh;
    padding-top: 60px;
}

.main-content.visible {
    opacity: 1;
}

/* ============ STORY SECTION ============ */
.story-section {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5rem 2rem;
    background: radial-gradient(ellipse at bottom, rgba(123, 104, 238, 0.1) 0%, transparent 60%);
}

.story-content {
    max-width: 900px;
    text-align: center;
}

.story-title {
    font-size: clamp(2.5rem, 6vw, 4rem);
    margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--lavender), var(--gold));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
}

.story-subtitle {
    font-size: 1.3rem;
    color: rgba(250, 249, 247, 0.7);
    margin-bottom: 3rem;
    font-style: italic;
}

.story-text {
    font-size: 1.2rem;
    line-height: 1.9;
    color: rgba(250, 249, 247, 0.85);
    margin-bottom: 1.8rem;
}

.story-highlight {
    color: var(--gold);
    font-weight: 500;
}

.cta-button {
    margin-top: 2.5rem;
    padding: 22px 55px;
    background: linear-gradient(135deg, var(--lavender), var(--rose));
    color: var(--ivory);
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    cursor: pointer;
    box-shadow: 0 12px 50px rgba(123, 104, 238, 0.35);
    transition: all 0.4s ease;
    letter-spacing: 0.1em;
    font-weight: 500;
    text-transform: uppercase;
}

.cta-button:hover {
    transform: translateY(-4px);
    box-shadow: 0 18px 60px rgba(123, 104, 238, 0.45);
}

/* ============ FORM SECTION ============ */
.form-section {
    min-height: 100vh;
    padding: 5rem 2rem 3rem 2rem;
    display: none;
    background: radial-gradient(ellipse at top, rgba(123, 104, 238, 0.1) 0%, transparent 60%);
}

.form-section.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.form-container {
    max-width: 550px;
    width: 100%;
    margin: 0 auto;
    background: linear-gradient(135deg, rgba(250, 249, 247, 0.08) 0%, rgba(123, 104, 238, 0.04) 100%);
    backdrop-filter: blur(25px);
    border: 1px solid rgba(232, 193, 124, 0.25);
    border-radius: 35px;
    padding: 3.5rem;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.form-title {
    font-size: 2.5rem;
    text-align: center;
    margin-bottom: 2.5rem;
    background: linear-gradient(135deg, var(--gold), var(--lavender));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.input-group {
    margin-bottom: 1.8rem;
}

.input-label {
    display: block;
    margin-bottom: 0.6rem;
    color: var(--gold);
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.input-field {
    width: 100%;
    padding: 1.2rem;
    background: rgba(250, 249, 247, 0.06);
    border: 1px solid rgba(232, 193, 124, 0.25);
    border-radius: 12px;
    color: var(--ivory);
    font-size: 1rem;
    transition: all 0.3s ease;
}

.input-field:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(250, 249, 247, 0.1);
    box-shadow: 0 0 20px rgba(232, 193, 124, 0.2);
}

.input-field::placeholder {
    color: rgba(250, 249, 247, 0.4);
}

select.input-field {
    cursor: pointer;
}

.input-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

/* City Search Styles */
.city-search-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    left: 0;
    right: 0;
    background: linear-gradient(135deg, rgba(44, 39, 56, 0.98) 0%, rgba(27, 9, 55, 0.95) 100%);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(232, 193, 124, 0.3);
    border-radius: 12px;
    max-height: 250px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 100;
}

.autocomplete-dropdown.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.autocomplete-item {
    padding: 1rem;
    cursor: pointer;
    transition: background 0.2s ease;
    color: var(--ivory);
    border-bottom: 1px solid rgba(232, 193, 124, 0.1);
}

.autocomplete-item:last-child {
    border-bottom: none;
}

.autocomplete-item:hover {
    background: rgba(232, 193, 124, 0.15);
}

.autocomplete-item strong {
    color: var(--gold);
}

/* Submit Button */
.submit-button {
    width: 100%;
    padding: 1.3rem;
    margin-top: 2rem;
    background: linear-gradient(135deg, var(--gold), var(--lavender));
    color: var(--graphite);
    border: none;
    border-radius: 50px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    position: relative;
    overflow: hidden;
}

.submit-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(232, 193, 124, 0.4);
}

.submit-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.button-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 2px solid var(--graphite);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, var(--lavender), var(--gold));
    border-radius: 5px;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--graphite);
    border-radius: 20px;
    padding: 2rem;
    max-width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
}

/* === PREVIEW MODAL STYLES === */
.preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(10, 6, 18, 0.95);
    backdrop-filter: blur(20px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.3s ease;
    padding: 1rem;
}

.preview-content {
    background: linear-gradient(135deg, 
        rgba(44, 39, 56, 0.98) 0%, 
        rgba(27, 9, 55, 0.95) 100%);
    border: 1px solid rgba(232, 193, 124, 0.3);
    border-radius: 35px;
    max-width: 850px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 3rem;
    box-shadow: 0 30px 80px rgba(123, 104, 238, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.reading-result-section {
    min-height: calc(100vh - 200px);
    padding-bottom: 2rem;
}

/* ============ MOBILE RESPONSIVE ============ */
@media (max-width: 768px) {
    .auth-bar {
        padding: 0.8rem 1rem;
        height: auto;
        min-height: 70px;
    }
    
    .auth-container-bar {
        flex-wrap: wrap;
        gap: 0.8rem;
        align-items: center;
    }
    
    .auth-left {
        flex: 0 0 auto;
    }
    
    .auth-left .brand-text {
        font-size: 1.3rem;
        letter-spacing: 0.08em;
    }
    
    .auth-right {
        flex: 1;
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
        flex-wrap: wrap;
    }
    
    .user-name {
        display: none;
    }
    
    .auth-btn {
        padding: 0.5rem 1rem;
        font-size: 0.85rem;
        white-space: nowrap;
    }
    
    .story-section {
        padding: 3rem 1rem;
    }
    
    .story-title {
        font-size: 2rem;
    }
    
    .story-text {
        font-size: 1rem;
    }
    
    .cta-button {
        padding: 16px 35px;
        font-size: 0.95rem;
    }
    
    .form-container {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
        border-radius: 25px;
    }
    
    .form-title {
        font-size: 1.8rem;
    }
    
    .input-row {
        grid-template-columns: 1fr;
        gap: 0;
    }
    
    .auth-modal {
        padding: 1rem;
    }
    
    .auth-modal-content {
        padding: 2rem 1.5rem;
        margin: 0;
        border-radius: 25px;
    }
    
    .auth-form-modal h3 {
        font-size: 1.5rem;
    }
    
    .modal-content {
        padding: 1.5rem;
        max-width: 95%;
        max-height: 80vh;
        margin: 1rem;
    }
    
    .modal-close {
        position: sticky;
        top: 0;
        right: 0;
        width: 36px;
        height: 36px;
        font-size: 1.3rem;
        margin-bottom: 1rem;
        z-index: 10;
    }
    
    .preview-modal {
        padding: 0.5rem;
    }
    
    .preview-content {
        padding: 1.5rem;
        max-width: 95%;
        max-height: 85vh;
        border-radius: 20px;
    }
    
    .door-container {
        perspective: 800px;
    }
    
    .door {
        width: 50%;
    }
    
    .logo-entrance {
        width: 90%;
        padding: 0 1rem;
    }
    
    .logo-text {
        font-size: clamp(3rem, 12vw, 5rem) !important;
        letter-spacing: 0.15em;
    }
    
    .tagline {
        font-size: 0.7rem;
        letter-spacing: 0.3em;
        margin-top: 1.5rem;
    }
    
    .center-glow {
        width: 300px;
        height: 300px;
    }
    
    .toast {
        bottom: 1rem;
        right: 1rem;
        left: 1rem;
        max-width: calc(100% - 2rem);
    }
    
    /* Four Pillars Mobile Fix */
    .modal-content h1,
    .preview-content h1 {
        font-size: 1.5rem !important;
        line-height: 1.2 !important;
        word-wrap: break-word !important;
        padding: 0 1rem !important;
    }
    
    .modal-content > div[style*="grid-template-columns: repeat(4"],
    .preview-content > div[style*="grid-template-columns: repeat(4"] {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
        padding: 1rem !important;
    }
    
    .modal-content div[style*="font-size: 2.5rem"],
    .preview-content div[style*="font-size: 2.5rem"] {
        font-size: 1.8rem !important;
        margin: 0.3rem 0 !important;
    }
}

@media (max-width: 480px) {
    .logo-text {
        font-size: 2.5rem !important;
        letter-spacing: 0.1em;
    }
    
    .tagline {
        font-size: 0.6rem;
        letter-spacing: 0.2em;
    }
    
    .form-container {
        padding: 1.5rem 1rem;
    }
    
    .form-title {
        font-size: 1.5rem;
    }
    
    .input-field {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .submit-button {
        padding: 1.1rem;
        font-size: 1rem;
    }
    
    .auth-modal-content {
        padding: 1.5rem 1rem;
    }
    
    .modal-content {
        padding: 1rem;
        font-size: 0.95rem;
    }
    
    .preview-content {
        padding: 1rem;
    }
    
    .auth-left .brand-text {
        font-size: 1.1rem;
    }
    
    .auth-btn {
        padding: 0.45rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .modal-content h1,
    .preview-content h1 {
        font-size: 1.3rem !important;
    }
    
    .modal-content div[style*="font-size: 2.5rem"],
    .preview-content div[style*="font-size: 2.5rem"] {
        font-size: 1.5rem !important;
    }
}