:root {
    /* Retro Sparkle Palette */
    --color-bg-solid: #1a0b2e;
    /* For elements that need solid color */
    --color-surface-dark: rgba(255, 110, 199, 0.1);

    --color-primary: #ff6ec7;
    /* Hot pink */
    --color-secondary: #b642ff;
    /* Electric purple */
    --color-tertiary: #4a90e2;
    /* Sky blue */
    --color-accent: #ffd700;
    /* Gold */
    --color-silver: #c0c0c0;
    /* Silver */
    --color-pink: #ff69b4;
    /* Hot pink variation */

    --color-text: #ffffff;
    --color-text-dim: #c0c0c0;
    /* Silver for dimmed text */

    /* Sparkle colors */
    --sparkle-pink: #ff6ec7;
    --sparkle-gold: #ffd700;
    --sparkle-silver: #e8e8e8;
    --sparkle-blue: #4a90e2;

    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;

    /* Animation */
    --transition-fast: 0.2s ease;
}

body {
    margin: 0;
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, #1a0b2e 0%, #0f0a1e 50%, #1e0a28 100%);
    background-attachment: fixed;
    color: var(--color-text);
    overflow-x: hidden;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    max-width: 480px;
    width: 100%;
    /* Mobile simulation width on desktop */
    margin: 0 auto;
    background: linear-gradient(135deg,
            rgba(255, 110, 199, 0.05) 0%,
            rgba(182, 66, 255, 0.05) 50%,
            rgba(74, 144, 226, 0.05) 100%);
    box-shadow:
        0 0 50px rgba(255, 110, 199, 0.3),
        0 0 100px rgba(182, 66, 255, 0.2);
    height: 100%;
    border-left: 1px solid rgba(255, 110, 199, 0.3);
    border-right: 1px solid rgba(74, 144, 226, 0.3);
}

/* Utilities */
.hidden {
    display: none !important;
}

.fade-in {
    animation: fadeIn 0.4s ease-in-out forwards;
}

.visible-override {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 20px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #333;
    transition: .4s;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 2px;
    bottom: 2px;
    background-color: white;
    transition: .4s;
}

input:checked+.slider {
    background-color: var(--color-primary);
}

input:focus+.slider {
    box-shadow: 0 0 1px var(--color-primary);
}

input:checked+.slider:before {
    transform: translateX(20px);
}

.slider.round {
    border-radius: 34px;
}

.slider.round:before {
    border-radius: 50%;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Sparkle Animation */
@keyframes sparkle {

    0%,
    100% {
        opacity: 0;
        transform: scale(0) rotate(0deg);
    }

    50% {
        opacity: 1;
        transform: scale(1) rotate(180deg);
    }
}

@keyframes shimmer {
    0% {
        background-position: -200% center;
    }

    100% {
        background-position: 200% center;
    }
}

@keyframes float-sparkle {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-10px) rotate(180deg);
    }
}

/* Sparkle Elements */
.sparkle {
    position: relative;
    overflow: visible;
}

.sparkle::before,
.sparkle::after {
    content: '✨';
    position: absolute;
    font-size: 1rem;
    animation: sparkle 2s ease-in-out infinite;
    pointer-events: none;
}

.sparkle::before {
    top: -10px;
    right: -10px;
    animation-delay: 0s;
    color: var(--sparkle-gold);
}

.sparkle::after {
    bottom: -10px;
    left: -10px;
    animation-delay: 1s;
    color: var(--sparkle-pink);
}

/* Metallic Sheen Effect */
.metallic {
    background: linear-gradient(90deg,
            var(--color-silver) 0%,
            var(--color-accent) 25%,
            var(--color-silver) 50%,
            var(--color-accent) 75%,
            var(--color-silver) 100%);
    background-size: 200% auto;
    animation: shimmer 3s linear infinite;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Gradient text effect */
.gradient-text {
    background: linear-gradient(45deg,
            var(--color-primary),
            var(--color-secondary),
            var(--color-tertiary),
            var(--color-accent));
    background-size: 300% 300%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: gradient-shift 5s ease infinite;
}

@keyframes gradient-shift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

/* Glow effect */
.glow {
    box-shadow:
        0 0 10px var(--color-primary),
        0 0 20px var(--color-secondary),
        0 0 30px var(--color-tertiary);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow:
            0 0 10px var(--color-primary),
            0 0 20px var(--color-secondary),
            0 0 30px var(--color-tertiary);
    }

    50% {
        box-shadow:
            0 0 20px var(--color-primary),
            0 0 30px var(--color-secondary),
            0 0 40px var(--color-tertiary);
    }
}

