/* ============================================================
   MOBSE Abia Federal Census - Stylesheet (refined)
   Bronzebit Consult Ltd
============================================================ */

/* ---------- Reset & base ---------- */
*, *::before, *::after {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    background: #f3f5f8;
    color: #2c3e50;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: #2d7d46; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Color tokens ---------- */
:root {
    --green-900: #143b21;
    --green-800: #1e5631;
    --green-700: #2d7d46;
    --green-600: #3a9559;
    --green-100: #dff5e3;

    --gray-900: #1f2937;
    --gray-800: #2c3e50;
    --gray-700: #455567;
    --gray-600: #5a6877;
    --gray-500: #7a8896;
    --gray-400: #95a5a6;
    --gray-300: #cfd6dd;
    --gray-200: #e6ecef;
    --gray-100: #f0f4f8;
    --gray-50:  #f7faf9;

    --amber-700: #7c5a08;
    --amber-100: #fef3d4;

    --red-700:   #8e1a14;
    --red-600:   #c0392b;
    --red-100:   #fde2e0;

    --blue-700:  #1a4d70;
    --blue-500:  #2980b9;
    --blue-100:  #d6e9f5;

    --orange-700:#d35400;
    --orange-100:#fef4e8;

    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.15);

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;

    --sidebar-w: 240px;
}

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

/* SIDEBAR */
.sidebar {
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--green-900) 0%, #102d19 100%);
    color: #d4ebda;
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-brand img {
    width: 40px;
    height: 40px;
    object-fit: contain;
    background: white;
    border-radius: 50%;
    padding: 3px;
    flex-shrink: 0;
}

.sidebar-brand .text { color: white; line-height: 1.2; }

.sidebar-brand .text strong {
    display: block;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.3px;
}

.sidebar-brand .text small {
    font-size: 10px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar-section { padding: 16px 0 6px; }

.sidebar-heading {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: rgba(255,255,255,0.4);
    padding: 0 18px 6px;
    font-weight: 600;
}

.sidebar-nav { display: flex; flex-direction: column; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c8dccf;
    text-decoration: none;
    padding: 10px 18px;
    font-size: 13px;
    border-left: 3px solid transparent;
    transition: all 0.12s;
}

.sidebar-nav a:hover {
    background: rgba(255,255,255,0.06);
    color: white;
    text-decoration: none;
}

.sidebar-nav a.active {
    background: rgba(255,255,255,0.08);
    color: white;
    border-left-color: #f1c40f;
    font-weight: 600;
}

.sidebar-nav a .icon {
    width: 18px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    opacity: 0.85;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99;
}

/* MAIN */
.app-main {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

/* TOP BAR */
.topbar {
    background: white;
    height: 60px;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 14px;
    flex: 1;
    min-width: 0;
}

.hamburger {
    display: none;
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.hamburger svg { width: 18px; height: 18px; }

.page-breadcrumb {
    font-size: 13px;
    color: var(--gray-600);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.page-breadcrumb strong { color: var(--gray-900); }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px 6px 6px;
    background: var(--gray-100);
    border-radius: 999px;
    font-size: 13px;
    color: var(--gray-700);
}

.user-chip .avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--green-700);
    color: white;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 12px;
    text-transform: uppercase;
}

.user-chip strong { color: var(--gray-900); }

.icon-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--gray-300);
    background: white;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-600);
    text-decoration: none;
    transition: all 0.12s;
}

.icon-btn:hover {
    background: var(--gray-100);
    color: var(--green-700);
    text-decoration: none;
}

.icon-btn svg { width: 16px; height: 16px; }

/* CONTENT */
.main-content {
    padding: 24px;
    max-width: 1400px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
}

.page-title {
    font-size: 22px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: var(--gray-900);
    letter-spacing: -0.2px;
}

.page-subtitle {
    font-size: 13px;
    color: var(--gray-600);
    margin: 0 0 20px 0;
}

/* CARDS */
.card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 20px;
}

