/* PawLog Base CSS - Reset, Variables, and Common Styles */

/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    /* Disable zooming and pinch-to-zoom */
    touch-action: pan-y pan-x;
    overscroll-behavior: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Allow scrolling and text selection in specific areas */
.diary-feed,
.kb-list,
.meal-plan-content,
.trainer-content,
.flow-view-container,
.social-content,
textarea,
input[type="text"],
.modal-body,
.event-detail-body {
    touch-action: auto;
    -webkit-user-select: text;
    user-select: text;
    -webkit-overflow-scrolling: touch;
}

/* CSS Variables for Light/Dark Mode */
:root {
    /* Light mode colors - iOS-native neutral palette */
    --color-primary: #007AFF;
    --color-primary-dark: #0051D5;
    --color-secondary: #5856D6;
    --color-background: #F2F2F7;
    --color-background-rgb: 242, 242, 247;
    --color-surface: #FFFFFF;
    --color-surface-rgb: 255, 255, 255;
    --color-text: #000000;
    --color-text-secondary: #8E8E93;
    --color-border: #C6C6C8;
    --color-error: #FF3B30;
    --color-success: #34C759;
    --color-tint: rgba(0, 122, 255, 0.08);

    /* Card styles */
    --card-radius: 16px;
    --card-border: 1px solid rgba(0, 0, 0, 0.08);
    --card-shadow: none;

    /* Icon colors - iOS system colors */
    --icon-walk: #34C759;
    --icon-meal: #FF9500;
    --icon-vet: #007AFF;
    --icon-play: #FF2D55;
    --icon-medicine: #AF52DE;
    --icon-grooming: #5AC8FA;
    --icon-training: #FFCC00;

    /* Safe area insets */
    --safe-area-top: env(safe-area-inset-top);
    --safe-area-bottom: env(safe-area-inset-bottom);
    --safe-area-left: env(safe-area-inset-left);
    --safe-area-right: env(safe-area-inset-right);

    /* Container max-width for desktop */
    --container-max-width: 980px;
}

/* Base body styles (Light mode default) */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--color-background);
    /* Background image will be set by background-generator.js */
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    background-repeat: no-repeat;
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    min-height: 100vh;
    padding-left: var(--safe-area-left);
    padding-right: var(--safe-area-right);
    -moz-osx-font-smoothing: grayscale;
}

/* Common Screen Styles */
.screen {
    min-height: 100vh;
    opacity: 0;
    animation: fadeIn 0.5s ease-in-out forwards;
}

.hidden {
    display: none !important;
}

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

/* Splash Screen (Light mode default) */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--color-surface);
    /* Background image will be set by background-generator.js */
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.splash-logo {
    width: 150px;
    height: 150px;
    object-fit: contain;
    margin-bottom: 20px;
    animation: pulse 1.5s ease-in-out infinite;
    border-radius: 50%;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.splash-screen h1 {
    color: var(--color-text);
    font-size: 3rem;
    margin-bottom: 10px;
}

.splash-screen p {
    color: var(--color-text-secondary);
    font-size: 1.2rem;
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--color-text-secondary);
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    color: var(--color-text);
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .splash-screen h1 {
        font-size: 2rem;
    }
}

/* ============================================================================
   Dark Mode Overrides
   IMPORTANT: This section MUST come AFTER all base styles to properly override
   ============================================================================ */
@media (prefers-color-scheme: dark) {
    :root {
        --color-background: #000000;
        --color-background-rgb: 0, 0, 0;
        --color-surface: #1C1C1E;
        --color-surface-rgb: 28, 28, 30;
        --color-text: #FFFFFF;
        --color-text-secondary: #8E8E93;
        --color-border: #38383A;
        --color-tint: rgba(10, 132, 255, 0.12);

        /* Card styles for dark mode */
        --card-border: none;
        --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    }

    body {
        background-color: var(--color-background);
        /* Background image will be set by background-generator.js */
    }

    .splash-screen {
        background-color: var(--color-surface);
        /* Background image will be set by background-generator.js */
    }
}

/* Toast Animations */
@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(400px);
        opacity: 0;
    }
}
