/* CaptainsLog — Aquamarine + Sandy beach theme */

/* ---------- Palette ---------- */
:root{
  --sand:#efe6d8;
  --brand:#044078;
  --brand-600:#044078;
  --brand-800:#020b70;
  --panel:#ffffff;
  --text:#1f3340;
  --muted:#6b8a99;
  --border:#EADBC3;
  --green:#4a6ff4;
  --z-sidebar:2000;
  --z-backdrop:1500;
}

/* ---------- Custom Scrollbars ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(148, 163, 184, 0.4); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(148, 163, 184, 0.6); }
/* Firefox */
* { scrollbar-width: thin; scrollbar-color: rgba(148, 163, 184, 0.4) transparent; }

/* ---------- Base ---------- */
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0; background:var(--sand); color:var(--text);
  font:14px/1.5 system-ui,-apple-system,Segoe UI,Roboto,Inter,Arial,sans-serif;
}
a{color:#1d4ed8;text-decoration:none}
a:hover{text-decoration:underline}
.muted{color:var(--muted)}

/* ---------- Topbar ---------- */
.topbar{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  padding:10px 16px;background:rgba(255,255,255,0.9);
  border-bottom:1px solid var(--border); backdrop-filter:saturate(160%) blur(6px);
  position: relative; z-index: 1000;
}
.logo-wrap{display:flex;align-items:center;gap:10px}
.brand-logo{height:6em;display:block}
@media (max-width:480px){.brand-logo{height: 6em;}}

/* ---------- Layout ---------- */
/* Grid: Sidebar (260px) | Content (1fr) */
.layout{display:grid;grid-template-columns:260px 1fr;min-height:calc(100vh - 58px)}
.sidebar{background:linear-gradient(180deg,var(--brand-600),var(--brand));color:#fff;padding:8px 8px 12px}

/* This padding now applies to the wrapper we added in index.php */
.content{padding:0px}

.sidebar nav a,.sidebar .group-trigger{
  display:flex;align-items:center;gap:12px;
  padding:12px 14px;margin:;border-radius:10px;min-height:44px;line-height:1.2;
  color:#fff;font-weight:600;box-sizing:border-box; border:none; background:transparent; width:100%; text-align:left; cursor:pointer;
}
.sidebar a.active,.group[aria-expanded="true"] .group-trigger{background:rgba(255,255,255,.16)}
.sidebar a:hover,.sidebar .group-trigger:hover{background:rgba(255,255,255,.22)}

/* ---------- Panels ---------- */
.panel{
  background:var(--panel);border:0px solid var(--border);border-radius:0px;
  padding:16px;margin: 0px;box-shadow:0 1px 2px rgba(0,0,0,.02);
}

/* ---------- Buttons / Inputs ---------- */
.btn{display:inline-block;background:var(--brand);color:#fff;padding:8px 12px;border-radius:10px;border:none;cursor:pointer}
.btn:hover{background:var(--brand-600)}

label{display:block;font-weight:700;color:var(--brand-800);margin:0 0 6px}
.input{
  width:100%;padding:12px;border:1.5px solid var(--border);border-radius:12px;background:#fff;color:var(--text);
}

/* Sidebar Icons */
.sidebar .ico, .sidebar svg, .sidebar span.ico {
    color: #ffffff !important;
    fill: #ffffff !important;
    opacity: 1;
}

/* --- MOBILE NAVIGATION LOGIC --- */
/* 1. Hide Toggle on Desktop */
.nav-toggle {
  display: none;
  border: 0; background: transparent; cursor: pointer; padding: 10px;
}

/* 2. Mobile Logic (< 960px) */
@media (max-width: 960px) {
  .nav-toggle { display: block; }
  
  /* Disable Grid so sidebar floats freely */
  .layout { display: block; }

  .sidebar {
    position: fixed;
    top: 0; 
    left: 0; 
    bottom: 0;
    width: 280px;
    z-index: var(--z-sidebar); /* 2000 */
    background: linear-gradient(180deg, var(--brand-600), var(--brand));
    transform: translateX(-100%);
    transition: transform 0.3s ease-in-out;
    box-shadow: 10px 0 30px rgba(0,0,0,0.3);
  }

  .sidebar.open {
    transform: translateX(0);
  }
  
  .mobile-close-btn { display: block !important; }
}

/* ---------- Shared Form Styles ---------- */
/* Reusable input used across modals/forms (replaces inline style="width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:6px") */
.form-input{
  width:100%;padding:10px;border:1px solid #e2e8f0;border-radius:6px;
  font-size:13px;background:#fff;color:var(--text);box-sizing:border-box;
}
.form-input:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 2px rgba(59,130,246,.15)}

/* Small label above form fields */
.form-label{
  display:block;font-size:11px;font-weight:700;color:#64748b;
  margin-bottom:4px;text-transform:uppercase;
}

/* ---------- Grid Helpers ---------- */
.row{display:flex;flex-wrap:wrap;gap:16px}
.col-4{flex:0 0 calc(33.333% - 11px);min-width:0}
.col-6{flex:0 0 calc(50% - 8px);min-width:0}
.col-8{flex:0 0 calc(66.666% - 5px);min-width:0}
.edit-grid{display:grid;grid-template-columns:1fr 1fr;gap:16px}
.edit-grid .span-2{grid-column:span 2}

@media(max-width:640px){
  .col-4,.col-6,.col-8{flex:0 0 100%}
  .edit-grid{grid-template-columns:1fr}
  .edit-grid .span-2{grid-column:span 1}
}

/* ---------- Page Header ---------- */
.panel-header{
  display:flex;justify-content:space-between;align-items:center;
  flex-wrap:wrap;gap:12px;margin-bottom:16px;
}

/* ---------- Shared Modal ---------- */
.modal-overlay{
  display:none;position:fixed;inset:0;
  background:rgba(0,0,0,0.6);z-index:9999;
  align-items:center;justify-content:center;padding:20px;
}
.modal-overlay.show,.modal-overlay.popup-active{display:flex}
.modal-content{
  background:#fff;border-radius:16px;width:100%;max-width:500px;
  box-shadow:0 20px 40px rgba(0,0,0,0.2);max-height:calc(100vh - 40px);overflow-y:auto;
}
.modal-header{
  display:flex;justify-content:space-between;align-items:center;
  padding:20px 24px;border-bottom:1px solid #e2e8f0;
  position:sticky;top:0;background:#fff;z-index:10;border-radius:16px 16px 0 0;
}
.modal-header h2,.modal-header h3{margin:0;font-size:18px}
.modal-close{background:none;border:none;font-size:24px;cursor:pointer;color:#94a3b8;padding:0;line-height:1}
.modal-body{padding:24px}
.modal-footer{
  padding:16px 24px;border-top:1px solid #e2e8f0;
  display:flex;justify-content:flex-end;gap:8px;
}

@media(max-width:640px){
  .modal-overlay{padding:8px}
  .modal-content{margin:0 auto;max-height:calc(100vh - 16px);border-radius:12px}
  .modal-header{border-radius:12px 12px 0 0;padding:16px}
  .modal-body{padding:12px}
  .modal-footer{padding:12px 16px}
}

/* ---------- Toast Notifications ---------- */
.toast-container{position:fixed;top:20px;right:20px;z-index:10000;display:flex;flex-direction:column;gap:10px}
.toast{
  padding:12px 20px;border-radius:8px;color:#fff;font-size:13px;font-weight:500;
  box-shadow:0 4px 12px rgba(0,0,0,0.15);animation:toastSlideIn .3s ease;max-width:350px;
}
.toast.success{background:#10b981}
.toast.error{background:#ef4444}
.toast.info{background:#3b82f6}
.toast.warning{background:#f59e0b}
@keyframes toastSlideIn{from{transform:translateX(100%);opacity:0}to{transform:translateX(0);opacity:1}}

/* ---------- Status Badges ---------- */
.status-badge{
  display:inline-block;padding:3px 10px;border-radius:12px;
  font-size:11px;font-weight:600;text-transform:capitalize;
}

/* ---------- Table Responsive Wrapper ---------- */
.table-responsive{overflow-x:auto;-webkit-overflow-scrolling:touch}

/* ---------- Responsive Dashboard Grid ---------- */
/* Safe auto-fit grid that doesn't overflow on small screens */
.dash-grid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(min(400px,100%),1fr));
  gap:20px;
}