/* Calendar Styles */
.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
    margin-bottom: 20px;
}

.calendar-cell {
    background: linear-gradient(135deg,
            rgba(255, 110, 199, 0.1) 0%,
            rgba(182, 66, 255, 0.1) 100%);
    border-radius: 8px;
    padding: 8px 4px;
    /* Less padding on sides for mobile */
    min-height: 60px;
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: var(--transition-fast);
    border: 1px solid rgba(192, 192, 192, 0.2);
    /* Silver border */
}

.calendar-cell:hover {
    background: linear-gradient(135deg,
            rgba(255, 110, 199, 0.3) 0%,
            rgba(74, 144, 226, 0.3) 100%);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.3);
    /* Gold glow */
}

.calendar-cell.empty {
    background: transparent;
    cursor: default;
}

.calendar-cell.empty:hover {
    transform: none;
    background: transparent;
}

.calendar-cell.is-today {
    border: 2px solid var(--color-primary);
    background: linear-gradient(135deg,
            rgba(255, 110, 199, 0.3) 0%,
            rgba(182, 66, 255, 0.3) 50%,
            rgba(74, 144, 226, 0.3) 100%);
    box-shadow:
        0 0 15px rgba(255, 110, 199, 0.5),
        0 0 25px rgba(255, 215, 0, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

.calendar-cell.has-event {
    /* Subtle indicator, maybe dot is enough, but let's add a tiny border accent */
    border-bottom: 2px solid var(--color-accent);
}

.moon-phase-icon {
    font-size: 1.2rem;
    margin-top: 4px;
    filter: drop-shadow(0 0 2px var(--color-primary));
}

@media (max-width: 360px) {
    .calendar-cell {
        min-height: 50px;
        font-size: 0.8rem;
    }

    .moon-phase-icon {
        font-size: 1rem;
    }
}

/* --- CALENDAR CONTINUED --- */

/* Modal Styles */
.modal {
    display: none;
    /* Hidden by default */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.3s;
}

.modal.show {
    display: flex;
    /* Override display:none */
    justify-content: center;
    align-items: center;
}

/* Force override if needed */
.modal.hidden {
    display: none !important;
}

.modal-content {
    background: linear-gradient(135deg,
            rgba(26, 11, 46, 0.95) 0%,
            rgba(45, 27, 78, 0.95) 100%);
    margin: auto;
    padding: 24px;
    border: 2px solid var(--color-primary);
    width: 80%;
    max-width: 400px;
    border-radius: 16px;
    box-shadow:
        0 0 30px rgba(255, 110, 199, 0.5),
        0 0 50px rgba(182, 66, 255, 0.3),
        0 0 70px rgba(74, 144, 226, 0.2);
    position: relative;
    text-align: center;
    color: var(--color-text);
}

.close-modal {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    position: absolute;
    right: 16px;
    top: 8px;
}

.close-modal:hover,
.close-modal:focus {
    color: white;
    text-decoration: none;
    cursor: pointer;
}

#modal-header {
    margin-bottom: 16px;
}

#modal-icon {
    font-size: 3rem;
    margin-bottom: 8px;
}

#modal-title {
    margin: 0;
    font-family: 'Cinzel', serif;
    color: var(--color-primary);
}

#modal-date {
    font-size: 0.9rem;
    color: var(--color-accent);
    margin-bottom: 16px;
    font-weight: bold;
    text-transform: uppercase;
}

#modal-body {
    max-height: 60vh;
    overflow-y: auto;
}

#modal-footer button {
    background: transparent;
    border: 1px solid var(--color-primary);
    color: var(--color-primary);
    padding: 8px 24px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin-top: 20px;
}

#modal-footer button:hover {
    background: var(--color-primary);
    color: white;
}

/* Nav Icon Hover Effects */
nav div i {
    transition: all 0.3s ease;
}

nav div:hover i {
    color: var(--color-primary) !important;
    filter: drop-shadow(0 0 8px var(--color-primary));
    transform: scale(1.2);
}

/* Floating Sparkle Styles */
.floating-sparkle {
    font-size: 2rem;
    opacity: 0.6;
    filter: drop-shadow(0 0 5px var(--color-accent));
}

