/* =========================================================
   FlowDeskPOS — Website Admin Console
   Clean, lightweight, mobile-friendly admin theme
   ========================================================= */

:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --border: #e4e8f0;
  --text: #0f172a;
  --text-muted: #64748b;
  --primary: #1265f0;
  --primary-dark: #0d4fc7;
  --primary-soft: #e8f0fe;
  --success: #10b981;
  --success-soft: #ecfdf5;
  --warning: #f59e0b;
  --warning-soft: #fffbeb;
  --danger: #ef4444;
  --danger-soft: #fef2f2;
  --info: #3b82f6;
  --sidebar-w: 240px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow: 0 4px 12px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 40px rgba(15, 23, 42, 0.15);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

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

button { font-family: inherit; font-size: inherit; cursor: pointer; }

/* =========================================================
   LOGIN
   ========================================================= */

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: linear-gradient(135deg, #1265f0 0%, #0d4fc7 100%);
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 14px;
  padding: 40px 32px;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--primary);
  text-align: center;
  margin-bottom: 4px;
}

.login-subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 28px;
}

.login-card label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  margin-top: 16px;
}

.login-card input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  background: var(--surface);
}

.login-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.login-card button {
  width: 100%;
  margin-top: 24px;
  padding: 12px 16px;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 15px;
  transition: background 0.15s;
}

.login-card button:hover:not(:disabled) {
  background: var(--primary-dark);
}

.login-card button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.error-msg {
  margin-top: 12px;
  padding: 10px 12px;
  background: var(--danger-soft);
  color: var(--danger);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
}

.error-msg:empty { display: none; }

.login-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 13px;
}

/* =========================================================
   APP LAYOUT
   ========================================================= */

.app {
  display: flex;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  width: var(--sidebar-w);
  background: #0f172a;
  color: white;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 10;
}

.brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-title {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.brand-badge {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 8px;
  background: var(--primary);
  color: white;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

#nav {
  flex: 1;
  padding: 12px 8px;
  overflow-y: auto;
}

#nav a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  margin-bottom: 2px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.75);
  font-weight: 600;
  font-size: 13.5px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

#nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: white;
  text-decoration: none;
}

#nav a.active {
  background: var(--primary);
  color: white;
}

.pill {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

.pill:empty { display: none; }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.user-line {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 10px;
}

.user-dot {
  width: 8px;
  height: 8px;
  background: var(--success);
  border-radius: 50%;
}

.logout-btn {
  width: 100%;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.85);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s;
}

.logout-btn:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

/* ----- Main area ----- */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  padding: 18px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 5;
}

.topbar h1 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.3px;
}

.content {
  padding: 24px 28px;
  flex: 1;
}

/* =========================================================
   BUTTONS
   ========================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  transition: all 0.15s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--bg);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: white;
}
.btn-danger:hover:not(:disabled) { background: #dc2626; }

.btn-danger-soft {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: transparent;
}
.btn-danger-soft:hover:not(:disabled) { background: #fee2e2; }

.btn-sm { padding: 6px 11px; font-size: 12px; }

/* =========================================================
   CARDS & PANELS
   ========================================================= */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  margin-bottom: 20px;
}

.card-title {
  font-size: 15px;
  font-weight: 800;
  margin: 0 0 14px;
  letter-spacing: -0.2px;
}

.card-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--text);
}

.stat-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =========================================================
   TABLES
   ========================================================= */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  background: #f8fafc;
  font-weight: 800;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

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

tr:hover td { background: #fafbfd; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.empty-state strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 6px;
}

/* =========================================================
   BADGES
   ========================================================= */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-new      { background: var(--primary-soft); color: var(--primary); }
.badge-read     { background: #e2e8f0; color: var(--text-muted); }
.badge-replied  { background: var(--success-soft); color: var(--success); }
.badge-success  { background: var(--success-soft); color: var(--success); }
.badge-warning  { background: var(--warning-soft); color: #b45309; }
.badge-danger   { background: var(--danger-soft); color: var(--danger); }
.badge-info     { background: #dbeafe; color: #1e40af; }

/* =========================================================
   FORMS
   ========================================================= */

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.form-grid-1 { grid-template-columns: 1fr; }

.form-group { margin-bottom: 4px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: var(--surface);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-group textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

.form-group-full { grid-column: 1 / -1; }

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* =========================================================
   MODAL
   ========================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.modal {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  margin: 0;
}

.modal-close {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1;
}

.modal-close:hover { color: var(--text); }

.modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: #fafbfd;
}

/* =========================================================
   TOAST
   ========================================================= */

.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--text);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 600;
  z-index: 200;
  max-width: 400px;
  animation: slideIn 0.2s ease-out;
}

.toast.toast-success { background: var(--success); }
.toast.toast-error { background: var(--danger); }

@keyframes slideIn {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* =========================================================
   RELEASES
   ========================================================= */

.release-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.release-row:last-child { border-bottom: none; }

.release-platform {
  width: 80px;
  text-align: center;
  font-size: 26px;
}

.release-info { flex: 1; min-width: 0; }

.release-title {
  font-weight: 800;
  font-size: 14px;
  margin-bottom: 3px;
}

.release-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.release-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* =========================================================
   ACTIVITY LOG
   ========================================================= */

.activity-row {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}

.activity-row:last-child { border-bottom: none; }

.activity-action {
  font-weight: 800;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.activity-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 768px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.2s;
    width: 260px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .topbar, .content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .stat-value {
    font-size: 22px;
  }

  table { font-size: 12px; }
  th, td { padding: 10px 12px; }

  .release-row {
    flex-wrap: wrap;
  }
}
