/* DoubleLil Admin — custom design system */

:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --primary: #2481cc;
  --primary-hover: #1d6faf;
  --primary-text: #ffffff;
  --danger: #ef4444;
  --danger-bg: #fef2f2;
  --success: #22c55e;
  --success-bg: #f0fdf4;
  --warning: #f59e0b;
  --warning-bg: #fffbeb;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.08);
  --header-h: 60px;
  --bottom-nav-h: 64px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--primary);
  text-decoration: none;
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border: none;
  border-radius: 10px;
  padding: 0.65rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: transform 0.05s, background 0.15s, box-shadow 0.15s;
}

button:active, .btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  box-shadow: 0 2px 6px rgba(36, 129, 204, 0.3);
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #f3f4f6;
  color: var(--text);
}

.btn-secondary:hover {
  background: #e5e7eb;
}

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.btn-sm {
  padding: 0.4rem 0.7rem;
  font-size: 0.85rem;
}

/* Header */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
  z-index: 100;
}

.app-header .brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
}

.app-header .logout {
  font-size: 0.85rem;
  color: var(--muted);
}

/* Layout */
.app-layout {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* Sidebar (desktop) */
.sidebar {
  display: none;
  width: 220px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.75rem 1.25rem;
  color: var(--text);
  font-weight: 500;
  border-left: 3px solid transparent;
}

.sidebar a:hover,
.sidebar a.active {
  background: #f3f4f6;
  color: var(--primary);
  border-left-color: var(--primary);
}

/* Main content */
main {
  flex: 1;
  padding: 1rem;
  width: 100%;
}

/* Bottom nav (mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--bottom-nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 100;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  font-size: 0.7rem;
  color: var(--muted);
  padding: 0.4rem;
}

.bottom-nav a span.icon {
  font-size: 1.25rem;
  line-height: 1;
}

.bottom-nav a.active,
.bottom-nav a:hover {
  color: var(--primary);
}

/* Cards */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.card h2, .card h3 {
  margin-top: 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .grid-2 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stat-card {
  text-align: center;
}

.stat-card .value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--primary);
  margin: 0.25rem 0;
}

.stat-card .label {
  font-size: 0.9rem;
  color: var(--muted);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  font-weight: 600;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.badge-new { background: #eff6ff; color: #2563eb; }
.badge-assigned { background: #f5f3ff; color: #7c3aed; }
.badge-in_progress { background: #fff7ed; color: #ea580c; }
.badge-closed { background: var(--success-bg); color: #15803d; }
.badge-postponed { background: var(--warning-bg); color: #b45309; }
.badge-rejected { background: var(--danger-bg); color: #b91c1c; }

/* Forms */
.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

input, select, textarea {
  width: 100%;
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  background: var(--surface);
  color: var(--text);
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(36, 129, 204, 0.12);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

.actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Request card */
.request-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  margin-bottom: 1rem;
}

.request-card pre {
  margin: 0 0 1rem;
  white-space: pre-wrap;
  word-wrap: break-word;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Login */
.login-box {
  max-width: 360px;
  margin: 10vh auto 0;
  text-align: center;
}

.login-box h1 {
  margin-bottom: 1.5rem;
}

.error {
  color: var(--danger);
  font-weight: 500;
  margin-bottom: 1rem;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* Page title */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.page-header h1 {
  margin: 0;
  font-size: 1.4rem;
}

/* Desktop layout */
@media (min-width: 900px) {
  .sidebar {
    display: block;
  }

  .bottom-nav {
    display: none;
  }

  main {
    margin-left: 220px;
    padding: 1.5rem;
    padding-bottom: 1.5rem;
  }

  .app-header {
    padding: 0 1.5rem;
  }
}

/* Utility */
.mt-1 { margin-top: 1rem; }
.mb-1 { margin-bottom: 1rem; }
.hidden { display: none; }
