/* =====================================================
   SEVA PORTAL — Global Stylesheet
   SevaOne-style e-governance portal
   ===================================================== */

:root {
    --primary: #1d4ed8;
    --primary-dark: #1e3a8a;
    --sidebar-bg: #0f172a;
    --sidebar-active: #1d4ed8;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --border: #e2e8f0;
    --success: #22c55e;
    --danger: #ef4444;
    --warning: #f59e0b;
    --radius: 12px;
}

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

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============ AUTH PAGES ============ */
.auth-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a8a 60%, #1d4ed8 100%);
    padding: 20px;
}
.auth-wrap { width: 100%; max-width: 440px; }
.auth-card {
    background: var(--card); border-radius: 16px; padding: 36px 32px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-logo {
    width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 16px;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 26px;
}
.auth-brand h1 { font-size: 22px; margin-bottom: 4px; }
.auth-brand p { color: var(--muted); font-size: 13px; }
.auth-alt { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted); }
.auth-row { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 14px; font-size: 13px; }
.chk { display: flex; gap: 6px; align-items: center; color: var(--muted); cursor: pointer; }

/* ============ FORMS ============ */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; color: #334155; }
.input-icon { position: relative; }
.input-icon i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 14px; width: 18px; }
.input-icon input, .input-icon select {
    width: 100%; padding: 10px 12px 10px 36px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: 14px; background: #fff; outline: none; transition: .2s;
}
.input-icon input:focus, .input-icon select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }

/* plain inputs (no icon) */
.form-control {
    width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
    border-radius: 8px; font-size: 14px; background: #fff; outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(29,78,216,.12); }
textarea.form-control { resize: vertical; min-height: 80px; }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 18px; border: none; border-radius: 8px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: .2s; text-decoration: none !important; font-family: inherit;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #16a34a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #dc2626; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-block { width: 100%; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 6px; }
.btn-outline {
    background: #fff; color: var(--primary); border: 1.5px solid var(--primary);
}
.btn-outline:hover { background: #eff6ff; }

/* ============ ALERTS ============ */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-info { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ============ APP LAYOUT ============ */
.app { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar {
    width: 240px; background: var(--sidebar-bg); color: #cbd5e1;
    display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0;
    z-index: 50; transition: transform .25s;
}
.sidebar-head {
    padding: 18px 16px; display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
    width: 38px; height: 38px; border-radius: 10px;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 17px;
}
.sidebar-head h2 { font-size: 15px; color: #fff; font-weight: 700; }
.sidebar-head span { font-size: 10.5px; color: #94a3b8; display: block; }
.sidebar-nav { flex: 1; overflow-y: auto; padding: 10px 8px; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #334155; border-radius: 4px; }
.nav-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: 1px; color: #64748b; padding: 14px 12px 6px; font-weight: 700; }
.nav-link {
    display: flex; align-items: center; gap: 10px; padding: 9px 12px; margin: 2px 0;
    border-radius: 8px; color: #cbd5e1; font-size: 13.5px; text-decoration: none !important;
    transition: .15s;
}
.nav-link i { width: 18px; text-align: center; font-size: 14px; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-link.active { background: var(--sidebar-active); color: #fff; font-weight: 600; }
.nav-badge { margin-left: auto; background: #ef4444; color: #fff; font-size: 10px; padding: 1px 6px; border-radius: 10px; }

/* Main */
.main { flex: 1; margin-left: 240px; display: flex; flex-direction: column; min-width: 0; }

/* Topbar */
.topbar {
    height: 62px; background: var(--card); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; gap: 14px; padding: 0 22px;
    position: sticky; top: 0; z-index: 40;
}
.topbar .t-title { font-size: 17px; font-weight: 700; }
.topbar .t-sub { font-size: 12px; color: var(--muted); }
.topbar-search { flex: 1; max-width: 380px; position: relative; }
.topbar-search input {
    width: 100%; padding: 9px 14px 9px 34px; border-radius: 20px;
    border: 1.5px solid var(--border); background: #f8fafc; font-size: 13px; outline: none;
}
.topbar-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.icon-btn {
    position: relative; width: 38px; height: 38px; border-radius: 10px; background: #f1f5f9;
    border: none; color: #475569; font-size: 15px; cursor: pointer; transition: .15s;
}
.icon-btn:hover { background: #e2e8f0; }
.dot-count {
    position: absolute; top: -4px; right: -4px; min-width: 17px; height: 17px; padding: 0 4px;
    background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
    border-radius: 9px; display: flex; align-items: center; justify-content: center;
}
.wallet-pill {
    display: flex; align-items: center; gap: 6px; background: #eff6ff; color: #1e40af;
    border: 1px solid #bfdbfe; padding: 6px 12px; border-radius: 20px; font-size: 13px; font-weight: 600;
}
.user-chip { display: flex; align-items: center; gap: 10px; cursor: pointer; position: relative; }
.user-avatar {
    width: 36px; height: 36px; border-radius: 50%;
    background: linear-gradient(135deg, #1d4ed8, #3b82f6); color: #fff;
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
}
.user-chip .u-name { font-size: 13.5px; font-weight: 600; line-height: 1.1; }
.user-chip .u-role { font-size: 11px; color: var(--muted); }
.user-menu {
    position: absolute; top: 46px; right: 0; background: #fff; min-width: 180px;
    border-radius: 10px; box-shadow: 0 10px 40px rgba(0,0,0,.18); padding: 8px; display: none;
    z-index: 60;
}
.user-menu.open { display: block; }
.user-menu a, .user-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    padding: 9px 12px; border-radius: 8px; font-size: 13.5px; color: #334155;
    background: none; border: none; cursor: pointer; text-decoration: none !important; font-family: inherit;
}
.user-menu a:hover, .user-menu button:hover { background: #f1f5f9; }

/* Content */
.content { padding: 24px; flex: 1; }
.page-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 10px; }
.page-head h1 { font-size: 20px; }
.page-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }

/* Cards & grids */
.card {
    background: var(--card); border-radius: var(--radius); padding: 20px;
    border: 1px solid var(--border); box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card-title { font-size: 15px; font-weight: 700; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }

/* Wallet cards */
.wallet-card {
    border-radius: var(--radius); padding: 20px; color: #fff; position: relative; overflow: hidden;
}
.wallet-card.cards { background: linear-gradient(135deg, #1e3a8a, #1d4ed8); }
.wallet-card.payments { background: linear-gradient(135deg, #065f46, #059669); }
.wallet-card .w-icon { position: absolute; right: 14px; top: 14px; font-size: 34px; opacity: .25; }
.wallet-card .w-label { font-size: 12px; text-transform: uppercase; letter-spacing: 1px; opacity: .85; font-weight: 600; }
.wallet-card .w-amount { font-size: 26px; font-weight: 800; margin: 6px 0 14px; }
.wallet-card .w-actions { display: flex; gap: 8px; }
.wallet-card .w-actions a {
    flex: 1; text-align: center; padding: 7px 10px; border-radius: 8px; background: rgba(255,255,255,.18);
    color: #fff; font-size: 12.5px; font-weight: 600; text-decoration: none !important;
}
.wallet-card .w-actions a:hover { background: rgba(255,255,255,.3); }

/* Stat cards */
.stat-card { display: flex; align-items: center; gap: 14px; }
.stat-icon {
    width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 18px; color: #fff;
}
.stat-icon.blue { background: #3b82f6; } .stat-icon.green { background: #22c55e; }
.stat-icon.orange { background: #f59e0b; } .stat-icon.red { background: #ef4444; }
.stat-icon.purple { background: #8b5cf6; } .stat-icon.cyan { background: #06b6d4; }
.stat-val { font-size: 21px; font-weight: 800; }
.stat-label { font-size: 12.5px; color: var(--muted); }

/* Service cards */
.service-card {
    background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; display: flex; flex-direction: column; gap: 8px; position: relative;
    transition: .18s; text-decoration: none !important; color: var(--text);
}
.service-card:hover { transform: translateY(-3px); box-shadow: 0 10px 30px rgba(0,0,0,.1); border-color: #bfdbfe; }
.service-icon {
    width: 46px; height: 46px; border-radius: 12px; background: #eff6ff; color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-size: 19px;
}
.service-name { font-weight: 700; font-size: 14px; line-height: 1.3; }
.service-desc { font-size: 12px; color: var(--muted); line-height: 1.4; min-height: 33px; }
.service-foot { display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.service-price { font-size: 13.5px; font-weight: 800; color: var(--primary-dark); }
.svc-badge {
    position: absolute; top: 12px; right: 12px; font-size: 10px; font-weight: 800;
    padding: 3px 8px; border-radius: 6px; color: #fff; letter-spacing: .5px;
}

/* Category chips */
.cat-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.cat-chip {
    padding: 7px 14px; border-radius: 20px; background: #fff; border: 1.5px solid var(--border);
    font-size: 13px; font-weight: 600; color: #475569; cursor: pointer; text-decoration: none !important;
    transition: .15s;
}
.cat-chip:hover { border-color: var(--primary); color: var(--primary); }
.cat-chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }

/* Tables */
.table-card { padding: 0; overflow: hidden; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th {
    background: #f8fafc; text-align: left; padding: 12px 14px; font-size: 11.5px;
    text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 700;
    border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.data td { padding: 12px 14px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
table.data tr:last-child td { border-bottom: none; }
table.data tr:hover td { background: #f8fafc; }
.empty-state { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty-state i { font-size: 34px; margin-bottom: 10px; opacity: .4; }

/* Badges / pills */
.pill { display: inline-block; padding: 3px 10px; border-radius: 12px; font-size: 11.5px; font-weight: 700; color: #fff; }
.pill-outline { background: #f1f5f9; color: #475569; border: 1px solid var(--border); }

/* Application details */
.detail-grid { display: grid; grid-template-columns: 160px 1fr; gap: 10px 16px; font-size: 14px; }
.detail-grid dt { color: var(--muted); font-weight: 600; }
.detail-grid dd { word-break: break-word; }

/* Ticket chat */
.chat-box { max-height: 380px; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 12px; }
.bubble {
    max-width: 78%; padding: 10px 14px; border-radius: 14px; font-size: 13.5px; line-height: 1.45;
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
}
.bubble.me { align-self: flex-end; background: var(--primary); color: #fff; border-bottom-right-radius: 4px; }
.bubble.them { align-self: flex-start; background: #f1f5f9; color: var(--text); border-bottom-left-radius: 4px; }
.bubble .b-meta { font-size: 10.5px; opacity: .7; margin-top: 4px; }

/* Footer */
.footer { padding: 14px 22px; text-align: center; font-size: 12.5px; color: var(--muted); border-top: 1px solid var(--border); }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 100;
    display: none; align-items: center; justify-content: center; padding: 20px;
}
.modal-overlay.open { display: flex; }
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 480px; padding: 24px; max-height: 90vh; overflow-y: auto; }
.modal h3 { font-size: 17px; margin-bottom: 16px; }

/* Mobile */
.mobile-toggle { display: none; }
@media (max-width: 900px) {
    .grid-4, .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .mobile-toggle { display: inline-flex; }
    .topbar-search { display: none; }
}
@media (max-width: 560px) {
    .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
    .content { padding: 14px; }
    .user-chip .u-name, .user-chip .u-role { display: none; }
}

/* Print — only application receipt */
@media print {
    .sidebar, .topbar, .footer, .btn, .no-print { display: none !important; }
    .main { margin: 0; }
    .content { padding: 0; }
    .card { border: none; box-shadow: none; }
}
