/* public/css/style.css - Mobile-first responsive / fluid layout */

/* Tokens */
:root{
  --accent: #1f7adf;
  --muted: #6b7280;
  --bg: #f7fafc;
  --card: #ffffff;
  --shadow: 0 8px 28px rgba(15,23,42,0.06);
  --radius: 12px;
  --max-width: 1200px;
  --pad: 14px;
  --header-h: 64px;
  --sidebar-w: 240px;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
  color-scheme: light;
}

/* Reset + base */
*,*::before,*::after{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background:var(--bg);
  color:#111827;
  font-size:15px;
  line-height:1.45;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
}

/* Layout container */
.container{
  max-width:var(--max-width);
  margin:0 auto;
  padding:12px;
}

/* Topbar */
.topbar{
  background:var(--card);
  border-bottom:1px solid #e6e9ef;
  position:sticky; top:0; z-index:80;
  backdrop-filter:saturate(120%) blur(4px);
}
.topbar .topbar-inner{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 0;
}
.brand{display:flex;align-items:center;gap:12px}
.logo-circle{
  width:44px;height:44px;border-radius:10px;background:var(--accent);color:white;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:18px
}
.brand-text .brand-title{font-weight:600}
.brand-sub{color:var(--muted);font-size:13px}

/* Mobile toggle */
.mobile-toggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:0;
  background:transparent;
  font-size:22px;
  padding:8px;
  border-radius:8px;
  cursor:pointer;
}
.mobile-hide{display:none}

/* Top actions */
.top-actions{display:flex;align-items:center;gap:12px}
.quick-stats{color:var(--muted);font-size:13px;display:flex;gap:8px;align-items:center}
.quick-stats .sep{opacity:0.6}

/* Main layout - mobile first */
.app-main{display:block}
.sidebar{display:none}

/* Content */
.content-wrap{padding-top:12px}
.card{background:var(--card);padding:14px;border-radius:12px;box-shadow:var(--shadow);margin-bottom:14px}
.card-title{font-size:13px;color:var(--muted)}
.card-value{font-size:20px;font-weight:700;margin-top:8px}
.muted{color:var(--muted);font-size:13px}

/* Grids */
.card-grid{display:grid;grid-template-columns:repeat(1,1fr);gap:12px}
.two-grid{display:grid;grid-template-columns:1fr;gap:12px}

