/* ===================================================================
   ATF Juniors Chatbot — Admin Panel CSS
   Sprint 2 Session 9
   ===================================================================
   Brand: ATF primary #054a8b (deep navy), accent #064393, fill #b4d7f7
   Fonts: Open Sans (body) + Poppins (display) — self-hosted (HL/FU-011)
   No CDN — Capacitor Level-1 compliant.
   =================================================================== */


/* ============================================
   Self-hosted fonts (FU-011 resolved Session 9)
   ============================================ */

@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/open-sans/open-sans-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/open-sans/open-sans-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/open-sans/open-sans-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/open-sans/open-sans-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Open Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/open-sans/open-sans-700.woff2') format('woff2');
}

@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('../fonts/poppins/poppins-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poppins/poppins-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/poppins/poppins-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/poppins/poppins-600.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/poppins/poppins-700.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url('../fonts/poppins/poppins-800.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 900;
  font-display: swap;
  src: url('../fonts/poppins/poppins-900.woff2') format('woff2');
}


/* ============================================
   ATF brand tokens
   ============================================ */

:root {
  --primary:        #054a8b;  /* ATF deep navy */
  --primary-hover:  #064393;  /* slightly darker for hover states */
  --primary-shade:  #073f7c;  /* darkest navy for shadows / accents */
  --primary-light:  #b4d7f7;  /* light fill paired with primary text */

  --accent-success: #00d27a;
  --accent-danger:  #e63757;
  --accent-warning: #f5803e;

  --neutral-bg:     #f8f9fa;
  --neutral-fg:     #222;
  --neutral-muted:  #6c757d;
  --neutral-border: #e6e9ec;

  --sidebar-width:  260px;
  --topbar-height:  56px;

  --font-body:    'Open Sans', system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: 'Poppins', system-ui, -apple-system, "Segoe UI", sans-serif;
}


/* ============================================
   Base
   ============================================ */

html, body {
  font-family: var(--font-body);
  color: var(--neutral-fg);
  background: var(--neutral-bg);
  margin: 0;
  padding: 0;
  font-size: 14px;
}

h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--primary);
}

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


/* ============================================
   Login page (no sidebar/topbar)
   ============================================ */

.atf-login-wrap {
  min-height: 100dvh;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-shade) 100%);
  padding: 1rem;
}

.atf-login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.18);
  padding: 2.5rem 2.25rem;
  width: 100%;
  max-width: 420px;
}

.atf-login-card .atf-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}
.atf-login-card .atf-brand img {
  max-width: 140px;
  height: auto;
}
.atf-login-card h1 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.4rem;
  text-align: center;
  margin: 0 0 1.5rem;
}

.atf-login-card .form-control {
  font-size: 16px;  /* prevent iOS zoom on focus */
  padding: 0.6rem 0.75rem;
}

.atf-login-card .btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;                        /* explicit per S19 7/N — don't depend on Bootstrap's --bs-btn-color cascade */
  font-weight: 600;
  padding: 0.6rem;
  font-size: 1rem;
  width: 100%;
}
.atf-login-card .btn-primary:hover,
.atf-login-card .btn-primary:focus,
.atf-login-card .btn-primary:active {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;                        /* explicit on hover/focus/active too — keep white text contrast against the dark blue */
}


/* ============================================
   Sidebar
   ============================================ */

.atf-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-shade) 100%);
  color: #fff;
  overflow-y: auto;
  padding: 0;
  z-index: 1000;
}

.atf-sidebar .atf-sidebar-brand {
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.atf-sidebar .atf-sidebar-brand img {
  height: 40px;
  width: auto;
}
.atf-sidebar .atf-sidebar-brand .brand-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.1;
}
.atf-sidebar .atf-sidebar-brand .brand-subtitle {
  font-size: 0.72rem;
  opacity: 0.75;
}