/* --- ONBOARDING STYLES --- */

.onboarding-step {
    position: relative;
    z-index: 10;
    /* Ensure above stars */
}

/* Option Button (Grid) */
.ob-option {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.2s;
}

.ob-option:hover {
    background: rgba(255, 110, 199, 0.2);
    border-color: var(--color-primary);
    transform: translateY(-2px);
}

.ob-option.selected {
    background: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: 0 0 15px var(--color-primary);
    font-weight: bold;
}

/* Chip Button (Interests) */
.ob-chip {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #444;
    color: #ccc;
    padding: 8px 16px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    margin: 4px;
}

.ob-chip:hover {
    border-color: var(--color-accent);
    color: white;
}

.ob-chip.selected {
    background: linear-gradient(135deg, var(--color-secondary), var(--color-primary));
    border-color: transparent;
    color: white;
    box-shadow: 0 0 10px rgba(182, 66, 255, 0.4);
    font-weight: bold;
}

/* Primary Button */
.btn-primary {
    background: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 32px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 110, 199, 0.4);
    transition: all 0.3s;
    margin-top: 20px;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 110, 199, 0.6);
}

.loader-sm {
    border: 4px solid #f3f3f3;
    border-radius: 50%;
    border-top: 4px solid var(--color-secondary);
    width: 20px;
    height: 20px;
    -webkit-animation: spin 1s linear infinite;
    /* Safari */
    animation: spin 1s linear infinite;
    display: inline-block;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* --- CHAT STYLES --- */

.chat-bubble {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.4;
    font-size: 0.9rem;
    position: relative;
    animation: fadeIn 0.3s;
}

.chat-bubble.received {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
}

.chat-bubble.sent {
    background: var(--color-primary);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

.chat-media-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    margin-top: 4px;
}

.chat-waveform {
    height: 20px;
    display: flex;
    align-items: center;
    gap: 2px;
}

.chat-waveform div {
    width: 3px;
    background: white;
    border-radius: 2px;
    animation: wave 1s infinite;
}

@keyframes wave {

    0%,
    100% {
        height: 4px;
        opacity: 0.5;
    }

    50% {
        height: 16px;
        opacity: 1;
    }
}

/* --- CREATOR STUDIO --- */

#studio-course-form input,
#studio-course-form textarea {
    transition: border-color 0.2s;
}

#studio-course-form input:focus,
#studio-course-form textarea:focus {
    border-color: var(--color-primary);

    outline: none;
}

/* --- ANTIGRAVITY THEMES --- */
/* Transitions for smooth theme switching */
body {
    transition: background 0.5s ease, color 0.5s ease;
}

/* Day Themes (Background Gradients) */
.theme-sun {
    --color-primary: #4d4dff;
    --color-accent: #ffd700;
    background: linear-gradient(135deg, #0a0a0a 0%, #1a1a2e 100%);
}

.theme-moon {
    --color-primary: #d8bfd8;
    --color-accent: #e6e6fa;
    background: linear-gradient(135deg, #0f0f1a 0%, #2d2d44 100%);
}

.theme-mars {
    --color-primary: #ff4444;
    --color-accent: #ff8c00;
    background: linear-gradient(135deg, #1a0a0a 0%, #3d1a1a 100%);
}

.theme-mercury {
    --color-primary: #00ced1;
    --color-accent: #90ee90;
    background: linear-gradient(135deg, #0a1a1a 0%, #1a3d3d 100%);
}

.theme-jupiter {
    --color-primary: #ffd700;
    --color-accent: #ffa500;
    background: linear-gradient(135deg, #1a1a0a 0%, #3d3d1a 100%);
}

.theme-venus {
    --color-primary: #32cd32;
    --color-accent: #ff69b4;
    background: linear-gradient(135deg, #0a1a0a 0%, #1a3d1a 100%);
}

.theme-saturn {
    --color-primary: #ffa500;
    --color-accent: #cd853f;
    background: linear-gradient(135deg, #1a150a 0%, #3d2e1a 100%);
}

/* AntiGravity Components */
#ag-log-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    z-index: 3000;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.8);
    display: none;
}

#ag-xp-container .card {
    transition: transform 0.2s;
}

/* Enhancements for Dashboard */
#view-home .card {
    border: 1px solid rgba(255, 255, 255, 0.05);
    /* Default subtly */
}