/* Table */
.table{width:100%;border-collapse:collapse;font-size:14px;min-width:500px}
.table th,.table td{padding:10px;border-top:1px solid #f1f5f9;text-align:left}
.table thead th{color:var(--muted);font-size:13px}
.table-responsive{overflow:auto;-webkit-overflow-scrolling:touch}

/* Sidebar (mobile offcanvas) */
.sidebar{
  position:fixed;
  left:0;
  top:0;
  height:100vh;
  width:var(--sidebar-w);
  background:var(--card);
  border-right:1px solid #eef2f7;
  padding:18px;
  transform:translateX(-120%);
  transition:transform .25s ease,opacity .25s ease;
  z-index:120;
  box-shadow:2px 6px 30px rgba(6,10,20,0.12);
  overflow:auto;
}
.sidebar.open{transform:translateX(0)}
.sidebar-brand{display:flex;align-items:center;gap:12px;margin-bottom:12px}
.sidebar-link{padding:10px;border-radius:8px;color:#374151;text-decoration:none;font-size:14px;display:flex;align-items:center;gap:10px}
.sidebar-link:hover{background:rgba(31,122,223,0.06);color:var(--accent)}

/* Buttons */
.btn-primary{background:var(--accent);color:#fff;padding:10px;border-radius:8px;border:none;cursor:pointer}
.btn-ghost{border:1px solid #e6e9ef;padding:8px 10px;border-radius:8px;background:white;color:var(--muted);text-decoration:none;display:inline-block}

/* Utilities */
.mt-2{margin-top:8px}
.mt-3{margin-top:12px}
.mt-4{margin-top:16px}
.mt-6{margin-top:24px}
.w-full{width:100%}

/* Desktop & tablet breakpoints */
@media (min-width:720px){
  .container{padding-left:16px;padding-right:16px}
  .app-main{display:flex;gap:20px;align-items:flex-start}
  .sidebar{position:sticky;transform:none;display:block;top:76px;height:calc(100vh - 96px);width:var(--sidebar-w)}
  .content-wrap{flex:1}
  .card-grid{grid-template-columns:repeat(2,1fr)}
  .two-grid{grid-template-columns:repeat(2,1fr)}
  .mobile-hide{display:inline-block}
  .table{min-width:0}
  .mobile-toggle{display:none}
}

/* Larger desktop */
@media (min-width:1000px){
  .card-grid{grid-template-columns:repeat(3,1fr)}
}
@media (min-width:1300px){
  :root{--max-width:1400px}
  .card-grid{grid-template-columns:repeat(4,1fr)}
  .logo-circle{width:52px;height:52px}
}

/* Small screens accessibility */
@media (max-width:420px){
  body{font-size:14px}
  .card-value{font-size:18px}
  .logo-circle{width:38px;height:38px}
}

/* Prevent layout overflow helpers */
img,video,canvas,svg{max-width:100%;height:auto;display:block}
.table td, .table th { word-break:break-word }

/* Truncate helper */
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width:220px; display:inline-block; vertical-align:middle; }

/* No-footer (explicit) */
.footer{display:none}
/* -------------------------
   Login / Auth specific
   ------------------------- */

/* Layout for auth page - full screen center */
.page-auth { min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; }

/* Main auth container - on large screens show card + aside */
.auth-center { width:100%; max-width:1100px; display:flex; gap:20px; align-items:stretch; justify-content:center; }

/* Card surface overrides */
.auth-surface { flex:1 1 480px; display:flex; flex-direction:column; padding:22px; border-radius:16px; box-shadow: 0 10px 40px rgba(13,20,30,0.08); background: linear-gradient(180deg, rgba(255,255,255,0.98), #ffffff); }

/* Brand area tweaks */
.logo-large { width:64px; height:64px; border-radius:14px; font-size:24px; display:flex; align-items:center; justify-content:center; background:linear-gradient(135deg,var(--accent), #1a6fc0); color:#fff; box-shadow: 0 6px 18px rgba(31,122,223,0.12); }
.auth-surface .brand { display:flex; align-items:center; gap:14px; margin-bottom:10px; }

/* Flash styles - nicer look */
.flash { margin-top:12px; padding:12px; border-radius:10px; font-size:14px; }
.flash-error { background:#fff6f6; border:1px solid #ffd6d6; color:#6b1b1b; }
.flash-success { background:#f6fffa; border:1px solid #dff8e8; color:#074b2e; }

/* Form */
.auth-form { margin-top:12px; width:100%; }
.field { margin-bottom:10px; }
.label { display:block; font-weight:600; margin-bottom:6px; font-size:14px; color:#0f1724; }
.input { width:100%; padding:12px 12px; border-radius:10px; border:1px solid #e6ecf5; background:transparent; font-size:15px; transition:box-shadow .15s ease, border-color .15s ease; }
.input:focus { outline:none; box-shadow:0 6px 20px rgba(31,122,223,0.08); border-color:var(--accent); }
.input-error { border-color:#ffb3b3 !important; box-shadow:0 6px 20px rgba(255, 150, 150, 0.06); }

/* Input group (password + toggle) */
.input-group { display:flex; gap:8px; align-items:center; }
.btn-inline { padding:8px 10px; font-size:13px; border-radius:10px; border:1px solid #e6e9ef; background:transparent; cursor:pointer; }
.btn-inline:active { transform:translateY(1px); }

/* small utilities used in form */
.form-row { display:flex; align-items:center; justify-content:flex-start; gap:12px; }
.form-row.between { justify-content:space-between; }
.checkbox input { margin-right:8px; transform:translateY(1px); }
.field-help { font-size:12px; color:var(--muted); margin-top:6px; }

/* Aside / promotional panel */
.auth-aside { display:none; flex-basis:360px; align-self:center; text-align:left; }
.auth-hero { padding:22px; border-radius:12px; background:linear-gradient(180deg, rgba(31,122,223,0.06), rgba(31,122,223,0.02)); }
.auth-hero h2 { margin:0 0 8px 0; font-size:20px; }
.auth-hero p { margin:0; color:var(--muted); }

/* small screens: center only card */
@media (max-width:719px) {
  .auth-center { max-width:480px; flex-direction:column; align-items:stretch; }
  .auth-surface { padding:18px; border-radius:14px; }
  .logo-large { width:56px; height:56px; font-size:20px; }
}

/* medium+ screens: show aside */
@media (min-width:720px) {
  .auth-aside { display:block; flex:0 0 360px; }
  .auth-center { align-items:stretch; }
}

/* accessibility & small improvements */
.center { text-align:center; }
.small { font-size:13px; }
.muted { color:var(--muted); }

/* code element in demo */
.auth-surface code { background:#f6f8fb; padding:4px 6px; border-radius:6px; font-size:13px; }

/* ensure full width button on small viewport, nice corner radius */
.btn-primary { padding:12px; border-radius:10px; font-weight:600; font-size:15px; }
/* -------------------------
   Topbar / Header styling
   Append to public/css/style.css
   ------------------------- */

/* Vibrant topbar theme */
.topbar--vibrant {
  background: linear-gradient(90deg, rgba(31,122,223,1), rgba(29,155,145,1));
  color: #ffffff;
  border-bottom: 0;
  box-shadow: 0 8px 30px rgba(8,20,40,0.12);
}

/* topbar layout */
.topbar .topbar-inner {
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:10px 12px;
}

/* brand area */
.topbar .brand { display:flex; align-items:center; gap:12px; min-width:0; }
.topbar .logo-circle {
  width:44px;
  height:44px;
  border-radius:10px;
  background: rgba(255,255,255,0.15);
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:700;
  font-size:18px;
  box-shadow: none;
  flex-shrink:0;
}
.topbar .brand-text .brand-title { color: #fff; font-weight:700; font-size:16px; }
.topbar .brand-text .brand-sub { color: rgba(255,255,255,0.85); font-size:13px; }

/* right side wrapper */
.topbar-right { display:flex; align-items:center; gap:12px; margin-left:auto; width:auto; }

/* quick stats - less prominent on small screens */
.quick-stats { color: rgba(255,255,255,0.95); font-size:13px; display:flex; gap:8px; align-items:center; margin-right:6px; }
.quick-stats .stat strong { color:#fff; font-weight:700; }
.quick-stats .sep { opacity:0.85; }

/* Top actions / user actions */
.top-actions { display:flex; align-items:center; gap:12px; }
.user-actions .user-name { color:#fff; font-weight:600; }
.user-actions .user-role { color:rgba(255,255,255,0.9); }

/* Buttons contrast on vibrant bar */
.btn-ghost {
  border:1px solid rgba(255,255,255,0.18);
  color:#fff;
  background: transparent;
  padding:8px 10px;
  border-radius:8px;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  gap:8px;
}
.btn-ghost:hover { background: rgba(255,255,255,0.06); transform:translateY(-1px); }

/* Mobile toggle (always visible on narrow screens) */
.mobile-toggle {
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:0;
  background:transparent;
  color:#fff;
  font-size:20px;
  padding:8px;
  border-radius:8px;
  cursor:pointer;
  margin-right:6px;
  flex-shrink:0;
}
.mobile-hide { display:none; }

/* ensure topbar elements don't overflow */
.topbar .muted, .topbar .small { color: rgba(255,255,255,0.92) }

/* Desktop layout */
@media (min-width:720px) {
  .container { display:flex; align-items:center; gap:12px; }
  .mobile-toggle { display:none; } /* hide toggle on larger screens */
  .mobile-hide { display:inline-block; }
  .topbar .topbar-inner { padding:12px 18px; }
  .logo-circle { width:52px; height:52px; font-size:20px; border-radius:12px; }
  .quick-stats { display:flex; }
}

/* Small screens: stacked layout and hidden stats */
@media (max-width:719px) {
  .topbar .topbar-inner { padding:10px; }
  .brand-text .brand-title { font-size:15px; }
  .brand-sub { display:none; } /* hide subtitle on very small */
  .quick-stats { display:none; } /* hide stats to save space */
  .topbar .brand { gap:10px; }
  .topbar-right { gap:6px; }
}

/* Accessibility focus outlines */
.mobile-toggle:focus, .btn-ghost:focus, .mobile-toggle:active { outline: 3px solid rgba(255,255,255,0.14); outline-offset:2px; }

/* Sidebar open state harmony */
.sidebar.open { transform: translateX(0); } /* you already used this */
@media (min-width:720px) {
  .sidebar { transform: none; } /* ensure desktop shows sidebar */
}

/* Dark/light fallback: if this topbar placed on light bg – ensure contrast */
.topbar--vibrant a, .topbar--vibrant .brand-title, .topbar--vibrant .user-name { color: #fff; }

/* Minor responsive tweaks */
@media (max-width:420px) {
  .logo-circle { width:40px; height:40px; font-size:16px; }
  .btn-ghost { padding:6px 8px; font-size:13px; }
}
