/* Information Technology Secrets Vault — Light / Dark theme (Arkana Labs branding) */
/* Arkana Red: #FF1919 (PMS 185)  |  Arkana Black: #1E1E23 (PMS Black 6) */
/* Light is the default (matches sysadmindb and the other Arkana pages).            */
/* Dark applies when <html data-theme="dark"> is set (toggle in the header; saved   */
/* per browser under localStorage 'ark-theme'). Never hard-code a neutral color in  */
/* markup or JS — use one of the variables below so both themes stay readable.      */

:root {
  /* Brand */
  --ark-red:       #FF1919;
  --ark-red-hover: #FF4747;
  --ark-black:     #1E1E23;
  --ark-white:     #FFFFFF;
  --ark-gray-10:   #646667;
  --ark-gray-7:    #9A9A9C;
  --ark-gray-4:    #B9BABB;
  --ark-gray-1:    #D7D8D8;
  --ark-font:      'Lab Grotesque', 'Helvetica Neue', Helvetica, Arial, sans-serif;

  color-scheme: light;

  /* Surfaces */
  --page-bg:        #F7F7F7;
  --surface:        #FFFFFF;   /* cards, table headers, modal box */
  --surface-chrome: #FFFFFF;   /* header, nav, footer */
  --inset:          #F2F2F3;   /* inputs, secret/PEM display, scrollbar track */
  --row-hover:      rgba(0,0,0,0.03);

  /* Text */
  --text:           #1E1E23;
  --text-heading:   #1E1E23;
  --text-muted:     #646667;
  --text-dim:       #77787A;
  --text-faint:     #8E8F91;
  --text-ghost:     #A4A5A7;

  /* Borders */
  --border:         #D7D8D8;
  --border-subtle:  #ECECEE;
  --border-strong:  #B9BABB;

  /* Secondary button */
  --btn2-bg:        #E9E9EB;
  --btn2-text:      #2E2E33;
  --btn2-hover:     #D7D8D8;

  /* Critical (officer-only) button */
  --crit-bg:        #FFF1F1;
  --crit-text:      #B00000;
  --crit-hover-bg:  #FFE0E0;
  --crit-hover-text:#8A0000;

  /* Status colors */
  --ok:             #15803d;
  --ok-bg:          rgba(21,128,61,0.12);
  --warn:           #b45309;
  --warn-bg:        rgba(180,83,9,0.12);
  --danger:         #dc2626;
  --danger-bg:      rgba(220,38,38,0.10);
  --neutral:        #6b7280;
  --neutral-bg:     rgba(107,114,128,0.12);
  --info-bg:        rgba(100,102,103,0.10);
  --secret-text:    #166534;

  /* Toasts */
  --toast-ok-bg:    #dcfce7;
  --toast-ok-text:  #14532d;
  --toast-err-bg:   #fee2e2;
  --toast-err-text: #7f1d1d;
  --toast-info-bg:  #fff1f1;
  --toast-info-text:#9b1c1c;

  /* Amber notice box */
  --notice-bg:      #fffbeb;
  --notice-border:  #f59e0b;
  --notice-text:    #92400e;

  --shadow-modal:   0 20px 60px rgba(0,0,0,0.25);
  --shadow-toast:   0 4px 16px rgba(0,0,0,0.18);
}

