/* =====================================================================
   Sabaragamuwa Provincial Council - Mail Management System
   Main Stylesheet
   ===================================================================== */

:root {
    --sc-maroon: #7A1F2B;
    --sc-maroon-dark: #5C1620;
    --sc-gold: #F4B400;
    --sc-gold-light: #FCE8B0;
    --sc-navy: #0B3C6D;
    --sc-bg: #F4F6F9;
    --sc-card: #FFFFFF;
    --sc-text: #2A2A2A;
    --sc-muted: #6B7280;
    --sc-success: #1E8E5A;
    --sc-warning: #D97706;
    --sc-danger: #C0392B;
    --sc-radius: 10px;
    --sc-shadow: 0 2px 10px rgba(0,0,0,0.06);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: var(--sc-bg);
    color: var(--sc-text);
}

a { text-decoration: none; color: inherit; }

/* ---------------- Top Bar ---------------- */
.top-bar {
    background: linear-gradient(90deg, var(--sc-maroon) 0%, var(--sc-maroon-dark) 100%);
    color: #fff;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--sc-shadow);
}

.top-bar .brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-bar .brand img {
    height: 42px;
    width: auto;
}

.top-bar .brand-text h1 {
    font-size: 15px;
    margin: 0;
    font-weight: 700;
    letter-spacing: .3px;
}

.top-bar .brand-text span {
    font-size: 11.5px;
    color: var(--sc-gold-light);
}

.top-bar .user-menu {
    display: flex;
    align-items: center;
    gap: 18px;
    font-size: 14px;
}

.bell {
    position: relative;
    cursor: pointer;
    font-size: 18px;
}

.bell .badge {
    position: absolute;
    top: -6px;
    right: -8px;
    background: var(--sc-gold);
    color: #3a2a00;
    font-size: 10.5px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
}

.logout-btn {
    background: var(--sc-gold);
    color: #3a2a00;
    padding: 6px 14px;
    border-radius: 6px;
    font-weight: 600;
    font-size: 13px;
    border: none;
    cursor: pointer;
}

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

.sidebar {
    width: 230px;
    background: #fff;
    border-right: 1px solid #e6e6e6;
    padding: 18px 0;
    flex-shrink: 0;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 22px;
    font-size: 14px;
    color: var(--sc-text);
    border-left: 3px solid transparent;
}

.sidebar a:hover, .sidebar a.active {
    background: var(--sc-gold-light);
    border-left-color: var(--sc-maroon);
    color: var(--sc-maroon-dark);
    font-weight: 600;
}

.main-content {
    flex: 1;
    padding: 26px;
}

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

.card h2, .card h3 { margin-top: 0; }

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

.stat-card {
    background: #fff;
    border-radius: var(--sc-radius);
    box-shadow: var(--sc-shadow);
    padding: 18px;
    border-left: 5px solid var(--sc-maroon);
}

.stat-card .num { font-size: 28px; font-weight: 700; color: var(--sc-maroon-dark); }
.stat-card .label { font-size: 13px; color: var(--sc-muted); margin-top: 4px; }
.stat-card.gold { border-left-color: var(--sc-gold); }
.stat-card.navy { border-left-color: var(--sc-navy); }
.stat-card.success { border-left-color: var(--sc-success); }
.stat-card.danger { border-left-color: var(--sc-danger); }

/* ---------------- Forms ---------------- */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; color: var(--sc-text); }
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d8dce0;
    border-radius: 7px;
    font-size: 14px;
    background: #fff;
}
.form-control:focus { outline: none; border-color: var(--sc-maroon); box-shadow: 0 0 0 3px rgba(122,31,43,0.12); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.btn {
    display: inline-block;
    padding: 10px 20px;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}
.btn-primary { background: var(--sc-maroon); color: #fff; }
.btn-primary:hover { background: var(--sc-maroon-dark); }
.btn-gold { background: var(--sc-gold); color: #3a2a00; }
.btn-outline { background: transparent; border: 1px solid var(--sc-maroon); color: var(--sc-maroon); }
.btn-sm { padding: 6px 12px; font-size: 12.5px; }
.btn-danger { background: var(--sc-danger); color: #fff; }

/* ---------------- Tables ---------------- */
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
    background: var(--sc-navy);
    color: #fff;
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
}
table.data-table td { padding: 10px 12px; border-bottom: 1px solid #eef0f2; vertical-align: middle; }
table.data-table tr:hover { background: #fafbfc; }

.badge-status {
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11.5px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-pending { background: #FCE8B0; color: #7a5600; }
.badge-assigned { background: #D6E4F0; color: #0B3C6D; }
.badge-seen { background: #E4D6F0; color: #5B2C87; }
.badge-in_progress { background: #FDE2C8; color: #A05A00; }
.badge-pending_approval { background: #F8D7C4; color: #B34700; }
.badge-sent_reply { background: #CDE8DB; color: #0F6A3E; }
.badge-completed { background: #D3EFDD; color: #1E8E5A; }

.badge-priority-urgent { background: #F8D3D0; color: var(--sc-danger); }
.badge-priority-high { background: #FCE8B0; color: #8a5a00; }
.badge-priority-normal { background: #E6E9ED; color: #555; }
.badge-priority-copy { background: #D6E4F0; color: var(--sc-navy); }

.overdue-row { background: #FDEDEC !important; }

/* ---------------- Login Page ---------------- */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--sc-maroon) 0%, var(--sc-navy) 100%);
    padding: 20px;
}

.login-box {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.25);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}

.login-header {
    background: var(--sc-maroon-dark);
    padding: 26px 24px 20px;
    text-align: center;
    color: #fff;
}

.login-header .logos {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 12px;
}

.login-header .logos img { height: 56px; }

.login-header h1 { font-size: 16px; margin: 4px 0 2px; }
.login-header p { font-size: 12px; margin: 0; color: var(--sc-gold-light); }

.login-body { padding: 26px 28px 30px; }

.login-body .btn-primary { width: 100%; padding: 12px; font-size: 15px; margin-top: 6px; }

.alert { padding: 10px 14px; border-radius: 7px; font-size: 13.5px; margin-bottom: 16px; }
.alert-danger { background: #FBE0DE; color: var(--sc-danger); }
.alert-success { background: #D3EFDD; color: var(--sc-success); }
.alert-info { background: #D6E4F0; color: var(--sc-navy); }

/* Utility */
.text-muted { color: var(--sc-muted); font-size: 13px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }

@media (max-width: 768px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; display: flex; overflow-x: auto; padding: 8px; }
    .sidebar a { padding: 8px 14px; white-space: nowrap; border-left: none; border-bottom: 3px solid transparent; }
    .sidebar a:hover, .sidebar a.active { border-left: none; border-bottom-color: var(--sc-maroon); }
    .form-row { grid-template-columns: 1fr; }
}
