﻿/* ===== SITE.CSS - CORE FRAMEWORK STYLES ===== */
/* Note: All CRUD form/button/layout styles moved to create.css */

/* PWA Install Button Styles */
.pwa-install-btn {
    display: none;
    position: absolute;
    top: 50%;
    right: 20px;
    transform: translateY(-50%);
    background: #4ECDC4;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    z-index: 100;
    box-shadow: 0 2px 4px rgba(78, 205, 196, 0.2);
}

    .pwa-install-btn:hover {
        background: #3BB8B2;
        transform: translateY(-50%) translateY(-1px);
        box-shadow: 0 4px 8px rgba(78, 205, 196, 0.3);
    }

    .pwa-install-btn:active {
        transform: translateY(-50%) translateY(0px);
        box-shadow: 0 2px 4px rgba(78, 205, 196, 0.2);
    }

/* Ensure header container is positioned for absolute button */
.app-header .container {
    position: relative;
}

/* Hide install button when running as PWA */
.pwa-mode .pwa-install-btn {
    display: none;
}

/* PWA-specific styles */
.pwa-mode {
    /* Hide elements that don't make sense in PWA */
}

/* PWA status bar adjustments */
@media (display-mode: standalone) {
    .app-header {
        padding-top: env(safe-area-inset-top);
    }

    .bottom-nav {
        padding-bottom: env(safe-area-inset-bottom);
    }
}

/* ===== CSS VARIABLES ===== */
:root {
    --primary-bg: #f8fcfc;
    --card-bg: #ffffff;
    --border-color: #e0f2f1;
    --text-primary: #1a1a1a;
    --text-secondary: #4a5568;
    --text-muted: #718096;
    --accent-primary: #4ECDC4;
    --accent-primary-dark: #2A9D96;
    --accent-primary-light: #7DDDD6;
    --accent-secondary: #FF6B6B;
    --accent-secondary-dark: #E55555;
    --accent-secondary-light: #FF9999;
    --accent-blue: #4ECDC4;
    --accent-green: #4ECDC4;
    --accent-red: #FF6B6B;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --radius: 8px;
    /* ===== MODERN FONT SYSTEM ===== */
    --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
    --font-mono: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', 'Consolas', monospace;
    --font-display: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    /* Font sizes */
    --text-xs: 0.75rem;
    --text-sm: 0.8125rem;
    --text-base: 0.875rem;
    --text-md: 0.9375rem;
    --text-lg: 1rem;
    --text-xl: 1.125rem;
    --text-2xl: 1.25rem;
    /* Font weights */
    --weight-normal: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    /* Line heights */
    --leading-tight: 1.25;
    --leading-snug: 1.375;
    --leading-normal: 1.5;
    --leading-relaxed: 1.625;
    /* Letter spacing */
    --tracking-tight: -0.025em;
    --tracking-normal: 0em;
    --tracking-wide: 0.025em;
    --tracking-wider: 0.05em;
}

/* ===== RESET AND BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

::placeholder {
    font-family: Calibri;
    font-size: 1em;
    color: #b8e6e2;
}

body {
    font-family: var(--font-primary);
    background: var(--primary-bg);
    color: var(--text-primary);
    line-height: var(--leading-normal);
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ===== UNIVERSAL TYPOGRAPHY SYSTEM ===== */
/* Page headers - elegant and clear hierarchy */
h1, .page-title {
    font-family: var(--font-display);
    font-size: var(--text-2xl);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    letter-spacing: var(--tracking-tight);
    color: var(--text-primary);
    margin: 0;
}

h2, .section-title {
    font-family: var(--font-display);
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    line-height: var(--leading-tight);
    color: var(--text-primary);
    margin: 0;
}

h3, .subsection-title {
    font-family: var(--font-display);
    font-size: var(--text-lg);
    font-weight: var(--weight-medium);
    line-height: var(--leading-snug);
    color: var(--text-primary);
    margin: 0;
}

h4, .small-title {
    font-family: var(--font-primary);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    line-height: var(--leading-snug);
    color: var(--text-primary);
    margin: 0;
}

p, .body-text {
    font-family: var(--font-primary);
    font-size: var(--text-base);
    font-weight: var(--weight-normal);
    line-height: var(--leading-normal);
    color: var(--text-primary);
    margin: 0;
}

.text-secondary {
    font-family: var(--font-primary);
    font-size: var(--text-sm);
    font-weight: var(--weight-normal);
    line-height: var(--leading-normal);
    color: var(--text-secondary);
}

.text-muted {
    font-family: var(--font-primary);
    font-size: var(--text-xs);
    font-weight: var(--weight-normal);
    line-height: var(--leading-normal);
    color: var(--text-muted);
}

.text-data, .metric-value, .numeric {
    font-family: var(--font-mono);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-normal);
    font-variant-numeric: tabular-nums;
}

.label-text {
    font-family: var(--font-primary);
    font-size: var(--text-xs);
    font-weight: var(--weight-medium);
    line-height: var(--leading-tight);
    text-transform: uppercase;
    letter-spacing: var(--tracking-wider);
    color: var(--text-muted);
}

/* ===== GLOBAL LAYOUT ===== */
.header-logo {
    width: 40px;
}

.app-header {
    background: var(--card-bg);
    border-bottom: thin solid var(--border-color);
}

    .app-header .container {
        max-width: 2560px;
        margin: 0 auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 17px;
    }

.app-logo {
    font-weight: 700;
    color: var(--accent-primary);
    text-decoration: none;
}

.main-content {
    min-height: calc(100vh - 140px);
}

.app-footer {
    background: var(--primary-bg);
    border-top: 1px solid var(--border-color);
    padding: 20px 0;
    text-align: center;
}

    .app-footer p {
        color: var(--text-secondary);
        margin: 0;
        font-size: 14px;
    }

