/* assets/css/style.css — Ship Network Admin Dashboard */

/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
       background: #F8F7F4; color: #1C1C1A; min-height: 100vh; }

/* ============================================================
   CSS VARIABLES
   ============================================================ */
:root {
  --blue-50: #E6F1FB; --blue-200: #85B7EB; --blue-600: #185FA5; --blue-800: #0C447C;
  --green-50: #EAF3DE; --green-200: #97C459; --green-600: #3B6D11; --green-800: #27500A;
  --amber-50: #FAEEDA; --amber-200: #FAC775; --amber-600: #BA7517; --amber-800: #633806;
  --red-50: #FCEBEB; --red-200: #F09595; --red-600: #A32D2D; --red-800: #791F1F;
  --gray-50: #F1EFE8; --gray-100: #D3D1C7; --gray-400: #888780; --gray-600: #5F5E5A;
  --purple-50: #EEEDFE; --purple-600: #534AB7; --purple-800: #3C3489;
  --teal-50: #E1F5EE; --teal-600: #0F6E56; --teal-200: #5DCAA5;
  --border: rgba(44,44,42,0.12);
  --border-md: rgba(44,44,42,0.2);
  --radius-sm: 6px; --radius-md: 8px; --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
}

/* ============================================================
   TOPBAR
   ============================================================ */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 20px;
  background: #fff; border-bottom: 0.5px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 15px; }
.brand-icon { width: 32px; height: 32px; background: var(--blue-50); border-radius: 8px;
              display: flex; align-items: center; justify-content: center; }
