/* Base Styles - Reset, Typography, Fonts, Backgrounds, Loading Spinner */

/* Reset Styles */
html, body {
    overflow: hidden;
    width: 100%;
    height: 100%;
    max-width: 100vw;
}

/* iOS safe area background color - prevents white bars on notch/home indicator areas */
html {
    background-color: #1a1a2e;
}

/* Enable scrolling when logged in or in demo mode */
html:has(.app-container.active),
body:has(.app-container.active) {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

/* Enable scrolling on the landing page */
html:has(.auth-container.active),
body:has(.auth-container.active) {
    overflow-y: auto;
    height: auto;
    min-height: 100vh;
}

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

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Better text rendering */
* {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Typography and Fonts */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'SF Pro Text', 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    background-attachment: fixed;
    min-height: 100vh;
    /* Account for iOS safe areas (notch, home indicator) */
    padding: 16px 20px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    color: #ffffff;
    overflow-x: auto;
    position: relative;
}

/* Background Image Styles */
.background-image {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -2;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.background-image.active {
    opacity: 1;
}

.background-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(10, 10, 20, 0.7);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.background-overlay.active {
    opacity: 1;
}

/* Scrollbar Styles */
.task-list::-webkit-scrollbar,
.inbox-list::-webkit-scrollbar,
.gemini-messages::-webkit-scrollbar,
.archive-list::-webkit-scrollbar,
.calendar-events::-webkit-scrollbar,
.news-list::-webkit-scrollbar,
.news-modal .news-list::-webkit-scrollbar {
    width: 6px;
    height: 4px;
}

.task-list::-webkit-scrollbar-track,
.inbox-list::-webkit-scrollbar-track,
.archive-list::-webkit-scrollbar-track {
    background: transparent;
}

.task-list::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 3px;
}

.task-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.inbox-list::-webkit-scrollbar-thumb,
.gemini-messages::-webkit-scrollbar-thumb,
.archive-list::-webkit-scrollbar-thumb,
.news-list::-webkit-scrollbar-thumb,
.news-modal .news-list::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 3px;
}

.archive-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

.calendar-events::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
}

.preview-body::-webkit-scrollbar {
    width: 6px;
}

.preview-body::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 3px;
}

/* Loading Spinner */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 80vh;
}

.loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: #78b4ff;
    border-radius: 50%;
    animation: spin 0.8s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}