.card-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--gray-900);
    margin: 0 0 14px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--gray-200);
    letter-spacing: 0.2px;
}

/* LOGIN */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    background: #f3f5f8;
}

.login-hero {
    flex: 1;
    background: linear-gradient(135deg, var(--green-800) 0%, var(--green-900) 100%);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.login-hero::before {
    content: "";
    position: absolute;
    inset: -50%;
    background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.08), transparent 60%);
    pointer-events: none;
}

.login-hero .logo {
    width: 130px;
    height: 130px;
    object-fit: contain;
    background: white;
    padding: 12px;
    border-radius: 50%;
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    margin-bottom: 24px;
    position: relative;
}

.login-hero h1 {
    font-size: 26px;
    font-weight: 700;
    margin: 0 0 6px 0;
    letter-spacing: 0.2px;
    position: relative;
}

.login-hero p {
    font-size: 13px;
    opacity: 0.85;
    max-width: 380px;
    margin: 0;
    position: relative;
    line-height: 1.6;
}

.login-hero .motto {
    margin-top: 30px;
    padding-top: 24px;
    border-top: 1px solid rgba(255,255,255,0.15);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.7;
    position: relative;
}

.login-form-side {
    width: 460px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 40px;
    background: white;
}

.login-wrapper {
    align-items: center;
    justify-content: center;
    padding: 28px 14px;
    background:
        radial-gradient(circle at 20% 20%, rgba(45,125,70,0.16), transparent 28%),
        linear-gradient(135deg, #eef5f0 0%, #f7faf9 48%, #e9f2ec 100%);
}

.login-box {
    width: 100%;
    max-width: 430px;
    background: rgba(255,255,255,0.96);
    border: 1px solid var(--gray-200);
    border-top: 4px solid var(--green-700);
    border-radius: 18px;
    padding: 30px 28px 24px;
    box-shadow: 0 24px 60px rgba(20,59,33,0.14);
    position: relative;
}

.login-box::before {
    content: "";
    display: block;
    width: 70px;
    height: 70px;
    margin: -2px auto 16px;
    border-radius: 50%;
    background: #fff url('../Images/abia-logo.jpg') center/contain no-repeat;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow-md);
}

.login-box h2 {
    margin: 0 0 4px 0;
    color: var(--gray-900);
    font-size: 22px;
    font-weight: 700;
}

.login-box .sub {
    color: var(--gray-600);
    font-size: 13px;
    margin-bottom: 26px;
}

.login-box-footer {
    text-align: center;
    margin-top: 18px;
    font-size: 12px;
    color: var(--gray-500);
}

/* FORM */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
    letter-spacing: 0.2px;
}

.form-group input[type=text],
.form-group input[type=password],
.form-group input[type=email],
.form-group input[type=number],
.form-group input[type=tel],
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    background: white;
    color: var(--gray-900);
    transition: all 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--green-700);
    box-shadow: 0 0 0 3px rgba(45,125,70,0.14);
}

.form-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.form-row .form-group {
    flex: 1;
    min-width: 160px;
}

/* BUTTONS */
.btn {
    display: inline-block;
    padding: 9px 18px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: all 0.15s;
    font-family: inherit;
    line-height: 1.3;
    white-space: nowrap;
}

.btn:focus { outline: 2px solid rgba(45,125,70,0.35); outline-offset: 2px; }
.btn:hover { text-decoration: none; }

.btn-primary {
    background: var(--green-700);
    color: white;
    border-color: var(--green-700);
}
.btn-primary:hover { background: var(--green-800); border-color: var(--green-800); color: white; }

