/* ============================================
   ROOT VARIABLES
   ============================================ */
:root {
    /* Colors */
    --color-primary: #00c853;
    --color-primary-dark: #009624;
    --color-secondary: #1976d2;
    --color-danger: #d32f2f;
    --color-warning: #ffa000;
    --color-background: #f5f7fa;
    --color-surface: #ffffff;
    --color-text: #1a2332;
    --color-text-secondary: #6b7a8f;
    --color-border: #e0e4e8;
    
    /* Typography */
    --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    --font-size-heading: 20px;
    --font-size-body: 16px;
    --font-size-small: 14px;
    --font-size-tiny: 12px;
    
    /* Spacing */
    --spacing-xs: 4px;
    --spacing-sm: 8px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;
    
    /* Border Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    
    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.15);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.2);
    
    /* Touch Targets */
    --touch-target: 44px;
}

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: var(--font-family);
    font-size: 16px;
    background: var(--color-background);
    color: var(--color-text);
    touch-action: manipulation;
}

#app {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
}

#page-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ============================================
   SCROLLBAR STYLING
   ============================================ */
::-webkit-scrollbar {
    width: 4px;
    height: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--color-border);
    border-radius: 2px;
}

/* ============================================
   OFFLINE BANNER
   ============================================ */
#offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--color-warning);
    color: #fff;
    padding: 8px 16px;
    font-size: var(--font-size-small);
    font-weight: 600;
    text-align: center;
    z-index: 1000;
    transform: translateY(-100%);
    transition: transform 0.3s ease;
}

#offline-banner.visible {
    transform: translateY(0);
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999;
    pointer-events: none;
}

.toast {
    background: var(--color-text);
    color: #fff;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: var(--font-size-body);
    font-weight: 500;
    box-shadow: var(--shadow-lg);
    pointer-events: auto;
    animation: slideUp 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    max-width: 90%;
    text-align: center;
}

.toast.success {
    background: var(--color-primary);
}

.toast.error {
    background: var(--color-danger);
}

.toast.warning {
    background: var(--color-warning);
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateY(-20px); }
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.hidden {
    display: none !important;
}

.text-center { text-align: center; }
.text-muted { color: var(--color-text-secondary); }
.text-sm { font-size: var(--font-size-small); }
.text-xs { font-size: var(--font-size-tiny); }

.mt-sm { margin-top: var(--spacing-sm); }
.mt-md { margin-top: var(--spacing-md); }
.mt-lg { margin-top: var(--spacing-lg); }

.mb-sm { margin-bottom: var(--spacing-sm); }
.mb-md { margin-bottom: var(--spacing-md); }
.mb-lg { margin-bottom: var(--spacing-lg); }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.flex-col { display: flex; flex-direction: column; }

.gap-sm { gap: var(--spacing-sm); }
.gap-md { gap: var(--spacing-md); }
.gap-lg { gap: var(--spacing-lg); }

.w-full { width: 100%; }
.h-full { height: 100%; }

/* ============================================
   RESPONSIVE FONT SIZES (Mobile First)
   ============================================ */
@media (max-width: 480px) {
    :root {
        --font-size-heading: 18px;
        --font-size-body: 15px;
        --font-size-small: 13px;
    }
}

@media (min-width: 768px) {
    #app {
        max-width: 480px;
        margin: 0 auto;
        border-left: 1px solid var(--color-border);
        border-right: 1px solid var(--color-border);
        box-shadow: var(--shadow-lg);
    }
}