/* =====================================================
   Shift Report System - Modern Stylesheet
   نظام تقارير الورديات - تصميم عصري
   ===================================================== */

:root {
    --primary: #2563eb;
    --primary-dark: #1e40af;
    --primary-light: #dbeafe;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --warning-light: #fef3c7;
    --danger: #ef4444;
    --danger-light: #fee2e2;
    --info: #06b6d4;
    --info-light: #cffafe;
    
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    
    --text: #0f172a;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    
    --radius-sm: 6px;
    --radius: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

body.rtl {
    direction: rtl;
    font-family: 'IBM Plex Sans Arabic', 'Plus Jakarta Sans', sans-serif;
}

/* =====================================================
   Navbar
   ===================================================== */
.navbar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

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

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    font-size: 18px;
    color: var(--text);
    text-decoration: none;
}

.navbar-brand .logo {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 20px;
}

.navbar-links {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nav-link {
    padding: 8px 14px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.nav-link:hover {
    background: var(--border-light);
    color: var(--text);
}

.nav-link.active {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.nav-link.logout {
    color: var(--danger);
}

.nav-link.logout:hover {
    background: var(--danger-light);
}

/* =====================================================
   Layout
   ===================================================== */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
}

.page-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

/* =====================================================
   Cards
   ===================================================== */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-light);
}

.card-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.card-icon.blue { background: var(--primary-light); color: var(--primary-dark); }
.card-icon.green { background: var(--success-light); color: var(--success); }
.card-icon.orange { background: var(--warning-light); color: var(--warning); }
.card-icon.red { background: var(--danger-light); color: var(--danger); }
.card-icon.cyan { background: var(--info-light); color: var(--info); }

.card-title {
    font-size: 17px;
    font-weight: 600;
    color: var(--text);
}

.card-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

/* =====================================================
   Forms
   ===================================================== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

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

.form-group.full { grid-column: 1 / -1; }

.form-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.form-label .required { color: var(--danger); margin-right: 2px; }

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: all 0.15s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

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

/* =====================================================
   Buttons
   ===================================================== */
.btn {
    padding: 10px 18px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
}

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

.btn-success { background: var(--success); color: white; }
.btn-success:hover { filter: brightness(0.9); }

.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(0.9); }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border-light); }

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

.btn-block { width: 100%; justify-content: center; }

/* =====================================================
   Tables
   ===================================================== */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    font-size: 14px;
}

.table th {
    background: var(--bg);
    padding: 12px 14px;
    text-align: start;
    font-weight: 600;
    color: var(--text-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.table td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-light);
    color: var(--text);
}

.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--border-light); }

.table input,
.table select,
.table textarea {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
}

.table input:focus,
.table select:focus,
.table textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.table-total-row {
    background: var(--primary-light) !important;
    font-weight: 700;
}

.table-total-row td {
    color: var(--primary-dark);
    font-weight: 700;
}

/* =====================================================
   Status badges
   ===================================================== */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 600;
}

.badge-low { background: var(--success-light); color: var(--success); }
.badge-medium { background: var(--warning-light); color: var(--warning); }
.badge-high { background: var(--danger-light); color: var(--danger); }
.badge-closed { background: var(--border-light); color: var(--text-muted); }
.badge-running { background: var(--success-light); color: var(--success); }
.badge-standby { background: var(--warning-light); color: var(--warning); }
.badge-breakdown { background: var(--danger-light); color: var(--danger); }

/* =====================================================
   Stat Cards (Dashboard)
   ===================================================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    inset-inline-start: 0;
    width: 4px;
    height: 100%;
    background: var(--primary);
}

.stat-card.green::before { background: var(--success); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-card.cyan::before { background: var(--info); }

.stat-icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    margin-bottom: 12px;
}

.stat-card.green .stat-icon { background: var(--success-light); color: var(--success); }
.stat-card.orange .stat-icon { background: var(--warning-light); color: var(--warning); }
.stat-card.red .stat-icon { background: var(--danger-light); color: var(--danger); }
.stat-card.cyan .stat-icon { background: var(--info-light); color: var(--info); }

.stat-label {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 500;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.stat-change {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* =====================================================
   Alerts
   ===================================================== */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.alert-success { background: var(--success-light); color: #065f46; border: 1px solid #6ee7b7; }
.alert-error { background: var(--danger-light); color: #991b1b; border: 1px solid #fca5a5; }
.alert-info { background: var(--info-light); color: #155e75; border: 1px solid #67e8f9; }

/* =====================================================
   Login Page
   ===================================================== */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

.login-logo {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 32px;
    margin: 0 auto 20px;
}

.login-title {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
}

.login-subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 28px;
}

/* =====================================================
   Filters bar
   ===================================================== */
.filters-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
}

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 140px;
    flex: 1;
}

.filter-item label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
}

/* =====================================================
   Chart container
   ===================================================== */
.chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
}

.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.chart-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

.chart-canvas-wrap {
    position: relative;
    height: 280px;
}

/* =====================================================
   Mobile responsive
   ===================================================== */
@media (max-width: 768px) {
    .container { padding: 16px; }
    .card { padding: 16px; }
    .page-title { font-size: 22px; }
    
    .navbar { padding: 12px 16px; }
    .navbar-brand { font-size: 16px; }
    .navbar-brand .logo { width: 36px; height: 36px; font-size: 18px; }
    .nav-link { padding: 6px 10px; font-size: 13px; }
    
    .form-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .stat-card { padding: 14px; }
    .stat-value { font-size: 22px; }
    .stat-icon { width: 36px; height: 36px; font-size: 18px; }
    
    .chart-grid { grid-template-columns: 1fr; }
    .chart-canvas-wrap { height: 240px; }
    
    .table { font-size: 12px; }
    .table th, .table td { padding: 8px 10px; }
    
    .login-card { padding: 28px 20px; }
    
    .filter-item { min-width: 100%; }
}

@media (max-width: 480px) {
    .stats-grid { grid-template-columns: 1fr; }
    .navbar-links { width: 100%; justify-content: space-between; }
}

/* =====================================================
   Utilities
   ===================================================== */
.text-center { text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 16px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.d-flex { display: flex; }
.gap-2 { gap: 8px; }
.flex-wrap { flex-wrap: wrap; }
.justify-end { justify-content: flex-end; }
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; opacity: 0.5; }
