/**
 * TBFS Shared Styles
 * Common styling for all pages in the multi-page PWA
 * 
 * Version: 2.0.0 (Multi-Page Architecture)
 */

/* ============================================
   DESIGN TOKENS & VARIABLES
   ============================================ */
:root {
    /* Colors */
    --primary-gradient: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --header-gradient: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    --success-color: #27ae60;
    --danger-color: #e74c3c;
    --warning-color: #f39c12;
    --info-color: #3498db;
    
    /* Spacing */
    --spacing-xs: 5px;
    --spacing-sm: 10px;
    --spacing-md: 15px;
    --spacing-lg: 20px;
    --spacing-xl: 30px;
    --spacing-xxl: 40px;
    
    /* Border Radius */
    --radius-sm: 5px;
    --radius-md: 10px;
    --radius-lg: 20px;
    --radius-full: 9999px;
    
    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 20px rgba(0, 0, 0, 0.2);
    --shadow-xl: 0 20px 40px rgba(0, 0, 0, 0.1);
    
    /* Typography */
    --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-size-xs: 12px;
    --font-size-sm: 14px;
    --font-size-md: 16px;
    --font-size-lg: 18px;
    --font-size-xl: 24px;
    --font-size-xxl: 32px;
    
    /* Navigation Height */
    --nav-height: 50px; /* Reduced height since logo section removed */
}

/* ============================================
   RESET & BASE STYLES
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: var(--primary-gradient);
    min-height: 100vh;
    padding: var(--spacing-lg);
    padding-top: calc(var(--nav-height) + var(--spacing-lg));
}

/* ============================================
   LAYOUT CONTAINERS
   ============================================ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
}

.page-content {
    padding: var(--spacing-xxl);
}

/* ============================================
   HEADER & NAVIGATION
   ============================================ */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--header-gradient);
    box-shadow: var(--shadow-md);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--spacing-sm) var(--spacing-lg);
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: var(--spacing-md);
    min-height: var(--nav-height);
}

.logo-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
}

.logo {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    object-fit: contain;
    background: white;
    padding: 4px;
}

.company-info {
    display: none;
}

.company-name {
    display: none;
}

.tagline {
    display: none;
}

/* Main Navigation - Desktop: horizontal, Mobile: slide-out menu */
.main-nav {
    display: flex;
    gap: var(--spacing-sm);
    align-items: center;
    flex-wrap: wrap;
}

.nav-item {
    color: white;
    text-decoration: none;
    padding: var(--spacing-sm) var(--spacing-md);
    border-radius: var(--radius-sm);
    font-weight: 600;
    font-size: var(--font-size-sm);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.nav-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.nav-item.active {
    background: white;
    color: #667eea;
}

/* Hamburger Menu - Always visible */
.hamburger {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: var(--spacing-sm);
    z-index: 1001;
}

.hamburger span {
    width: 25px;
    height: 3px;
    background: white;
    border-radius: var(--radius-sm);
    transition: all 0.3s ease;
}

.hamburger.active span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.hamburger.active span:nth-child(2) {
    opacity: 0;
}

.hamburger.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    padding: var(--spacing-md) var(--spacing-xl);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-md);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
    font-family: var(--font-family);
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

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

.btn-secondary {
    background: #95a5a6;
    color: white;
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.card-header {
    font-size: var(--font-size-xl);
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: var(--spacing-md);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-lg);
    margin-bottom: var(--spacing-lg);
}

