/* 
 * ZIP Flap Data Dashboard - Main Stylesheet
 * Â© Prof C Butterworth 2025
 * Shared styles for all pages
 */

/* ========================================
   BASE STYLES & RESET
   ======================================== */

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

body {
    font-family: 'Inter', sans-serif;
    background: #f5f7fa;
    color: #2c3e50;
    line-height: 1.6;
    min-height: 100vh;
}

/* ========================================
   HEADER & NAVIGATION
   ======================================== */

.main-header {
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    padding: 20px 30px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 1000;
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-left h1 {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 5px;
}

.header-subtitle {
    font-size: 12px;
    opacity: 0.8;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.user-info {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 14px;
}

.user-role {
    font-size: 12px;
    opacity: 0.8;
}

.hospital-badge {
    background-color: #27ae60;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
}

/* Navigation Menu */
.header-nav {
    display: flex;
    gap: 8px;
    margin-top: 15px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

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

.nav-link.active {
    background: rgba(255, 255, 255, 0.2);
}

.nav-link i {
    font-size: 14px;
}

/* ========================================
   MAIN CONTAINER
   ======================================== */

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 30px;
}

/* ========================================
   CONTENT SECTIONS
   ======================================== */

.content-section {
    background: white;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.section-title {
    font-size: 24px;
    font-weight: 600;
    color: #2c3e50;
    margin: 0;
}

.page-title {
    font-size: 28px;
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 24px;
}

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Inter', sans-serif;
    text-decoration: none;
}

.btn-primary {
    background: #3498db;
    color: white;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
    color: white;
}

.btn-success:hover {
    background: #229954;
}

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

.btn-secondary:hover {
    background: #7f8c8d;
}

.btn-danger {
    background: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-light {
    background: white;
    color: #2c3e50;
    border: 1px solid #dee2e6;
}

.btn-light:hover {
    background: #f8f9fa;
}

.btn-small {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 4px;
    color: #495057;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
    background: none;
    cursor: pointer;
}

.btn-icon:hover {
    background: #e9ecef;
    color: #212529;
}

.btn-icon.danger:hover {
    background: #e74c3c;
    color: white;
}

/* ========================================
   FORMS
   ======================================== */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-group input[readonly] {
    background-color: #f8f9fa;
    cursor: not-allowed;
}

.form-section-title {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    margin: 30px 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e0e6ed;
}

.required {
    color: #e74c3c;
}

/* ========================================
   TABLES
   ======================================== */

.table-container {
    overflow-x: auto;
    margin-top: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background-color: #f8f9fa;
}

th {
    padding: 14px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #495057;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid #dee2e6;
}

td {
    padding: 14px 16px;
    border-bottom: 1px solid #f0f0f0;
    font-size: 14px;
    color: #2c3e50;
}

tbody tr {
    transition: background-color 0.2s;
}

tbody tr:hover {
    background-color: #f8f9fa;
}

/* ========================================
   CARDS & STATS
   ======================================== */

.dashboard-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.card {
    background: white;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid;
    transition: transform 0.2s, box-shadow 0.2s;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.card.blue { border-left-color: #3498db; }
.card.green { border-left-color: #27ae60; }
.card.orange { border-left-color: #e67e22; }
.card.purple { border-left-color: #9b59b6; }
.card.teal { border-left-color: #1abc9c; }
.card.indigo { border-left-color: #6c5ce7; }
.card.red { border-left-color: #e74c3c; }

.card-header {
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.card-value {
    font-size: 36px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 8px;
}

.card-subtitle {
    font-size: 14px;
    color: #95a5a6;
}

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

.stat-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
    border-left: 4px solid #3498db;
}

.stat-title {
    font-size: 13px;
    font-weight: 600;
    color: #7f8c8d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #2c3e50;
    margin-bottom: 4px;
}

.stat-detail {
    font-size: 13px;
    color: #95a5a6;
}

/* ========================================
   BADGES & STATUS
   ======================================== */

.status-badge {
    display: inline-block;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

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

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-pending {
    background-color: #fff3cd;
    color: #856404;
}

.status-follow-up {
    background-color: #d1ecf1;
    color: #0c5460;
}

.status-inactive {
    background: #f8d7da;
    color: #721c24;
}

.role-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
}

.role-super {
    background: #e3f2fd;
    color: #1565c0;
}

.role-admin {
    background: #f3e5f5;
    color: #6a1b9a;
}

.role-user {
    background: #e8f5e9;
    color: #2e7d32;
}

/* ========================================
   ALERTS & NOTIFICATIONS
   ======================================== */

.info-note {
    background-color: #e3f2fd;
    border-left: 4px solid #2196f3;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #1565c0;
}

.warning-note {
    background-color: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #856404;
}

.success-note {
    background-color: #d4edda;
    border-left: 4px solid #28a745;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #155724;
}

.error-note {
    background-color: #f8d7da;
    border-left: 4px solid #dc3545;
    padding: 16px;
    border-radius: 6px;
    margin-bottom: 24px;
    font-size: 14px;
    color: #721c24;
}

/* ========================================
   SEARCH & FILTERS
   ======================================== */

.search-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.search-bar input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.search-bar input:focus {
    outline: none;
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.search-box {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
}

.search-box input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
}

.filters-panel {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

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

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
    margin-bottom: 8px;
}

.filter-group input,
.filter-group select {
    padding: 10px 14px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    background: white;
}

/* ========================================
   MODALS
   ======================================== */

.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    overflow-y: auto;
}

.modal.active {
    display: block;
}

.modal-content {
    background-color: white;
    margin: 50px auto;
    border-radius: 8px;
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 2px solid #e0e6ed;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    color: #2c3e50;
}

.modal-close {
    font-size: 28px;
    font-weight: 300;
    color: #95a5a6;
    cursor: pointer;
    background: none;
    border: none;
}

.modal-close:hover {
    color: #7f8c8d;
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 20px 24px;
    border-top: 1px solid #e0e6ed;
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.p-1 { padding: 8px; }
.p-2 { padding: 16px; }
.p-3 { padding: 24px; }
.p-4 { padding: 32px; }

.d-flex {
    display: flex;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }

.justify-between {
    justify-content: space-between;
}

.align-center {
    align-items: center;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 768px) {
    .main-header {
        padding: 15px 20px;
    }

    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .header-nav {
        flex-wrap: wrap;
        gap: 8px;
    }

    .nav-link {
        font-size: 13px;
        padding: 8px 14px;
    }

    .container {
        padding: 20px 15px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .search-bar {
        flex-direction: column;
    }

    .dashboard-cards,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }

    .card-value {
        font-size: 28px;
    }
}

@media (max-width: 480px) {
    .page-title {
        font-size: 22px;
    }

    .section-title {
        font-size: 20px;
    }

    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}