[data-theme="dark"] {
  color-scheme: dark;

  --page-bg:        #1E1E23;
  --surface:        #1c1c1c;
  --surface-chrome: #161616;
  --inset:          #111111;
  --row-hover:      rgba(255,255,255,0.03);

  --text:           #D7D8D8;
  --text-heading:   #FFFFFF;
  --text-muted:     #9A9A9C;
  --text-dim:       #646667;
  --text-faint:     #555555;
  --text-ghost:     #3d3d3d;

  --border:         #2a2a2a;
  --border-subtle:  #222222;
  --border-strong:  #3d3d3d;

  --btn2-bg:        #2a2a2a;
  --btn2-text:      #D7D8D8;
  --btn2-hover:     #3d3d3d;

  --crit-bg:        #1a0a00;
  --crit-text:      #FF9090;
  --crit-hover-bg:  #2a1000;
  --crit-hover-text:#FF7575;

  --ok:             #22c55e;
  --ok-bg:          rgba(34,197,94,0.15);
  --warn:           #f59e0b;
  --warn-bg:        rgba(245,158,11,0.15);
  --danger:         #ef4444;
  --danger-bg:      rgba(239,68,68,0.15);
  --neutral:        #9ca3af;
  --neutral-bg:     rgba(107,114,128,0.15);
  --info-bg:        rgba(148,163,184,0.12);
  --secret-text:    #86efac;

  --toast-ok-bg:    #14532d;
  --toast-ok-text:  #bbf7d0;
  --toast-err-bg:   #7f1d1d;
  --toast-err-text: #fecaca;
  --toast-info-bg:  #2a1215;
  --toast-info-text:#fca5a5;

  --notice-bg:      #451a03;
  --notice-border:  #92400e;
  --notice-text:    #fde68a;

  --shadow-modal:   0 20px 60px rgba(0,0,0,0.6);
  --shadow-toast:   0 4px 16px rgba(0,0,0,0.5);
}

/* ── Logos: both are in the markup, CSS shows the one for the active theme ──── */
.logo-dark  { display: none; }
[data-theme="dark"] .logo-light { display: none; }
[data-theme="dark"] .logo-dark  { display: block; }
.logo-light { display: block; }
.header-logo { height: 40px; width: auto; flex-shrink: 0; }
.login-logo  { width: 150px; height: auto; margin: 0 auto 1.75rem; }

/* ── Headings / captions that used Tailwind color classes ──────────────────── */
.ark-heading { color: var(--text-heading); }
.ark-sub     { color: var(--text-muted); }

/* ── Theme toggle button ─────────────────────────────────────────────────────── */
.btn-theme {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.15s, color 0.15s;
}
.btn-theme:hover { border-color: var(--ark-red); color: var(--ark-red); }

.btn-signout {
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  font-size: 0.8rem;
  transition: all 0.15s;
}
.btn-signout:hover { color: var(--text); border-color: var(--border-strong); }

