/* ============================================================
   Rivalry – Admin Stylesheet  v2
   ============================================================ */

:root {
    --primary:        #1a3c5e;
    --primary-light:  #2563a8;
    --primary-dark:   #122b44;
    --accent:         #e8a020;
    --accent-dark:    #c8881a;
    --success:        #16a34a;
    --danger:         #dc2626;
    --warning:        #d97706;
    --info:           #0891b2;
    --bg:             #eef1f8;
    --card-bg:        #ffffff;
    --text:           #1e1e2e;
    --muted:          #6b7280;
    --border:         #dde3ee;
    --sidebar-w:      252px;
    --topbar-h:       62px;
    --radius:         12px;
    --radius-sm:      8px;
    --shadow:         0 2px 16px rgba(0,0,0,.07);
    --shadow-md:      0 4px 24px rgba(0,0,0,.12);
    --transition:     .2s ease;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.65; }
a { color: var(--primary-light); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent); }
img { max-width: 100%; }
/* scrollbars hidden everywhere; scrolling still works */
* { scrollbar-width: none; -ms-overflow-style: none; }
*::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* ── Topbar ── */
.admin-topbar {
    position: fixed; top: 0; left: var(--sidebar-w); right: 0;
    height: var(--topbar-h);
    background: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 1.5rem;
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 8px rgba(0,0,0,.06);
    z-index: 100;
}
.page-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.topbar-right { display: flex; align-items: center; gap: 1rem; }
.topbar-notif { position: relative; color: var(--muted); font-size: 1.2rem; cursor: pointer; padding: .3rem; }
.topbar-notif .badge { position: absolute; top: -4px; right: -4px; background: var(--danger); color: #fff; border-radius: 50%; width: 17px; height: 17px; font-size: .65rem; display: flex; align-items: center; justify-content: center; border: 2px solid #fff; font-weight: 700; }
.admin-avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--primary), var(--primary-light)); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1rem; cursor: pointer; }

