/* ═══════════════════════════════════════════════════════════
   Sindh IT Ticket System — Government Portal Theme
   Matching istd.sindh.gov.pk design language
   ═══════════════════════════════════════════════════════════ */

:root {
    /* Sindh Government Colors */
    --sindh-green: #366a4f;
    --sindh-green-dark: #2a5440;
    --sindh-green-light: #4a8a6a;
    --sindh-green-pale: #e8f5ee;
    --sindh-gold: #c5a23d;
    --sindh-gold-light: #f5e6b8;

    /* UI Colors */
    --primary: #366a4f;
    --primary-light: #4a8a6a;
    --primary-dark: #2a5440;
    --success: #28a745;
    --warning: #e6a817;
    --danger: #dc3545;
    --info: #17a2b8;
    --bg: #f4f6f9;
    --bg-card: #ffffff;
    --text: #333333;
    --text-secondary: #666666;
    --text-muted: #999999;
    --border: #dee2e6;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.12);
    --radius: 6px;
    --radius-lg: 10px;
}

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

body {
    font-family: 'Lato', 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 15px;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--primary-dark); }

/* ═══ Top Bar (matches sindh.gov.pk) ═══ */
.top-bar {
    background: var(--sindh-green);
    color: rgba(255,255,255,0.9);
    font-size: 13px;
    padding: 6px 0;
    border-bottom: 1px solid var(--sindh-green-dark);
}

.top-bar .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.top-bar-left { display: flex; gap: 12px; align-items: center; }
.top-bar-left a { color: rgba(255,255,255,0.8); font-size: 14px; transition: color 0.2s; }
.top-bar-left a:hover { color: #fff; }

.top-bar-right { display: flex; gap: 16px; align-items: center; }
.top-bar-right a { color: rgba(255,255,255,0.8); font-size: 13px; }
.top-bar-right a:hover { color: #fff; }
.top-bar-right span { color: rgba(255,255,255,0.5); }

/* ═══ Header (matches sindh.gov.pk) ═══ */
.site-header {
    background: #fff;
    border-bottom: 2px solid var(--sindh-green);
    position: sticky;
    top: 0;
    z-index: 999;
    box-shadow: 0 2px 6px rgba(0,0,0,0.06);
}

.header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    text-decoration: none;
}

.header-brand .logo-icon {
    width: 50px;
    height: 50px;
    background: var(--sindh-green);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #fff;
}

.header-brand .brand-text h1 {
    font-size: 17px;
    font-weight: 700;
    color: var(--sindh-green);
    line-height: 1.2;
}

.header-brand .brand-text small {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 400;
}

/* ═══ Navigation ═══ */
.main-nav {
    background: var(--sindh-green);
}

.main-nav .container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 0;
}

.nav-list li a {
    display: block;
    padding: 12px 18px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.2s;
    border-bottom: 3px solid transparent;
}

.nav-list li a:hover,
.nav-list li a.active {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border-bottom-color: var(--sindh-gold);
}

.nav-list li a .icon { margin-right: 6px; }

.nav-right {
    margin-left: auto;
    display: flex;
    gap: 0;
}

/* ═══ Layout ═══ */
.app-layout {
    display: flex;
    min-height: calc(100vh - 120px);
}

/* ═══ Sidebar ═══ */
.sidebar {
    width: 260px;
    background: #fff;
    border-right: 1px solid var(--border);
    position: fixed;
    top: 120px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    z-index: 50;
}

.sidebar-header {
    padding: 20px;
    border-bottom: 1px solid var(--border);
    background: var(--sindh-green-pale);
}

.sidebar-header h3 {
    font-size: 14px;
    font-weight: 700;
    color: var(--sindh-green);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-nav { padding: 12px 0; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
    border-left: 3px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--sindh-green-pale);
    color: var(--sindh-green);
}

.sidebar-nav a.active {
    background: var(--sindh-green-pale);
    color: var(--sindh-green);
    border-left-color: var(--sindh-green);
    font-weight: 700;
}

.sidebar-nav a .icon { font-size: 16px; width: 22px; text-align: center; }

.sidebar-user {
    padding: 16px 20px;
    border-top: 1px solid var(--border);
    background: #fafafa;
}