/* ── Tab navigation ─────────────────────────────────────────────────────── */
.tab-btn {
  padding: 0.75rem 1.25rem;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  background: transparent;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn:hover { color: var(--text); }
.tab-btn.active { color: #FF1919; border-bottom-color: #FF1919; }

/* ── Sub-tab navigation (within certs) ──────────────────────────────────── */
.sub-tab-btn {
  padding: 0.4rem 0.9rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  font-size: 0.8rem;
  font-weight: 500;
  background: transparent;
  cursor: pointer;
  transition: all 0.15s;
}
.sub-tab-btn:hover { color: var(--text); border-color: var(--border-strong); }
.sub-tab-btn.active { background: rgba(255,25,25,0.12); color: #FF1919; border-color: #FF1919; }

/* ── Tables ─────────────────────────────────────────────────────────────── */
.ark-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.ark-table th {
  text-align: left;
  padding: 0.65rem 1rem;
  color: var(--text-muted);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  white-space: nowrap;
}
.ark-table td {
  padding: 0.65rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}
.ark-table tr:hover td { background: var(--row-hover); }
.ark-table .actions-cell { white-space: nowrap; }
.sortable-th { cursor: pointer; user-select: none; }
.sortable-th:hover { color: var(--text); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn-sm {
  padding: 0.2rem 0.55rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s;
  display: inline-block;
}
.btn-primary   { background: #3d3d3d; color: #f8fafc; }
.btn-primary:hover   { background: #4d4d4d; }
.btn-secondary { background: var(--btn2-bg); color: var(--btn2-text); }
.btn-secondary:hover { background: var(--btn2-hover); }
.btn-danger    { background: #FF1919; color: white; }
.btn-danger:hover    { background: #FF4747; }
.btn-success   { background: #16a34a; color: white; }
.btn-success:hover   { background: #15803d; }
.btn-warning   { background: #b45309; color: white; }
.btn-warning:hover   { background: #d97706; }

/* Critical action buttons — high-visibility, officer-only operations */
.btn-critical  { background: var(--crit-bg); color: var(--crit-text); border: 1px solid #FF4747; }
.btn-critical:hover  { background: var(--crit-hover-bg); color: var(--crit-hover-text); border-color: #FF1919; }
.btn-ghost     { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover     { background: var(--surface); color: var(--text); }
.btn-lg {
  padding: 0.6rem 1.2rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background-color 0.15s;
}

/* ── Form controls ───────────────────────────────────────────────────────── */
.ark-input, .ark-textarea, .ark-select {
  background: var(--inset);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  width: 100%;
  font-size: 0.875rem;
  transition: border-color 0.15s;
}
.ark-input:focus, .ark-textarea:focus, .ark-select:focus {
  outline: none;
  border-color: #FF1919;
  box-shadow: 0 0 0 2px rgba(255, 25, 25, 0.18);
}
.ark-textarea { min-height: 80px; resize: vertical; font-family: inherit; }
.ark-label {
  display: block;
  margin-bottom: 0.35rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 500;
}
.ark-form-group { margin-bottom: 1rem; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.ark-card {
  background: var(--surface);
  border-radius: 0.75rem;
  border: 1px solid var(--border-subtle);
  overflow: hidden;
}
.ark-card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-green  { background: var(--ok-bg);      color: var(--ok); }
.badge-red    { background: var(--danger-bg);  color: var(--danger); }
.badge-yellow { background: var(--warn-bg);    color: var(--warn); }
.badge-blue   { background: var(--info-bg);    color: var(--text-muted); }
.badge-gray   { background: var(--neutral-bg); color: var(--neutral); }

/* ── Cert expiry colors ───────────────────────────────────────────────────── */
.expiry-ok      { color: var(--ok); }
.expiry-warning { color: var(--warn); }
.expiry-danger  { color: var(--danger); }
.expiry-expired { color: #6b7280; text-decoration: line-through; }

/* ── Availability indicators (SSL backups) ──────────────────────────────── */
.avail-yes { color: var(--ok); font-weight: 600; }
.avail-no  { color: var(--border); }

/* ── Secret value display ────────────────────────────────────────────────── */
.secret-value {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8rem;
  word-break: break-all;
  white-space: pre-wrap;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.6rem 0.75rem;
  color: var(--secret-text);
}
.secret-obscured {
  filter: blur(5px);
  cursor: pointer;
  transition: filter 0.2s;
  user-select: none;
}
.secret-obscured:hover { filter: blur(3px); }

/* ── PEM viewer ──────────────────────────────────────────────────────────── */
.pem-viewer {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.75rem;
  background: var(--inset);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.75rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 300px;
  overflow-y: auto;
}

/* ── Toast notifications ─────────────────────────────────────────────────── */
.toast {
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  min-width: 260px;
  max-width: 420px;
  box-shadow: var(--shadow-toast);
  animation: toastIn 0.2s ease;
}
.toast-success { background: var(--toast-ok-bg);   color: var(--toast-ok-text);   border-left: 3px solid #22c55e; }
.toast-error   { background: var(--toast-err-bg);  color: var(--toast-err-text);  border-left: 3px solid #ef4444; }
.toast-info    { background: var(--toast-info-bg); color: var(--toast-info-text); border-left: 3px solid #FF1919; }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(24px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 3rem 2rem;
  color: var(--text-ghost);
}
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 0.75rem; }
.empty-state .empty-title { color: var(--text-faint); font-weight: 500; margin-bottom: 0.5rem; }

/* ── Deleted section toggle ──────────────────────────────────────────────── */
.deleted-section {
  margin-top: 1.5rem;
  border: 1px dashed var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
}
.deleted-section-header {
  padding: 0.6rem 1rem;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-faint);
  font-size: 0.8rem;
  font-weight: 500;
}
.deleted-section-header:hover { color: var(--text-muted); }

/* ── Info row (detail label/value pairs) ─────────────────────────────────── */
.info-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.85rem;
}
.info-row:last-child { border-bottom: none; }
.info-label { color: var(--text-faint); min-width: 120px; flex-shrink: 0; }
.info-value { color: var(--text); word-break: break-all; }

/* ── Download format select group ───────────────────────────────────────── */
.download-group { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ── Scrollbar styling ───────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--inset); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