.atf-sidebar .nav {
  padding: 0.75rem 0;
  list-style: none;
  margin: 0;
}
.atf-sidebar .nav-section {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.55);
  padding: 0.75rem 1.25rem 0.4rem;
  margin: 0;
}
.atf-sidebar .nav-link {
  color: rgba(255, 255, 255, 0.82);
  padding: 0.55rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-size: 0.9rem;
  font-weight: 500;
  border-left: 3px solid transparent;
}
.atf-sidebar .nav-link i {
  width: 18px;
  text-align: center;
  font-size: 0.95rem;
}
.atf-sidebar .nav-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
}
.atf-sidebar .nav-link.active {
  background: rgba(255, 255, 255, 0.1);
  border-left-color: var(--primary-light);
  color: #fff;
}


/* ============================================
   Topbar
   ============================================ */

.atf-topbar {
  position: fixed;
  top: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--topbar-height);
  background: #fff;
  border-bottom: 1px solid var(--neutral-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.5rem;
  z-index: 999;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}

.atf-topbar .topbar-left {
  /* hamburger + page title */
}

.atf-topbar .btn-sidebar-toggle {
  background: transparent;
  border: 1px solid var(--neutral-border);
  color: var(--neutral-muted);
  font-size: 1rem;
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.atf-topbar .btn-sidebar-toggle:hover,
.atf-topbar .btn-sidebar-toggle:focus {
  border-color: var(--primary);
  color: var(--primary);
  outline: none;
}

.atf-topbar .topbar-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--primary);
  margin: 0;
}

.atf-topbar .topbar-user {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.atf-topbar .topbar-user .user-name {
  font-weight: 600;
  font-size: 0.9rem;
}
.atf-topbar .topbar-user .user-role {
  font-size: 0.75rem;
  color: var(--neutral-muted);
}
.atf-topbar .topbar-user form {
  margin: 0;
}
.atf-topbar .topbar-user .btn-logout {
  background: transparent;
  border: 1px solid var(--neutral-border);
  color: var(--neutral-muted);
  font-size: 0.85rem;
  padding: 0.35rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
}
.atf-topbar .topbar-user .btn-logout:hover {
  border-color: var(--accent-danger);
  color: var(--accent-danger);
}


/* ============================================
   Main content
   ============================================ */

.atf-main {
  margin-left: var(--sidebar-width);
  margin-top: var(--topbar-height);
  padding: 1.5rem;
  min-height: calc(100dvh - var(--topbar-height));
  min-height: calc(100vh - var(--topbar-height));
}

.atf-page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.atf-page-header h1 {
  margin: 0;
  font-size: 1.5rem;
}

.atf-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--neutral-border);
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}

.atf-stat-card {
  background: #fff;
  border-radius: 10px;
  border: 1px solid var(--neutral-border);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.atf-stat-card .stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  background: var(--primary-light);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
}
.atf-stat-card .stat-value {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1;
}
.atf-stat-card .stat-label {
  font-size: 0.85rem;
  color: var(--neutral-muted);
}


/* ============================================
   Buttons / forms (override Bootstrap with brand)
   ============================================ */

.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
  color: #ffffff;                        /* S19 7/N — make white text contrast explicit; don't rely on Bootstrap 5.3's invisible --bs-btn-color cascade */
}
.btn-primary:hover, .btn-primary:focus, .btn-primary:active {
  background-color: var(--primary-hover);
  border-color: var(--primary-hover);
  color: #ffffff;                        /* keep white text on hover/focus/active states */
}

.form-control:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 0.18rem rgba(5, 74, 139, 0.15);
}

.alert-atf-error {
  background: #fff3f5;
  border: 1px solid #f5c6cb;
  color: #842029;
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}


/* ============================================
   Sidebar collapse — hamburger toggle (S14 polish)
   ============================================
   Single state model: `body.sidebar-collapsed` = sidebar hidden;
   no class = sidebar visible. JS in main.php applies the class on
   mobile (<992px) by default and toggles on hamburger click. Same
   CSS for desktop and mobile — viewport-detection lives in JS.
*/

.atf-sidebar,
.atf-topbar,
.atf-main {
  transition: transform 0.2s ease, left 0.2s ease, margin-left 0.2s ease;
}

body.sidebar-collapsed .atf-sidebar {
  transform: translateX(-100%);
}
body.sidebar-collapsed .atf-topbar {
  left: 0;
}
body.sidebar-collapsed .atf-main {
  margin-left: 0;
}