.sidebar-user .name { font-weight: 700; font-size: 14px; color: var(--text); }
.sidebar-user .role {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.notif-badge {
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    margin-left: auto;
}

/* ═══ Main Content ═══ */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 28px 32px;
    min-height: calc(100vh - 120px);
}

/* ═══ Page Header ═══ */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--sindh-green);
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--sindh-green);
}

.page-header .subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-top: 2px;
}

/* ═══ Cards ═══ */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.card-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--sindh-green);
}

/* ═══ Stats Grid ═══ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    text-align: center;
    box-shadow: var(--shadow);
    border-top: 3px solid var(--sindh-green);
    transition: transform 0.2s;
}

.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }

.stat-card .value {
    font-size: 28px;
    font-weight: 800;
    color: var(--sindh-green);
}

.stat-card .label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
    font-weight: 600;
}

.stat-card.success { border-top-color: var(--success); }
.stat-card.success .value { color: var(--success); }
.stat-card.warning { border-top-color: var(--warning); }
.stat-card.warning .value { color: var(--warning); }
.stat-card.danger { border-top-color: var(--danger); }
.stat-card.danger .value { color: var(--danger); }
.stat-card.info { border-top-color: var(--info); }
.stat-card.info .value { color: var(--info); }

/* ═══ Buttons ═══ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 600;
    font-family: 'Lato', sans-serif;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
    text-decoration: none;
}

.btn-primary { background: var(--sindh-green); color: #fff; }
.btn-primary:hover { background: var(--sindh-green-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #218838; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-ghost { background: transparent; color: var(--text-secondary); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 13px; }

/* ═══ Forms ═══ */
.form-group { margin-bottom: 16px; }

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.form-control {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    color: var(--text);
    background: #fff;
    transition: border-color 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--sindh-green);
    box-shadow: 0 0 0 3px rgba(54,106,79,0.1);
}

textarea.form-control { min-height: 100px; resize: vertical; }
select.form-control { appearance: auto; }

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* ═══ Tables ═══ */
.table-wrapper { overflow-x: auto; }

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

thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--sindh-green);
    border-bottom: 2px solid var(--sindh-green-dark);
}

