/**
 * HAL CRM Common Stylesheet
 *
 * Shared design tokens, base reset, and responsive patterns.
 * Include in every page BEFORE page-specific <style> blocks:
 *   <link rel="stylesheet" href="/static/css/common.css">
 *
 * Page-specific styles can override any value defined here.
 */

/* =========================================================================
   DESIGN TOKENS
   ========================================================================= */

:root {
    /* Brand Colors */
    --kofc-blue: #003DA5;
    --kofc-dark-blue: #002B75;
    --kofc-gold: #FFB81C;
    --kofc-light-blue: #e8f0fe;

    /* Status Colors */
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --info: #3b82f6;

    /* Text Colors */
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --text-light: #9ca3af;

    /* Backgrounds */
    --bg-page: #f3f4f6;
    --bg-card: #ffffff;
    --bg-hover: #f9fafb;

    /* Borders */
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;

    /* Layout */
    --sidebar-width: 280px;
    --content-padding: 30px 40px;
    --content-padding-mobile: 20px;

    /* Radii */
    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-xs: 6px;

    /* Shadows */
    --card-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --card-shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.1);
    --modal-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);

    /* Z-Index Scale */
    --z-dropdown: 100;
    --z-sticky: 200;
    --z-modal-overlay: 999;
    --z-modal: 1000;
    --z-sidebar: 1001;
    --z-sidebar-overlay: 1000;
    --z-hamburger: 1002;
}

/* =========================================================================
   BASE RESET
   ========================================================================= */

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-primary);
    background: var(--bg-page);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

img {
    max-width: 100%;
    height: auto;
}

/* =========================================================================
   COMMON MOBILE PATTERNS — 768px (tablet)
   ========================================================================= */

@media (max-width: 768px) {
    /* Sidebar pages: remove left margin */
    .main-content {
        margin-left: 0 !important;
    }

    /* Top bar stacks vertically */
    .top-bar {
        padding: 10px 20px !important;
        flex-direction: column !important;
        gap: 10px;
    }

    /* Content area padding */
    .content-area {
        padding: var(--content-padding-mobile) !important;
    }

    /* Banner image */
    .banner-img {
        height: 60px !important;
    }

    /* Modal mobile override — fits viewport */
    .modal,
    .modal-content,
    .modal-dialog,
    [class*="modal"]:not(.modal-overlay):not([class*="modal-close"]):not([class*="modal-btn"]):not([class*="modal-header"]):not([class*="modal-body"]):not([class*="modal-footer"]):not([class*="modal-title"]):not([class*="modal-text"]):not([class*="modal-icon"]):not([class*="modal-actions"]) {
        max-width: 95vw !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    /* Table overflow — horizontal scroll */
    table {
        display: block;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }

    thead, tbody, tr {
        max-width: 100%;
    }

    /* Tabs scroll horizontally */
    .tabs,
    .tab-nav,
    .tab-buttons {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        flex-wrap: nowrap !important;
    }

    .tabs > *,
    .tab-nav > *,
    .tab-buttons > * {
        white-space: nowrap;
        flex-shrink: 0;
    }

    /* Hamburger top-bar padding (space for toggle button) */
    .top-bar {
        padding-left: 60px !important;
    }
}

/* =========================================================================
   COMMON MOBILE PATTERNS — 480px (phone)
   ========================================================================= */

@media (max-width: 480px) {
    h1 { font-size: 1.4rem !important; }
    h2 { font-size: 1.2rem !important; }

    .content-area {
        padding: 15px !important;
    }
}