/* ===== NAVIGATION SYSTEM ===== */
.app-nav {
    display: flex;
    gap: 4px;
    background: rgba(248, 252, 252, 0.5);
    padding: 2px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
    padding: 6px 12px;
    border-radius: 4px;
    transition: all 0.2s ease;
    position: relative;
    white-space: nowrap;
}

    .nav-link:hover {
        background: rgba(78, 205, 196, 0.1);
        color: var(--accent-primary);
        text-decoration: none;
        transform: translateY(-1px);
    }

    .nav-link.active {
        background: var(--accent-primary);
        color: white;
        font-weight: 600;
        box-shadow: 0 1px 4px rgba(78, 205, 196, 0.3);
    }

        .nav-link.active:hover {
            background: var(--accent-primary-dark);
            color: white;
            transform: translateY(-1px);
        }

.nav-separator {
    color: var(--text-muted);
    padding: 0 4px;
    display: flex;
    align-items: center;
}

.nav-current {
    color: var(--text-primary);
    font-weight: 600;
    padding: 6px 12px;
}

/* ===== DASHBOARD/INDEX SPECIFIC BUTTONS ===== */
/* These are NOT used in CRUD forms - they're for dashboard/index pages */
.add-btn {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-primary-dark));
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .add-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(78, 205, 196, 0.3);
        text-decoration: none;
        color: white;
    }

.compare-btn {
    background: linear-gradient(135deg, var(--accent-secondary), var(--accent-secondary-dark));
    color: white;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .compare-btn:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.3);
    }

.clear-btn {
    color: #64748b;
    text-decoration: none;
    font-size: 12px;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    transition: all 0.2s ease;
}

    .clear-btn:hover {
        background: var(--primary-bg);
        text-decoration: none;
        color: var(--text-secondary);
    }

.action-btn {
    padding: 6px 12px;
    border: 1px solid var(--border-color);
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    text-decoration: none;
}

    .action-btn:hover {
        background: var(--accent-primary);
        color: white;
        border-color: var(--accent-primary);
        text-decoration: none;
    }

    .action-btn.delete:hover {
        background: var(--accent-secondary);
        border-color: var(--accent-secondary);
    }

.apply-btn {
    background: var(--accent-primary);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .apply-btn:hover {
        background: var(--accent-primary-dark);
    }

/* ===== DASHBOARD/INDEX SPECIFIC FORM ELEMENTS ===== */
/* These are for filters/search, NOT for CRUD forms */
.filter-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background: white;
    font-size: 13px;
    color: var(--text-secondary);
    min-width: 120px;
}

    .filter-select:focus {
        outline: none;
        border-color: var(--accent-primary);
        box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
    }

.date-input {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 12px;
    width: 130px;
    color: var(--text-secondary);
}

    .date-input:focus {
        outline: none;
        border-color: var(--accent-primary);
        box-shadow: 0 0 0 3px rgba(78, 205, 196, 0.1);
    }

/* ===== DASHBOARD/INDEX SPECIFIC CARDS ===== */
.card-nav {
    text-decoration: none;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: 32px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: all 0.2s ease;
}

    .card-nav:hover {
        border: thin solid var(--accent-secondary);
        box-shadow: 0 4px 12px rgba(255, 107, 107, 0.1);
        transform: translateY(-2px);
    }

.metric-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

    .metric-card:hover {
        transform: translateY(-1px);
        border-color: var(--accent-primary-light);
        box-shadow: 0 4px 12px rgba(78, 205, 196, 0.15);
    }

.metric-label {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    margin-bottom: 4px;
}

.metric-sub {
    font-size: 10px;
    color: var(--text-muted);
}

/* ===== DASHBOARD/REPORTS SPECIFIC STYLES ===== */
/* Better mobile responsive for dashboard data tables */
@media (max-width: 768px) {
    .reports-grid .report-card {
        margin-bottom: 12px;
    }

    .metrics-row {
        flex-direction: column;
        gap: 12px;
    }

    .metric-card {
        min-width: 100%;
    }

    /* Make charts responsive */
    .chart-container {
        position: relative;
        height: 300px !important;
    }
}

/* ===== SHARED UTILITY CLASSES ===== */
.trend-positive {
    color: var(--accent-primary);
}

.trend-neutral {
    color: var(--text-muted);
}

.trend-negative {
    color: var(--accent-secondary);
}

/* ===== UNIVERSAL LOADING STATES ===== */
.loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
}

    .loading::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 20px;
        height: 20px;
        margin: -10px 0 0 -10px;
        border: 2px solid #f3f4f6;
        border-top: 2px solid var(--accent-primary);
        border-radius: 50%;
        animation: spin 1s linear infinite;
    }

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* ===== UNIVERSAL ACCESSIBILITY ===== */
.nav-link:focus,
.action-btn:focus,
.filter-select:focus,
.add-btn:focus {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

/* ===== RESPONSIVE DESIGN FOR NON-CRUD PAGES ===== */
@media (max-width: 768px) {
    .app-header .container {
        padding: 7px 16px;
    }

    .app-nav {
        display: none;
        gap: 2px;
        padding: 1px;
    }

    .nav-link {
        padding: 5px 10px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    .pwa-install-btn {
        right: 10px;
        padding: 6px 12px;
        font-size: 13px;
    }
}

/* Hide on very small screens where space is limited */
@media (max-width: 480px) {
    .pwa-install-btn {
        display: none;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .app-header,
    .app-footer,
    .action-btn,
    .add-btn,
    .compare-btn,
    .pwa-install-btn {
        display: none;
    }

    .main-content {
        margin: 0;
        padding: 0;
    }

    body {
        background: white;
    }
}