tbody td {
    padding: 10px 14px;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover { background: var(--sindh-green-pale); }
tbody tr:last-child td { border-bottom: none; }

/* ═══ Badges ═══ */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.badge-submitted { background: #cce5ff; color: #004085; }
.badge-assigned { background: #fff3cd; color: #856404; }
.badge-in_progress { background: #d4edda; color: #155724; }
.badge-resolved { background: #c3e6cb; color: #155724; }
.badge-closed { background: #e2e3e5; color: #383d41; }
.badge-rejected { background: #f8d7da; color: #721c24; }

.badge-low { background: #e2e3e5; color: #383d41; }
.badge-medium { background: #fff3cd; color: #856404; }
.badge-high { background: #f8d7da; color: #721c24; }
.badge-urgent { background: #dc3545; color: #fff; }

/* ═══ Timeline ═══ */
.timeline {
    position: relative;
    padding-left: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--sindh-green);
    border: 2px solid #fff;
    box-shadow: 0 0 0 2px var(--sindh-green);
}

.timeline-item.resolved::before { background: var(--success); box-shadow: 0 0 0 2px var(--success); }
.timeline-item.assigned::before { background: var(--warning); box-shadow: 0 0 0 2px var(--warning); }

.timeline-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 3px;
}

.timeline-content { font-size: 14px; }

.timeline-note {
    margin-top: 6px;
    padding: 8px 12px;
    background: #f8f9fa;
    border-radius: var(--radius);
    font-size: 13px;
    color: var(--text-secondary);
    border-left: 3px solid var(--sindh-green);
}

/* ═══ Alerts ═══ */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 16px;
    border-left: 4px solid;
}

.alert-success { background: #d4edda; color: #155724; border-color: #28a745; }
.alert-error { background: #f8d7da; color: #721c24; border-color: #dc3545; }
.alert-info { background: #d1ecf1; color: #0c5460; border-color: #17a2b8; }

/* ═══ Auth Pages ═══ */
.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #2a5440 0%, #366a4f 50%, #4a8a6a 100%);
}

.auth-card {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 36px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border-top: 4px solid var(--sindh-green);
}

.auth-card h1 {
    font-size: 22px;
    text-align: center;
    margin-bottom: 6px;
    color: var(--sindh-green);
}

.auth-card .subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.auth-card .footer {
    text-align: center;
    margin-top: 18px;
    font-size: 14px;
    color: var(--text-secondary);
}

/* ═══ Empty State ═══ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .icon { font-size: 40px; margin-bottom: 10px; }

/* ═══ Pagination ═══ */
.pagination {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-top: 18px;
}

.pagination a, .pagination span {
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 13px;
    font-weight: 600;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: #fff;
}

.pagination a:hover { border-color: var(--sindh-green); color: var(--sindh-green); }
.pagination .active { background: var(--sindh-green); color: #fff; border-color: var(--sindh-green); }

/* ═══ Search Bar ═══ */
.search-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.search-bar input, .search-bar select {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: 'Lato', sans-serif;
    background: #fff;
}

.search-bar input { flex: 1; }
.search-bar input:focus, .search-bar select:focus {
    outline: none;
    border-color: var(--sindh-green);
}

/* ═══ Modal ═══ */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal {
    background: #fff;
    border-radius: var(--radius-lg);
    padding: 28px;
    width: 500px;
    max-width: 90vw;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    border-top: 4px solid var(--sindh-green);
}

/* ═══ Notification Items ═══ */
.notif-item.unread { background: var(--sindh-green-pale); }

/* ═══ Nav Toggle (Mobile Hamburger) ═══ */
.nav-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    padding: 12px 16px;
}

/* ═══ Responsive ═══ */

/* Tablet */
@media (max-width: 900px) {
    .app-layout { flex-direction: column; }
    .sidebar {
        position: static;
        width: 100%;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }
    .sidebar-nav { display: flex; flex-wrap: wrap; padding: 8px 12px; gap: 4px; }
    .sidebar-nav a { border-left: none; padding: 8px 14px; border-radius: var(--radius); border-bottom: 2px solid transparent; }
    .sidebar-nav a.active { border-left: none; border-bottom-color: var(--sindh-green); }
    .sidebar-user { display: none; }
    .main-content { margin-left: 0; padding: 20px; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .page-header h1 { font-size: 20px; }
    .header-inner { height: auto; padding: 12px 16px; flex-wrap: wrap; gap: 8px; }
    .header-brand .brand-text h1 { font-size: 14px; }
    .header-brand .brand-text small { display: none; }
    .top-bar .container { flex-wrap: wrap; justify-content: center; }
    table { font-size: 13px; }
    thead th, tbody td { padding: 8px 10px; }
}

/* Mobile */
@media (max-width: 600px) {
    .top-bar { display: none; }
    .main-nav { position: relative; }
    .nav-list { flex-wrap: wrap; }
    .nav-list li a { padding: 10px 12px; font-size: 13px; }
    .nav-list li a .icon { display: none; }
    .nav-toggle { display: block; position: absolute; right: 10px; top: 0; z-index: 10; }
    .nav-list { display: none; flex-direction: column; width: 100%; }
    .nav-list.open { display: flex; }
    .nav-list li { border-top: 1px solid rgba(255,255,255,0.1); }
    .sidebar { display: none; }
    .main-content { margin-left: 0; padding: 14px; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
    .stat-card { padding: 12px; }
    .stat-card .value { font-size: 22px; }
    .page-header h1 { font-size: 18px; }
    .card { padding: 14px; }
    .table-wrapper { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    table { min-width: 600px; }
    .search-bar { flex-direction: column; }
    .search-bar input, .search-bar select, .search-bar button { width: 100%; }
    .auth-card { margin: 16px; padding: 24px; }
    .form-row { grid-template-columns: 1fr; }
    .modal { margin: 16px; max-width: calc(100vw - 32px); }
    .btn { padding: 10px 16px; font-size: 14px; width: 100%; justify-content: center; }
    .page-header { flex-direction: column; gap: 10px; }
}

/* Small mobile */
@media (max-width: 380px) {
    .stats-grid { grid-template-columns: 1fr; }
    .header-brand .logo-icon { width: 40px; height: 40px; font-size: 20px; }
    .header-brand .brand-text h1 { font-size: 13px; }
}