.btn-secondary {
    background: white;
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.btn-secondary:hover { background: var(--gray-100); color: var(--gray-900); }

.btn-danger {
    background: var(--red-600);
    color: white;
    border-color: var(--red-600);
}
.btn-danger:hover { background: var(--red-700); border-color: var(--red-700); color: white; }

.btn-warning {
    background: #e67e22;
    color: white;
    border-color: #e67e22;
}
.btn-warning:hover { background: #c25e0c; border-color: #c25e0c; color: white; }

.btn-block { display: block; width: 100%; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 14px; }

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

.tile {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 20px;
    text-decoration: none;
    color: var(--gray-900);
    box-shadow: var(--shadow-sm);
    border-top: 3px solid var(--green-700);
    transition: all 0.18s;
    display: block;
}

.tile:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
    text-decoration: none;
    border-top-color: var(--green-600);
}

.tile .icon {
    font-size: 24px;
    margin-bottom: 10px;
    line-height: 1;
}

.tile .title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 4px;
    color: var(--gray-900);
}

.tile .desc {
    font-size: 12px;
    color: var(--gray-600);
    line-height: 1.5;
}

/* LGA GRID */
.lga-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}

.lga-card {
    background: white;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-md);
    padding: 14px;
    box-shadow: var(--shadow-sm);
    border-left: 4px solid var(--green-700);
    transition: all 0.15s;
}

.lga-card:hover { box-shadow: var(--shadow-md); }

.lga-card h4 {
    margin: 0 0 10px 0;
    font-size: 13px;
    font-weight: 700;
    color: var(--green-800);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.lga-card .stats {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
    font-size: 11px;
    font-weight: 600;
}

.lga-card .stats .pub,
.lga-card .stats .priv {
    flex: 1;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    text-align: center;
}

.lga-card .stats .pub { background: var(--blue-100); color: var(--blue-700); }
.lga-card .stats .priv { background: var(--orange-100); color: var(--orange-700); }

.lga-card a.view-link {
    display: block;
    text-align: center;
    color: var(--green-700);
    text-decoration: none;
    font-weight: 600;
    font-size: 11px;
    padding: 6px;
    border: 1px solid var(--green-700);
    border-radius: var(--radius-sm);
    transition: all 0.15s;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.lga-card a.view-link:hover {
    background: var(--green-700);
    color: white;
    text-decoration: none;
}

/* TABLES */
.table-wrap {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-sm);
}

.table-wrap::after {
    content: "Swipe sideways to view full table";
    display: none;
    color: var(--gray-500);
    font-size: 11px;
    padding-top: 6px;
}

table.data-table {
    width: 100%;
    min-width: 720px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
}

table.data-table thead th {
    background: var(--gray-100);
    color: var(--gray-700);
    text-align: left;
    padding: 10px 12px;
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--gray-200);
    border-top: 1px solid var(--gray-200);
    white-space: nowrap;
}

table.data-table thead th:first-child { border-top-left-radius: var(--radius-sm); border-left: 1px solid var(--gray-200); }
table.data-table thead th:last-child  { border-top-right-radius: var(--radius-sm); border-right: 1px solid var(--gray-200); }

table.data-table tbody td {
    padding: 11px 12px;
    border-bottom: 1px solid var(--gray-200);
    color: var(--gray-800);
}

table.data-table tbody tr:hover { background: var(--gray-50); }

tr.assigned-row { opacity: 0.6; background: var(--amber-100); }
tr.assigned-row td.school-name { text-decoration: line-through; }

/* ALERTS */
.alert {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    font-size: 13px;
    border-left: 3px solid;
}

.alert-success { background: var(--green-100); color: var(--green-800); border-color: var(--green-700); }
.alert-error   { background: var(--red-100); color: var(--red-700); border-color: var(--red-600); }
.alert-warning { background: var(--amber-100); color: var(--amber-700); border-color: #d4a017; }
.alert-info    { background: var(--blue-100); color: var(--blue-700); border-color: #3498db; }

/* BADGES */
.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}

.badge-public   { background: var(--blue-100); color: var(--blue-700); }
.badge-private  { background: var(--orange-100); color: var(--orange-700); }
.badge-active   { background: var(--green-100); color: var(--green-800); }
.badge-pending  { background: var(--amber-100); color: var(--amber-700); }
.badge-done     { background: var(--blue-100); color: var(--blue-700); }
.badge-rejected { background: var(--red-100); color: var(--red-700); }

/* TOOLBAR */
.toolbar {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: flex-end;
    padding: 14px;
    background: var(--gray-50);
    border-radius: var(--radius-sm);
    margin-bottom: 14px;
    border: 1px solid var(--gray-200);
}

.toolbar .form-group {
    margin-bottom: 0;
    min-width: 160px;
}

.toolbar .form-group.flex { flex: 1; }

/* EMPTY */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--gray-400);
}