.brand-icon .ti { font-size: 18px; color: var(--blue-600); }
.ship-badge { background: var(--blue-50); color: var(--blue-800); font-size: 11px;
              font-weight: 500; padding: 3px 10px; border-radius: 20px; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.clock-text { font-family: 'Courier New', monospace; font-size: 12px; color: var(--gray-600); }
.user-badge { font-size: 11px; color: var(--gray-600); }
.btn-icon { position: relative; padding: 6px 8px; border: 0.5px solid var(--border-md);
            border-radius: var(--radius-md); background: none; cursor: pointer; color: var(--gray-600); }
.alert-dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px;
             border-radius: 50%; background: #E24B4A; display: none; }

/* ============================================================
   NAV TABS
   ============================================================ */
.navtabs { display: flex; background: #fff; border-bottom: 0.5px solid var(--border);
           padding: 0 20px; overflow-x: auto; gap: 0; }
.navtab { display: flex; align-items: center; gap: 6px; padding: 10px 14px;
          border: none; border-bottom: 2px solid transparent; background: none;
          font-size: 12px; font-weight: 500; cursor: pointer; color: var(--gray-400);
          white-space: nowrap; transition: color 0.15s; }
.navtab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.navtab:hover:not(.active) { color: #1C1C1A; }
.tab-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dot-green { background: var(--green-600); }
.dot-red   { background: #E24B4A; }
.dot-amber { background: var(--amber-600); }
.dot-blue  { background: var(--blue-600); }
.dot-purple{ background: var(--purple-600); }
.dot-gray  { background: var(--gray-400); }
.badge-count { background: var(--red-50); color: var(--red-600); border-radius: 20px;
               padding: 1px 6px; font-size: 10px; margin-left: 2px; }

/* ============================================================
   CONTENT & TABS
   ============================================================ */
.content { padding: 16px 20px; max-width: 1200px; }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* ============================================================
   METRICS GRID
   ============================================================ */
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
               gap: 10px; margin-bottom: 14px; }
.mcard { background: #F1EFE8; border-radius: var(--radius-md); padding: 12px 14px; }
.mcard-label { font-size: 10px; color: var(--gray-600); text-transform: uppercase;
               letter-spacing: 0.5px; margin-bottom: 4px; }
.mcard-val { font-size: 22px; font-weight: 500; line-height: 1; color: #1C1C1A; }
.mcard-val.green  { color: var(--green-800); }
.mcard-val.blue   { color: var(--blue-800); }
.mcard-val.amber  { color: var(--amber-800); }
.mcard-val.red    { color: var(--red-800); }
.mcard-val.teal   { color: var(--teal-600); }
.mcard-val.sm     { font-size: 14px; }
.mcard-sub { font-size: 10px; color: var(--gray-600); margin-top: 4px; }

/* ============================================================
   CARDS
   ============================================================ */
.card { background: #fff; border: 0.5px solid var(--border); border-radius: var(--radius-lg);
        padding: 14px 16px; margin-bottom: 12px; }
.card-title { font-size: 11px; font-weight: 500; text-transform: uppercase;
              letter-spacing: 0.6px; color: var(--gray-600); margin-bottom: 12px;
              display: flex; align-items: center; gap: 6px; }
.card-title .ti { font-size: 14px; }

/* ============================================================
   LAYOUT HELPERS
   ============================================================ */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 700px) { .grid-2col { grid-template-columns: 1fr; } }
.ml-auto { margin-left: auto; }

/* ============================================================
   INFO ROWS
   ============================================================ */
.row { display: flex; justify-content: space-between; align-items: center;
       padding: 7px 0; border-bottom: 0.5px solid var(--border); font-size: 12px; }
.row:last-child { border-bottom: none; }
.row-label { color: var(--gray-600); display: flex; align-items: center; gap: 5px; }
.row-val { font-weight: 500; }
.loading-row { color: var(--gray-400); font-size: 12px; padding: 8px 0; text-align: center; }

/* ============================================================
   BADGES
   ============================================================ */
.badge { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px;
         border-radius: 20px; font-size: 10px; font-weight: 500; }
.badge-green  { background: var(--green-50); color: var(--green-800); }
.badge-amber  { background: var(--amber-50); color: var(--amber-800); }
.badge-red    { background: var(--red-50); color: var(--red-800); }
.badge-blue   { background: var(--blue-50); color: var(--blue-800); }
.badge-gray   { background: var(--gray-50); color: var(--gray-600); }

/* ============================================================
   DOTS
   ============================================================ */
.dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.dg  { background: var(--green-600); }
.da  { background: var(--amber-600); }
.dr  { background: #E24B4A; }
.dgr { background: var(--gray-400); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn { display: inline-flex; align-items: center; gap: 5px; padding: 7px 13px;
       border-radius: var(--radius-md); border: 0.5px solid var(--border-md);
       font-size: 12px; cursor: pointer; background: #fff; color: #1C1C1A;
       font-family: inherit; transition: background 0.15s; text-decoration: none; }
.btn:hover { background: #F1EFE8; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .ti { font-size: 13px; }
.btn-primary { background: var(--blue-600); color: #E6F1FB; border-color: var(--blue-600); }
.btn-primary:hover { background: var(--blue-800); }
.btn-danger { background: var(--red-50); color: var(--red-600); border-color: var(--red-200); }
.btn-sm { padding: 5px 10px; font-size: 11px; }
.btn-xs { padding: 3px 8px; font-size: 10px; }
.btn-danger-xs { background: var(--red-50); color: var(--red-600); border-color: var(--red-200); }
.btn-warning-xs{ background: var(--amber-50); color: var(--amber-800); border-color: var(--amber-200); }
.btn-block { width: 100%; justify-content: center; }

/* ============================================================
   BANDWIDTH BARS
   ============================================================ */
.bw-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 12px; }
.bw-label { min-width: 120px; color: var(--gray-600); }
.bw-bar-wrap { flex: 1; height: 5px; background: #F1EFE8; border-radius: 3px; overflow: hidden; }
.bw-bar { height: 100%; border-radius: 3px; transition: width 0.5s ease; }
.bw-blue  { background: var(--blue-200); }
.bw-teal  { background: var(--teal-200); }
.bw-amber { background: var(--amber-200); }
.bw-val { min-width: 70px; text-align: right; font-weight: 500; }

/* ============================================================
   MINI LOG
   ============================================================ */
.mini-log { background: #F1EFE8; border-radius: var(--radius-md); padding: 10px 12px;
            font-family: 'Courier New', monospace; font-size: 10px; line-height: 1.8;
            max-height: 180px; overflow-y: auto; color: var(--gray-600); }
.log-ok   { color: var(--green-800); }
.log-warn { color: var(--amber-800); }
.log-error{ color: var(--red-800); }
.log-info { color: var(--blue-800); }

/* ============================================================
   SUB TABS
   ============================================================ */
.sub-tabs { display: flex; border-bottom: 0.5px solid var(--border); margin-bottom: 14px; }
.sub-tab { padding: 7px 14px; font-size: 11px; cursor: pointer; border: none;
           border-bottom: 2px solid transparent; background: none; color: var(--gray-600);
           font-family: inherit; font-weight: 500; }
.sub-tab.active { color: var(--blue-600); border-bottom-color: var(--blue-600); }
.sub-pane { display: none; }
.sub-pane.active { display: block; }

/* ============================================================
   CLI TERMINAL
   ============================================================ */
.cli-output { background: #2C2C2A; border-radius: var(--radius-md); padding: 12px 14px;
              font-family: 'Courier New', monospace; font-size: 11px; color: #C0DD97;
              line-height: 1.8; min-height: 120px; max-height: 280px; overflow-y: auto; margin-bottom: 8px; white-space: pre-wrap; }
.cli-cmd    { color: #B5D4F4; }
.cli-output-text { color: #D3D1C7; }
.cli-loading{ color: #888780; }
.cli-cursor { color: #B5D4F4; }
.code-block { background: #2C2C2A; color: #C0DD97; padding: 10px 12px; border-radius: 6px;
              font-family: 'Courier New', monospace; font-size: 11px; line-height: 1.7;
              overflow-x: auto; margin: 8px 0; white-space: pre; }
.cli-row { display: flex; gap: 6px; align-items: center; }
.cli-prefix { font-family: 'Courier New', monospace; font-size: 12px; color: var(--blue-600);
              white-space: nowrap; }
.cli-input { flex: 1; font-family: 'Courier New', monospace; font-size: 12px; padding: 7px 10px;
             border: 0.5px solid var(--border-md); border-radius: var(--radius-md);
             background: var(--gray-50); color: #1C1C1A; }
.cli-input:focus { outline: none; border-color: var(--blue-600); }
.quick-cmds { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }

/* ============================================================
   ALERTS
   ============================================================ */
.alerts-header { display: flex; align-items: center; justify-content: space-between;
                 margin-bottom: 12px; }
.alert-item { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px;
              border-radius: var(--radius-md); margin-bottom: 8px; }
.alert-critical, .alert-item.alert-critical { background: var(--red-50); border: 0.5px solid var(--red-200); }
.alert-warning,  .alert-item.alert-warning  { background: var(--amber-50); border: 0.5px solid var(--amber-200); }
.alert-info,     .alert-item.alert-info     { background: var(--blue-50); border: 0.5px solid var(--blue-200); }
.alert-icon { font-size: 16px; margin-top: 2px; flex-shrink: 0; }
.alert-critical .alert-icon { color: var(--red-600); }
.alert-warning  .alert-icon { color: var(--amber-600); }
.alert-body { flex: 1; }
.alert-title { font-weight: 500; font-size: 13px; }
.alert-critical .alert-title { color: var(--red-800); }
.alert-warning  .alert-title { color: var(--amber-800); }
.alert-desc { font-size: 11px; margin-top: 3px; }
.alert-critical .alert-desc { color: var(--red-600); }
.alert-warning  .alert-desc { color: var(--amber-600); }
.alert-meta { font-size: 10px; color: var(--gray-600); margin-top: 4px; }
.alert-actions { display: flex; gap: 6px; margin-top: 8px; }
.no-alerts { text-align: center; padding: 32px; color: var(--gray-400); }
.no-alerts .ti { font-size: 36px; display: block; margin-bottom: 8px; color: var(--green-600); }

/* ============================================================
   DATA TABLE
   ============================================================ */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.data-table th { text-align: left; padding: 8px 10px; border-bottom: 0.5px solid var(--border-md);
                 font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px;
                 color: var(--gray-600); font-weight: 500; background: var(--gray-50); }
.data-table td { padding: 8px 10px; border-bottom: 0.5px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--gray-50); }
.mono-sm { font-family: 'Courier New', monospace; font-size: 10px; color: var(--gray-600); }

/* ============================================================
   FORMS
   ============================================================ */
.form-group { margin-bottom: 10px; }
.form-group label { display: block; font-size: 11px; color: var(--gray-600); margin-bottom: 4px; font-weight: 500; }
.form-group input,
.form-group select,
.form-group textarea { width: 100%; padding: 8px 10px; border: 0.5px solid var(--border-md);
                        border-radius: var(--radius-md); font-family: inherit; font-size: 12px;
                        background: #fff; color: #1C1C1A; }
.form-group input:focus,
.form-group select:focus { outline: none; border-color: var(--blue-600); }
.form-hint { font-size: 10px; color: var(--gray-400); margin-top: 3px; display: block; }
.test-msg { font-size: 11px; margin-left: 8px; }
.test-msg.success { color: var(--green-800); }
.test-msg.error   { color: var(--red-600); }
.test-msg.loading { color: var(--gray-400); }
.save-msg { margin-top: 10px; padding: 8px 12px; border-radius: var(--radius-md); font-size: 12px; }
.save-msg.success { background: var(--green-50); color: var(--green-800); }
.save-msg.error   { background: var(--red-50); color: var(--red-600); }

/* ============================================================
   AI ASISTEN
   ============================================================ */
.ai-quick-btns { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.ai-textarea { width: 100%; min-height: 70px; padding: 10px 12px; border: 0.5px solid var(--border-md);
               border-radius: var(--radius-md); font-family: inherit; font-size: 12px;
               color: #1C1C1A; background: #fff; resize: vertical; }
.ai-textarea:focus { outline: none; border-color: var(--blue-600); }
.ai-actions { display: flex; gap: 8px; margin-top: 8px; }
.ai-loading { display: flex; align-items: center; gap: 8px; font-size: 12px;
              color: var(--gray-600); padding: 10px 0; }
.ai-response { font-size: 12px; line-height: 1.8; color: #1C1C1A; }
.ai-response p { margin-bottom: 8px; }
.ai-response strong { font-weight: 600; }
.hist-item { padding: 5px 0; border-bottom: 0.5px solid var(--border); cursor: pointer;
             font-size: 11px; color: var(--gray-600); display: flex; align-items: center; gap: 6px; }
.hist-item:hover { color: var(--blue-600); }

/* ============================================================
   SPINNER
   ============================================================ */
.spinner { width: 14px; height: 14px; border: 2px solid #D3D1C7; border-top-color: var(--blue-600);
           border-radius: 50%; animation: spin 0.7s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay { position: fixed; inset: 0; background: rgba(44,44,42,0.4);
                 display: flex; align-items: center; justify-content: center; z-index: 200; }
.modal-box { background: #fff; border-radius: var(--radius-lg); width: 420px; max-width: 95vw;
             box-shadow: var(--shadow-sm); }
.modal-header { display: flex; align-items: center; justify-content: space-between;
                padding: 14px 16px; border-bottom: 0.5px solid var(--border); }
.modal-header h3 { font-size: 14px; font-weight: 500; }
.btn-close { background: none; border: none; font-size: 18px; cursor: pointer; color: var(--gray-400); padding: 0; }
.modal-body { padding: 16px; }
.modal-footer { padding: 12px 16px; border-top: 0.5px solid var(--border);
                display: flex; justify-content: flex-end; gap: 8px; }

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body { background: #F1EFE8; display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-wrap  { width: 100%; max-width: 360px; padding: 16px; }
.login-card  { background: #fff; border-radius: var(--radius-lg); padding: 28px 24px;
               border: 0.5px solid var(--border); }
.login-header { text-align: center; margin-bottom: 24px; }
.login-icon { width: 52px; height: 52px; background: var(--blue-50); border-radius: 12px;
              display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; }
.login-icon .ti { font-size: 26px; color: var(--blue-600); }
.login-header h1 { font-size: 18px; font-weight: 500; }
.login-header p  { font-size: 12px; color: var(--gray-600); margin-top: 4px; }
.login-form .form-group { margin-bottom: 14px; }
.login-footer { text-align: center; font-size: 10px; color: var(--gray-400); margin-top: 20px; }
.alert-error { background: var(--red-50); color: var(--red-800); border-radius: var(--radius-md);
               padding: 8px 12px; font-size: 12px; margin-bottom: 14px;
               display: flex; align-items: center; gap: 6px; }

/* ============================================================
   UTILITIES
   ============================================================ */
.text-muted   { color: var(--gray-600); }
.text-danger  { color: var(--red-600); }
.text-success { color: var(--green-800); }
small { font-size: 0.85em; }
