/* ── BanYo Super Admin Console ─────────────────────────────
   Theme color: #2D7D46 (green)
   ─────────────────────────────────────────────────────── */

:root {
    --primary:       #2D7D46;
    --primary-dark:  #1f5c32;
    --primary-light: #e8f5ec;
    --text-on-primary: #ffffff;
    --sidebar-width: 240px;
    --header-height: 56px;
    --gray-100: #f8f9fa;
    --gray-200: #e9ecef;
    --gray-600: #6c757d;
    --danger:   #dc3545;
    --warning:  #ffc107;
    --success:  #198754;
    --info:     #0dcaf0;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 14px;
    background: var(--gray-100);
    color: #212529;
}

/* ── Login page ─────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
}

.login-card {
    background: #fff;
    border-radius: 12px;
    padding: 40px 36px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h1 {
    color: var(--primary);
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    letter-spacing: -0.5px;
}

.login-logo p {
    color: var(--gray-600);
    font-size: 12px;
    margin: 4px 0 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.login-card .form-label { font-weight: 500; }

.login-card .btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    width: 100%;
    padding: 10px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
}

.login-card .btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
}

/* ── Layout ─────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: #fff;
    border-right: 1px solid var(--gray-200);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
}

.sidebar-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    background: var(--primary);
}

.sidebar-header h1 {
    color: #fff;
    font-size: 20px;
    font-weight: 700;
    margin: 0;
}

.sidebar-header p {
    color: rgba(255,255,255,0.75);
    font-size: 11px;
    margin: 2px 0 0;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.sidebar-nav {
    padding: 12px 0;
    flex: 1;
    overflow-y: auto;
}

.nav-section-label {
    padding: 8px 20px 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gray-600);
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    text-decoration: none;
    color: #495057;
    font-weight: 500;
    border-left: 3px solid transparent;
    transition: all 0.15s;
}

.sidebar-nav a:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
}

.sidebar-nav a.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

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

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--gray-200);
}

.sidebar-footer form button {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 6px 14px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    transition: all 0.15s;
}

.sidebar-footer form button:hover {
    background: var(--danger);
    color: #fff;
}

/* Main content */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.topbar {
    background: #fff;
    border-bottom: 1px solid var(--gray-200);
    padding: 0 24px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left  { display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.topbar-title { font-size: 18px; font-weight: 600; color: #212529; }
.topbar-user  { font-size: 13px; color: var(--gray-600); }

.hamburger-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    width: 32px;
    height: 32px;
}
.hamburger-btn span {
    display: block;
    height: 2px;
    background: #212529;
    border-radius: 2px;
    transition: all 0.2s;
}

.topbar-logout-form { display: none; }
.topbar-logout-btn {
    background: none;
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 5px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    white-space: nowrap;
    transition: all 0.15s;
}
.topbar-logout-btn:hover { background: var(--danger); color: #fff; }

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}
.sidebar-backdrop.open { display: block; }

.content-area { padding: 24px; }

/* ── Stat Tiles ─────────────────────────────────────────── */
.tiles-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.tile {
    background: #fff;
    border-radius: 10px;
    padding: 20px 20px 16px;
    border: 1px solid var(--gray-200);
    text-decoration: none;
    color: inherit;
    display: block;
    transition: box-shadow 0.15s, transform 0.15s;
    position: relative;
    overflow: hidden;
}

.tile:hover {
    box-shadow: 0 4px 16px rgba(0,0,0,0.10);
    transform: translateY(-2px);
    text-decoration: none;
    color: inherit;
}

.tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: var(--primary);
}

.tile.tile-warning::before  { background: var(--warning); }
.tile.tile-danger::before   { background: var(--danger); }
.tile.tile-info::before     { background: var(--info); }
.tile.tile-success::before  { background: var(--success); }

.tile-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--gray-600);
    margin-bottom: 8px;
}

.tile-value {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
    margin-bottom: 6px;
}

.tile.tile-warning .tile-value  { color: #856404; }
.tile.tile-danger .tile-value   { color: var(--danger); }
.tile.tile-info .tile-value     { color: #0a7a95; }
.tile.tile-success .tile-value  { color: var(--success); }

.tile-sub {
    font-size: 12px;
    color: var(--gray-600);
}

/* ── Section Headers ─────────────────────────────────────── */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.section-title {
    font-size: 15px;
    font-weight: 600;
    color: #212529;
    margin: 0;
}

/* ── Month filter ─────────────────────────────────────────── */
.month-filter {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    padding: 6px 14px;
}

.month-filter label {
    font-size: 12px;
    font-weight: 600;
    color: var(--gray-600);
    margin: 0;
    white-space: nowrap;
}

.month-filter input[type="month"] {
    border: none;
    outline: none;
    font-size: 13px;
    cursor: pointer;
    background: transparent;
}

/* ── Cards ───────────────────────────────────────────────── */
.card {
    background: #fff;
    border-radius: 10px;
    border: 1px solid var(--gray-200);
    margin-bottom: 24px;
}

.card-header {
    padding: 14px 20px;
    border-bottom: 1px solid var(--gray-200);
    font-weight: 600;
    font-size: 14px;
    color: #212529;
}

.card-body { padding: 20px; }

/* ── Tables ──────────────────────────────────────────────── */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

thead th {
    background: var(--gray-100);
    padding: 10px 14px;
    text-align: left;
    font-weight: 600;
    color: var(--gray-600);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    border-bottom: 1px solid var(--gray-200);
}

tbody td {
    padding: 11px 14px;
    border-bottom: 1px solid var(--gray-200);
    vertical-align: middle;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-100); }

/* ── Badges ──────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.badge-active   { background: #d1fae5; color: #065f46; }
.badge-inactive { background: #fee2e2; color: #991b1b; }
.badge-expired  { background: #fef3c7; color: #92400e; }
.badge-none     { background: var(--gray-200); color: var(--gray-600); }
.badge-pending  { background: #ede9fe; color: #5b21b6; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 16px;
    border-radius: 7px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: all 0.15s;
    line-height: 1.4;
}

.btn-primary  { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); color: #fff; }

.btn-danger   { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover { background: #b02a37; border-color: #b02a37; color: #fff; }

.btn-outline  { background: #fff; color: #495057; border-color: var(--gray-200); }
.btn-outline:hover { background: var(--gray-100); color: #212529; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

/* ── Alert ───────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 13px;
    font-weight: 500;
}

.alert-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.alert-danger  { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* ── Institute detail ────────────────────────────────────── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
}

.info-item label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gray-600);
    display: block;
    margin-bottom: 3px;
}

.info-item span {
    font-size: 14px;
    color: #212529;
    font-weight: 500;
}

/* ── Edit plan inline form ───────────────────────────────── */
.plan-form input[type="text"],
.plan-form input[type="number"] {
    border: 1px solid var(--gray-200);
    border-radius: 6px;
    padding: 5px 10px;
    font-size: 13px;
    width: 100%;
    outline: none;
    transition: border-color 0.15s;
}

.plan-form input:focus { border-color: var(--primary); }

/* ── Modal ───────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

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

.modal-box {
    background: #fff;
    border-radius: 12px;
    max-width: 700px;
    width: 95%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}

.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; }

.modal-close {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: var(--gray-600);
    line-height: 1;
    padding: 0;
}

.modal-body { padding: 20px; overflow-y: auto; flex: 1; }

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .tiles-grid { grid-template-columns: repeat(2, 1fr); }
    .hamburger-btn { display: flex; }
    .topbar-logout-form { display: block; }
    .topbar-user { display: none; }
    .content-area { padding: 16px; }
    .topbar { padding: 0 16px; }
}