.empty-state .icon {
    font-size: 42px;
    margin-bottom: 10px;
    opacity: 0.5;
}

/* MODAL */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15,30,40,0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.modal-overlay.show { display: flex; }

.modal-box {
    background: white;
    padding: 22px;
    border-radius: var(--radius-md);
    max-width: 500px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    max-height: 90vh;
    overflow-y: auto;
}

/* CREDENTIALS */
.credentials-display {
    background: var(--amber-100);
    padding: 16px;
    border-radius: var(--radius-sm);
    border: 2px dashed #d4a017;
    margin: 12px 0;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
}

.credentials-display .label { font-weight: 600; }

/* TAGS */
.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 6px;
    min-height: 30px;
}

.tag-list .tag {
    background: var(--green-100);
    color: var(--green-800);
    padding: 4px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.tag-list .tag .remove {
    cursor: pointer;
    color: var(--red-600);
    font-weight: bold;
    font-size: 12px;
    padding: 0 2px;
    border-radius: 2px;
}

.tag-list .tag .remove:hover { background: var(--red-100); }

/* FOOTER */
.site-footer {
    text-align: center;
    padding: 16px;
    color: var(--gray-400);
    font-size: 11px;
    border-top: 1px solid var(--gray-200);
    background: white;
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 1024px) {
    .login-form-side { width: 100%; }
    .login-hero { display: none; }
}

@media (max-width: 768px) {
    :root { --sidebar-w: 260px; }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.show { display: block; }

    .app-main { margin-left: 0; }

    .hamburger { display: inline-flex; }

    .topbar { padding: 0 14px; height: 56px; }

    .user-chip { padding: 0; background: transparent; }
    .user-chip .name-block { display: none; }

    .main-content { padding: 16px; }

    .form-row { flex-direction: column; gap: 0; }
    .form-row .form-group { min-width: 0; }

    .tiles { grid-template-columns: 1fr 1fr; gap: 12px; }
    .lga-grid { grid-template-columns: 1fr 1fr; }

    .page-title { font-size: 19px; }

    table.data-table { font-size: 12px; }
    table.data-table thead th,
    table.data-table tbody td { padding: 8px 10px; }
}

@media (max-width: 480px) {
    .tiles { grid-template-columns: 1fr; }
    .lga-grid { grid-template-columns: 1fr; }
}


@media (max-width: 768px) {
    .card { padding: 14px; }
    .toolbar { align-items: stretch; }
    .toolbar .form-group,
    .toolbar .form-group.flex,
    .toolbar .btn { width: 100%; min-width: 0; }

    .table-wrap::after { display: block; }
    table.data-table { min-width: 680px; }
    table.data-table .btn { margin: 2px 0; }

    .login-wrapper { padding: 18px 12px; }
    .login-box { padding: 24px 18px 20px; border-radius: 14px; }
    .login-box h2 { text-align: center; font-size: 20px; }
    .login-box .sub { text-align: center; margin-bottom: 22px; }
}

@media (max-width: 480px) {
    .topbar-right { gap: 8px; }
    .icon-btn { width: 34px; height: 34px; }
    .page-breadcrumb { font-size: 12px; }
    table.data-table { min-width: 620px; font-size: 12px; }
    .btn { width: 100%; margin-bottom: 4px; }
    .login-box::before { width: 58px; height: 58px; }
}
