/*
  Household Kraken — Dark Theme and Responsive UI
  ------------------------------------------------
  This stylesheet applies a modern, elegant dark theme and responsive
  base styles across the app. It uses CSS variables for easy theming.
*/

/* Color system (Dark) */
:root {
  --bg: #0f1216;
  --surface: #151a21;
  --surface-2: #1b222b;
  --border: #2a3340;
  --muted: #9aa4b2;
  --text: #e6edf3;
  --text-secondary: #c4cbd4;
  --primary: #6ea8fe;   /* blue-400 */
  --primary-contrast: #0b1020;
  --success: #5fd19b;
  --warning: #ffd166;
  --danger: #ff7b7b;

  --focus: #91c8ff;

  --shadow: 0 2px 8px rgba(0,0,0,0.35);
  --radius: 10px;
  --radius-sm: 8px;
  --radius-xs: 6px;

  --container: 1100px;

  --font-sans: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
               Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* Base reset-ish */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.5;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; height: auto; }

/* Layout */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px 16px;
}

#page_wrapper { /* keep existing id for compatibility */
  max-width: var(--container);
  margin: 24px auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}

header, footer {
  margin-bottom: 16px;
}

h1, h2, h3, h4 {
  margin: 0 0 12px 0;
}

p { margin: 0 0 10px 0; color: var(--text-secondary); }

/* Forms */
form { margin: 0; }
label { display: inline-block; margin: 8px 0 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"],
select, textarea {
  width: 100%;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 10px 12px;
  outline: none;
}
input::placeholder { color: var(--muted); }
select { padding-right: 28px; }

input:focus, select:focus, textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(145,200,255,0.18);
}

/* Buttons */
.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 14px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .02s ease;
}
.btn:hover { background: #222a35; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: #0b1020;
  border-color: transparent;
}
.btn-primary:hover { filter: brightness(1.05); }

.btn-success {
  background: var(--success);
  color: #0b120f;
  border-color: transparent;
}

.btn-danger {
  background: var(--danger);
  color: #160b0b;
  border-color: transparent;
}

.btn-secondary {
  background: #263041;
  color: var(--text);
  border-color: #2f3b4f;
}

/* Small button variant */
.btn-sm {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
}

/* Utility spacing */
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.mb-2 { margin-bottom: 12px; }

/* Alerts */
.alert {
  padding: 10px 12px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.alert-success { border-color: rgba(95,209,155,.4); background: rgba(95,209,155,.08); color: #bff5dc; }
.alert-error   { border-color: rgba(255,123,123,.4); background: rgba(255,123,123,.08); color: #ffd3d3; }
.alert-info    { border-color: rgba(145,200,255,.4); background: rgba(145,200,255,.08); color: #d7ebff; }

/* Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
}

table.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px; /* allow horizontal scroll on very small screens */
}

table.table th, table.table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}
table.table thead th {
  background: #1e2631;
  position: sticky; top: 0; /* better UX while scrolling long tables */
}
table.table tbody tr:hover { background: rgba(255,255,255,0.02); }

/* Lists inside table cells (roles) */
.list-compact {
  list-style: none;
  margin: 0; padding: 0;
}
.list-compact li { margin: 4px 0; }

/* Badges (for roles – optional future use) */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  background: #263041;
  border: 1px solid #2f3b4f;
}

/* Sections */
section { margin-top: 20px; padding-top: 4px; }
section > h3 { margin-bottom: 10px; }

/* Footer spacing (empty elements) */
footer { min-height: 12px; }

/* Small helpers */
.row { display: flex; flex-wrap: wrap; gap: 12px; }
.col { flex: 1 1 220px; }

/* Media queries for tighter viewports */
@media (max-width: 600px) {
  #page_wrapper { padding: 14px; border-radius: var(--radius-sm); }
  .btn { width: 100%; }
}
