/* =============================================
   UI Domain - Core Styles & Variables
   ============================================= */

:root {
    --primary-color: #000000;
    --secondary-color: #f5f5f5;
    --accent-color: #3b82f6;
    --text-color: #333;
    --text-light: #888;
    --bg-color: #ffffff;
    --chat-bg-user: #000000;
    --chat-text-user: #ffffff;
    --chat-bg-ai: #f0f0f0;
    --chat-text-ai: #000000;
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

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

/* Hide scrollbars globally but keep functionality */
*::-webkit-scrollbar {
    display: none;
}

* {
    -ms-overflow-style: none;  /* IE and Edge */
    scrollbar-width: none;  /* Firefox */
}

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

#app-container {
    width: 100%;
    max-width: 600px;
    height: 100%;
    background: var(--bg-color);
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Loading Screen */
#loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    background: var(--bg-color);
    z-index: 1000;
}

/* Intro Animation Overlay */
#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgb(253, 248, 245); /* Cream bg to match GIF */
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    opacity: 1; /* INSTANT visibility - no fade in! */
}

#intro-overlay.fade-out {
    animation: introFadeOut 0.35s ease-out forwards;
}

@keyframes introFadeOut {
    0% { opacity: 1; }
    100% { opacity: 0; pointer-events: none; }
}

#intro-overlay img {
    width: 150px;
    height: 150px;
    object-fit: contain;
    animation: gifFadeIn 0.25s ease-out;
}

@keyframes gifFadeIn {
    0% { opacity: 0; transform: scale(0.9); }
    100% { opacity: 1; transform: scale(1); }
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

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

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Base Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

.btn:active {
    opacity: 0.8;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-secondary {
    background-color: #eee;
    color: #333;
}

.btn-danger {
    background-color: #ef4444;
    color: white;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: white;
    padding: 24px;
    border-radius: 16px;
    width: 90%;
    max-width: 320px;
    text-align: center;
    transform: scale(0.9);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.modal-overlay.visible .modal-content {
    transform: scale(1);
}

.modal-drag-handle {
    width: 40px;
    height: 4px;
    background: #ddd;
    border-radius: 2px;
    margin: 0 auto 16px;
}

.modal-title {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 10px;
}

.modal-message {
    color: #666;
    font-size: 14px;
    margin-bottom: 20px;
    line-height: 1.5;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-actions {
    display: flex;
    gap: 10px;
}

/* =============================================
   Onboarding Stories (Jan 2026 - Closed Beta)
   Instagram-style intro slides for new users
   White/Black theme to match app
   ============================================= */

.onboarding-stories {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.onboarding-stories.fade-out {
    opacity: 0;
}

.stories-container {
    width: 100%;
    max-width: 420px;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Progress Bar */
.stories-progress {
    display: flex;
    gap: 4px;
    padding: 16px 16px 8px;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
}

.progress-segment {
    flex: 1;
    height: 3px;
    background: #e0e0e0;
    border-radius: 2px;
    transition: background 0.3s ease;
}

.progress-segment.active {
    background: #888;
}

.progress-segment.current {
    background: #000;
}

/* Skip Button */
.stories-skip {
    position: absolute;
    top: 40px;
    right: 16px;
    background: #f5f5f5;
    border: none;
    color: #666;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.stories-skip:hover {
    background: #e8e8e8;
    color: #333;
}

/* Slides Container */
.stories-slides {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.story-slide {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    opacity: 0;
    transform: translateX(30px);
    transition: opacity 0.4s ease, transform 0.4s ease;
    pointer-events: none;
}

.story-slide.active {
    opacity: 1;
    transform: translateX(0);
    pointer-events: auto;
}

/* Slide Content */
.slide-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 80px 24px 24px;
}

/* Slide Header */
.slide-header {
    text-align: center;
    margin-bottom: 32px;
}

.slide-emoji {
    font-size: 48px;
    display: block;
    margin-bottom: 16px;
    animation: bounce 2s infinite;
}

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

.slide-title {
    color: #000;
    font-size: 28px;
    font-weight: 800;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.slide-subtitle {
    color: #888;
    font-size: 15px;
    font-weight: 500;
}

/* Chat Preview */
.slide-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    background: #f8f8f8;
    border-radius: 20px;
    overflow-y: auto;
    max-height: 320px;
}

/* Chat Bubbles - Onboarding */
.onboarding-stories .chat-bubble {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    position: relative;
}

.onboarding-stories .sia-bubble {
    align-self: flex-start;
    background: #f0f0f0;
    color: #000;
    border-bottom-left-radius: 4px;
}

.onboarding-stories .user-bubble {
    align-self: flex-end;
    background: #000;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.onboarding-stories .status-bubble {
    align-self: center;
    background: #e8e8e8;
    color: #666;
    font-size: 12px;
    padding: 8px 16px;
    border-radius: 20px;
}

.onboarding-stories .photo-bubble {
    background: #e0e0e0 !important;
    font-style: italic;
    color: #666 !important;
}

.onboarding-stories .proactive-bubble::before {
    content: '✨';
    position: absolute;
    top: -8px;
    left: -8px;
    font-size: 14px;
}

.onboarding-stories .bubble-text {
    font-size: 14px;
    line-height: 1.4;
}

.onboarding-stories .bubble-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    align-self: flex-end;
}

/* Slide Tip */
.slide-tip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 24px;
    padding: 14px 20px;
    background: #f5f5f5;
    border-radius: 12px;
    border: 1px solid #e8e8e8;
}

.tip-icon {
    font-size: 20px;
}

.tip-text {
    color: #333;
    font-size: 13px;
    font-weight: 600;
}

/* Navigation Areas */
.stories-nav-left,
.stories-nav-right {
    position: absolute;
    top: 80px;
    bottom: 120px;
    width: 30%;
    z-index: 5;
    cursor: pointer;
}

.stories-nav-left {
    left: 0;
}

.stories-nav-right {
    right: 0;
}

/* CTA Button */
.stories-cta {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

.stories-cta.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.stories-cta-btn {
    width: 100%;
    padding: 18px 24px;
    background: #000;
    color: #fff;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}

.stories-cta-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.25);
}

.stories-cta-btn:active {
    transform: translateY(0);
}

/* Mobile Adjustments */
@media (max-height: 700px) {
    .slide-chat {
        max-height: 240px;
    }
    
    .slide-emoji {
        font-size: 36px;
    }
    
    .slide-title {
        font-size: 24px;
    }
}