/* ── Sidebar ── */
.admin-sidebar {
    position: fixed; top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
    display: flex; flex-direction: column;
    z-index: 200; overflow-y: auto;
    transition: transform .28s ease;
}
.sidebar-brand {
    padding: 1.2rem 1.5rem 1.1rem;
    display: flex; align-items: center; gap: .6rem;
    color: #fff; font-size: 1.25rem; font-weight: 800; letter-spacing: 1px;
    border-bottom: 1px solid rgba(255,255,255,.1);
    flex-shrink: 0;
}
.sidebar-brand .brand-text span { color: var(--accent); }
.sidebar-brand .role-pill { font-size: .62rem; background: var(--accent); color: #fff; padding: .12rem .55rem; border-radius: 10px; font-weight: 700; margin-left: auto; text-transform: uppercase; letter-spacing: .3px; }

.sidebar-menu { flex: 1; padding: .8rem 0; }
.menu-label { font-size: .68rem; font-weight: 800; letter-spacing: 1.2px; color: #475569; text-transform: uppercase; padding: .9rem 1.4rem .3rem; }
.sidebar-menu a {
    display: flex; align-items: center; gap: .75rem;
    padding: .58rem 1.4rem; color: #94a3b8; font-size: .88rem;
    transition: all var(--transition);
    border-left: 3px solid transparent;
}
.sidebar-menu a:hover, .sidebar-menu a.active { background: rgba(255,255,255,.08); color: #fff; border-left-color: var(--accent); }
.sidebar-menu a .icon { width: 18px; font-size: .95rem; text-align: center; flex-shrink: 0; }
.sidebar-menu a .count { margin-left: auto; background: var(--danger); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: .7rem; font-weight: 700; }
.sidebar-menu a .count-accent { margin-left: auto; background: var(--accent); color: #fff; border-radius: 10px; padding: 1px 7px; font-size: .7rem; font-weight: 700; }

.sidebar-footer { padding: 1rem 1.4rem; border-top: 1px solid rgba(255,255,255,.1); display: flex; flex-direction: column; gap: .3rem; flex-shrink: 0; }
.sidebar-footer a { color: #94a3b8; font-size: .86rem; display: flex; align-items: center; gap: .6rem; padding: .4rem .2rem; border-radius: 6px; transition: color var(--transition); }
.sidebar-footer a:hover { color: #fff; }

/* ── Main ── */
.admin-main { margin-left: var(--sidebar-w); padding-top: var(--topbar-h); min-height: 100vh; }
.admin-content { padding: 1.8rem; }
.admin-page-title { font-size: 1.3rem; font-weight: 800; color: var(--primary); margin-bottom: 1.5rem; display: flex; align-items: center; gap: .6rem; }

/* ── Cards ── */
.card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 1.5rem; overflow: hidden; }
.card-header { padding: 1rem 1.5rem; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(135deg, #fafbff, #f0f4fb); font-weight: 700; font-size: .96rem; }
.card-body { padding: 1.5rem; }
.card-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); background: #fafbff; }

/* ── Stats ── */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px,1fr)); gap: 1.2rem; margin-bottom: 1.8rem; }
.stat-card { background: var(--card-bg); border-radius: var(--radius); padding: 1.3rem 1.5rem; box-shadow: var(--shadow); display: flex; align-items: center; gap: 1.1rem; border-left: 4px solid var(--primary-light); transition: transform var(--transition), box-shadow var(--transition); }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card.accent  { border-color: var(--accent); }
.stat-card.success { border-color: var(--success); }
.stat-card.danger  { border-color: var(--danger); }
.stat-card.warning { border-color: var(--warning); }
.stat-card.info    { border-color: var(--info); }
.stat-icon { font-size: 2.2rem; flex-shrink: 0; }
.stat-value { font-size: 1.85rem; font-weight: 900; line-height: 1; }
.stat-label { font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; margin-top: .25rem; }

/* ── Tables ── */
.table-responsive { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
thead th { background: #f1f4fb; color: var(--primary); padding: .75rem 1rem; text-align: left; font-weight: 700; font-size: .81rem; letter-spacing: .3px; border-bottom: 2px solid var(--border); white-space: nowrap; }
tbody td { padding: .7rem 1rem; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8faff; }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; gap: .28rem; padding: .22rem .7rem; border-radius: 20px; font-size: .75rem; font-weight: 700; }
.badge-active    { background: #dbeafe; color: #1d4ed8; }
.badge-disabled  { background: #f3f4f6; color: #6b7280; }
.badge-paid      { background: #dcfce7; color: #15803d; }
.badge-unpaid    { background: #fee2e2; color: #b91c1c; }
.badge-admin     { background: #ede9fe; color: #6d28d9; }
.badge-super     { background: #fef9c3; color: #92400e; }
.badge-draft     { background: #f3f4f6; color: #374151; }
.badge-published { background: #dcfce7; color: #15803d; }
.badge-pending   { background: #fef9c3; color: #92400e; }
.badge-approved  { background: #dcfce7; color: #15803d; }
.badge-rejected  { background: #fee2e2; color: #b91c1c; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: .4rem; padding: .48rem 1.2rem; border-radius: var(--radius-sm); font-size: .9rem; font-weight: 700; cursor: pointer; border: 2px solid transparent; transition: all var(--transition); white-space: nowrap; text-decoration: none; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,.13); text-decoration: none; }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--primary-light); color: #fff; border-color: var(--primary-light); }
.btn-primary:hover { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-accent  { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-accent:hover { background: var(--accent-dark); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; color: #fff; }
.btn-danger  { background: var(--danger);  color: #fff; }
.btn-danger:hover  { background: #b91c1c; color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-info    { background: var(--info);    color: #fff; }
.btn-outline { background: transparent; border-color: var(--primary-light); color: var(--primary-light); }
.btn-outline:hover { background: var(--primary-light); color: #fff; }
.btn-muted   { background: #e5e7eb; color: #9ca3af; cursor: not-allowed; pointer-events: none; border-color: #e5e7eb; }
.btn-sm  { padding: .3rem .85rem;  font-size: .82rem; border-radius: 6px; }
.btn-xs  { padding: .2rem .6rem;   font-size: .76rem; border-radius: 5px; }
.btn-icon{ padding: .4rem .55rem; }
.btn-block { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group  { margin-bottom: 1.1rem; }
.form-label  { display: block; font-weight: 600; font-size: .85rem; color: #374151; margin-bottom: .38rem; }
.form-control { width: 100%; padding: .56rem .95rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm); font-size: .93rem; font-family: inherit; background: #fff; color: var(--text); transition: border-color var(--transition), box-shadow var(--transition); }
.form-control:focus { outline: none; border-color: var(--primary-light); box-shadow: 0 0 0 3px rgba(37,99,168,.12); }
.form-control:disabled { background: #f9fafb; color: var(--muted); }
textarea.form-control { resize: vertical; min-height: 110px; }
.form-hint { font-size: .79rem; color: var(--muted); margin-top: .3rem; }

/* ── Alerts ── */
.alert { padding: .88rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-size: .9rem; display: flex; align-items: flex-start; gap: .6rem; border-left: 4px solid; }
.alert-success { background: #f0fdf4; border-color: var(--success); color: #15803d; }
.alert-danger  { background: #fef2f2; border-color: var(--danger);  color: #b91c1c; }
.alert-info    { background: #f0f9ff; border-color: var(--info);    color: #0369a1; }
.alert-warning { background: #fffbeb; border-color: var(--warning); color: #92400e; }

/* ── Modals ── */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 900; align-items: center; justify-content: center; padding: 1rem; backdrop-filter: blur(2px); }
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: var(--radius); width: 100%; max-width: 520px; box-shadow: 0 10px 50px rgba(0,0,0,.25); animation: modalIn .2s ease; }
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header { padding: 1.1rem 1.5rem; border-bottom: 1px solid var(--border); font-weight: 700; display: flex; justify-content: space-between; align-items: center; }
.modal-body   { padding: 1.5rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .7rem; background: #fafbff; border-radius: 0 0 var(--radius) var(--radius); }
.modal-close  { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--muted); }
.modal-close:hover { color: var(--danger); }

/* ── Chat (admin side) ── */
.chat-list-item { display: flex; align-items: center; gap: .9rem; padding: .9rem 1.2rem; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--transition); }
.chat-list-item:hover { background: #f5f8ff; }
.chat-list-item.active { background: #eff6ff; border-left: 3px solid var(--primary-light); }
.chat-list-item .avatar { width: 42px; height: 42px; border-radius: 50%; background: var(--primary-light); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.1rem; flex-shrink: 0; }
.chat-panel { display: flex; flex-direction: column; height: 520px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chat-panel-header { background: var(--primary); color: #fff; padding: .85rem 1.2rem; display: flex; align-items: center; gap: .8rem; flex-shrink: 0; }
.chat-panel-messages { flex: 1; overflow-y: auto; padding: 1rem; background: #f8faff; display: flex; flex-direction: column; gap: .6rem; }
.chat-bubble { max-width: 78%; padding: .55rem .95rem; border-radius: 18px; font-size: .88rem; line-height: 1.5; word-break: break-word; }
.chat-bubble.from-user  { background: #fff; color: var(--text); align-self: flex-start; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-bubble.from-admin { background: var(--primary); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.chat-bubble .bubble-time { font-size: .68rem; opacity: .6; margin-top: .2rem; }
.chat-panel-input { padding: .75rem; border-top: 1px solid var(--border); display: flex; gap: .5rem; background: #fff; flex-shrink: 0; }
.chat-panel-input input { flex: 1; padding: .5rem .9rem; border: 1.5px solid var(--border); border-radius: 20px; font-family: inherit; font-size: .9rem; outline: none; }
.chat-panel-input input:focus { border-color: var(--primary-light); }
.chat-send-btn { width: 38px; height: 38px; border-radius: 50%; background: var(--primary); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background var(--transition); flex-shrink: 0; }
.chat-send-btn:hover { background: var(--primary-light); }

/* ── Responsive ── */
@media (max-width: 900px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); box-shadow: 4px 0 30px rgba(0,0,0,.3); }
    .admin-main { margin-left: 0; }
    .admin-topbar { left: 0; }
    #sidebarToggleBtn { display: inline-flex !important; }
}
@media (max-width: 600px) {
    .admin-content { padding: 1rem; }
    .stat-grid { grid-template-columns: 1fr 1fr; }
}


/* ============================================================
   v3 layout: dark header with a white hamburger, independent scrolling
   ============================================================ */
.admin-topbar {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 100%);
    border-bottom: 0; box-shadow: 0 2px 12px rgba(0,0,0,.3);
    left: 0; z-index: 300;
}
.topbar-left { display: flex; align-items: center; gap: .8rem; min-width: 0; }
.page-title { color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hamburger {
    display: inline-flex; align-items: center; justify-content: center; width: 42px; height: 42px;
    border-radius: 10px; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
    color: #fff; font-size: 1.25rem; cursor: pointer; flex-shrink: 0; transition: background var(--transition);
}
.hamburger:hover { background: rgba(255,255,255,.22); }
.hamburger i { color: #fff; }
.topbar-notif { color: #fff; }
.topbar-notif .badge { border-color: var(--primary); }
.topbar-user { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; }
.topbar-user:hover { color: #fff; }
.tu-name { font-weight: 700; font-size: .88rem; line-height: 1.2; }
.tu-role { font-size: .75rem; color: #cbd5e1; }
.admin-avatar { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); }
.btn-light { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.3); }
.btn-light:hover { background: rgba(255,255,255,.26); color: #fff; }

/* sidebar sits under the header; both scroll on their own, scrollbars hidden,
   and the sidebar only scrolls when its content does not fit */
.admin-sidebar {
    top: var(--topbar-h); z-index: 250;
    overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain;
    scrollbar-width: none; -ms-overflow-style: none;
}
.admin-sidebar::-webkit-scrollbar { display: none; width: 0; height: 0; }
.sidebar-brand { padding: 1rem 1.5rem; }
.sidebar-menu { flex: 0 0 auto; }
.admin-main { transition: margin-left .28s ease; }
body.sidebar-collapsed .admin-sidebar { transform: translateX(-100%); }
body.sidebar-collapsed .admin-main { margin-left: 0; }
.admin-overlay { display: none; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,.45); z-index: 240; }
.admin-overlay.show { display: block; }
.admin-main { display: flex; flex-direction: column; min-height: 100vh; }
.admin-content { flex: 1; min-width: 0; }
.admin-footer { padding: 1rem 1.5rem; text-align: center; font-size: .85rem; background: linear-gradient(135deg, var(--primary-dark), var(--primary)); color: #cbd5e1; }
.admin-footer span { color: var(--accent); font-weight: 700; }
.sidebar-menu a .count { background: var(--danger); }
@media (max-width: 900px) {
    .admin-sidebar { transform: translateX(-100%); }
    .admin-sidebar.open { transform: translateX(0); }
    body.sidebar-collapsed .admin-sidebar.open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    #sidebarToggleBtn { display: inline-flex !important; }
}
@media (max-width: 600px) { .hide-sm { display: none; } }

/* extra components */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
@media (max-width: 700px) { .form-row, .form-row-3 { grid-template-columns: 1fr; } }
.table-responsive, .table-wrap { overflow-x: auto; }
.report-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.2rem; margin-bottom: 1.5rem; }
.bar { height: 8px; border-radius: 6px; background: #e5e7eb; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--success); border-radius: 6px; }
.stat-icon i { color: var(--primary-light); }
.stat-card.success .stat-icon i { color: var(--success); }
.stat-card.danger .stat-icon i { color: var(--danger); }
.stat-card.accent .stat-icon i { color: var(--accent); }
.stat-card.warning .stat-icon i { color: var(--warning); }
.stat-card.info .stat-icon i { color: var(--info); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; letter-spacing: .5px; }

/* hamburger drawn with CSS so it stays visible even if the icon font is blocked */
.hamburger .hb, .hamburger .hb::before, .hamburger .hb::after { display:block; width:20px; height:2px; background:#fff; border-radius:2px; }
.hamburger .hb { position:relative; }
.hamburger .hb::before, .hamburger .hb::after { content:''; position:absolute; left:0; }
.hamburger .hb::before { top:-6px; } .hamburger .hb::after { top:6px; }
.navbar-brand { display:inline-block; }
.navbar-brand .brand-text span { color: var(--accent); }

.sidebar-brand .brand-text { color:#fff; } .sidebar-brand .brand-text span { color: var(--accent); }
.sidebar-brand { gap:.6rem; }

/* Logout: top bar on desktop, sidebar on phones/tablets */
.sidebar-logout { display: none; }
@media (max-width: 900px) {
  .topbar-logout { display: none !important; }
  .sidebar-logout { display: flex; align-items: center; gap: .7rem; margin: 1rem .8rem 1.4rem; padding: .7rem .9rem; border-radius: 8px;
    color: #fff; background: rgba(255,255,255,.08); text-decoration: none; font-weight: 600; }
  .sidebar-logout:hover { background: rgba(255,255,255,.16); }
  .sidebar-logout .icon { width: 1.2rem; text-align: center; }
}


/* Keep the admin footer (dashboard) at the bottom of short pages */
.admin-main > .admin-content { flex: 1 0 auto; width: 100%; min-width: 0; }
.admin-footer { margin-top: auto; flex-shrink: 0; }

/* centered form-style pages */
.narrow { width: 100%; margin-left: auto; margin-right: auto; }