.stat-card {
    background: white;
    padding: var(--spacing-lg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    text-align: center;
}

.stat-label {
    color: #636e72;
    font-size: var(--font-size-sm);
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    text-transform: uppercase;
}

.stat-value {
    color: #2c3e50;
    font-size: var(--font-size-xxl);
    font-weight: bold;
}

/* ============================================
   FORMS
   ============================================ */
.form-group {
    margin-bottom: var(--spacing-lg);
}

.form-label {
    display: block;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: var(--spacing-sm);
    font-size: var(--font-size-sm);
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: var(--spacing-md);
    border: 2px solid #e9ecef;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-md);
    font-family: var(--font-family);
    transition: all 0.3s ease;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-hint {
    font-size: var(--font-size-xs);
    color: #636e72;
    margin-top: var(--spacing-xs);
}

.form-error {
    color: var(--danger-color);
    font-size: var(--font-size-sm);
    margin-top: var(--spacing-xs);
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    margin-bottom: var(--spacing-lg);
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

thead {
    background: var(--primary-gradient);
    color: white;
}

th {
    padding: var(--spacing-md);
    text-align: left;
    font-weight: 600;
    font-size: var(--font-size-sm);
}

td {
    padding: var(--spacing-md);
    border-bottom: 1px solid #e9ecef;
    font-size: var(--font-size-sm);
}

tbody tr:hover {
    background: #f8f9fa;
}

tbody tr:last-child td {
    border-bottom: none;
}

/* ============================================
   BADGES & TAGS
   ============================================ */
.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: var(--radius-sm);
    font-size: var(--font-size-xs);
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success {
    background: #d4edda;
    color: #155724;
}

.badge-danger {
    background: #f8d7da;
    color: #721c24;
}

.badge-warning {
    background: #fff3cd;
    color: #856404;
}

.badge-info {
    background: #d1ecf1;
    color: #0c5460;
}

/* ============================================
   ALERTS & NOTIFICATIONS
   ============================================ */
.alert {
    padding: var(--spacing-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--spacing-lg);
    border-left: 4px solid;
}

.alert-success {
    background: #d4edda;
    border-color: var(--success-color);
    color: #155724;
}

.alert-danger {
    background: #f8d7da;
    border-color: var(--danger-color);
    color: #721c24;
}

.alert-warning {
    background: #fff3cd;
    border-color: var(--warning-color);
    color: #856404;
}

.alert-info {
    background: #d1ecf1;
    border-color: var(--info-color);
    color: #0c5460;
}

/* ============================================
   LOADING & SPINNER
   ============================================ */
.loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(102, 126, 234, 0.3);
    border-top: 4px solid #667eea;
    border-radius: var(--radius-full);
    animation: spin 1s linear infinite;
    margin: var(--spacing-xl) auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

/* ============================================
   UTILITY CLASSES
   ============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

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

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

.hidden { display: none !important; }
.visible { display: block !important; }

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
/* Mobile Navigation - Hamburger menu for all screen sizes */
@media (max-width: 768px) {
    body {
        padding: var(--spacing-sm);
        padding-top: calc(var(--nav-height) + var(--spacing-sm));
    }

    body.nav-open {
        overflow: hidden;
    }
    
    .page-content {
        padding: var(--spacing-lg);
    }
    
    /* Mobile Navigation - Slide-out menu */
    .main-nav {
        position: fixed;
        top: var(--nav-height);
        left: 0;
        right: 0;
        flex-direction: column;
        background: var(--header-gradient);
        padding: var(--spacing-lg);
        gap: var(--spacing-md);
        transform: translateX(-100%);
        transition: transform 0.3s ease, opacity 0.3s ease, visibility 0.3s ease;
        max-height: calc(100vh - var(--nav-height));
        overflow-y: auto;
        z-index: 1000;
        display: flex; /* Keep in DOM for reliable toggling */
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    
    .main-nav.active,
    body.nav-open .main-nav {
        transform: translateX(0);
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
    }
    
    .nav-item {
        width: 100%;
        text-align: center;
    }
}

/* Desktop Navigation - Show horizontal menu by default, but allow hamburger toggle */
@media (min-width: 769px) {
    .main-nav {
        display: flex;
        position: static;
        transform: none;
        flex-direction: row;
        background: transparent;
        padding: 0;
        flex: 1; /* Take remaining space */
    }
    
    /* Hamburger visible on desktop */
    .hamburger {
        display: flex;
    }
    
    /* On desktop, menu is always visible horizontally */
    .main-nav.active {
        display: flex;
    }
}
    
    /* Stats Grid */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    /* Tables */
    table {
        font-size: var(--font-size-xs);
    }
    
    th, td {
        padding: var(--spacing-sm);
    }
}

@media (max-width: 480px) {
    .company-name {
        font-size: var(--font-size-md);
    }
    
    .tagline {
        display: none;
    }
}

/* ============================================
   ANIMATIONS
   ============================================ */
.fade-in {
    animation: fadeIn 0.3s ease-in;
}

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

.slide-up {
    animation: slideUp 0.3s ease-out;
}

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

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
    body {
        background: white;
        padding: 0;
    }
    
    .app-header,
    .hamburger,
    .btn,
    .no-print {
        display: none !important;
    }
    
    .container {
        box-shadow: none;
        border-radius: 0;
    }
}
