/* ===================================================
   TrackView — Dashboard Styles
   Dark mode, premium feel, minimal
   =================================================== */

/* ---- Reset & Base ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg-body: #0a0a0f;
  --bg-card: #111118;
  --bg-card-hover: #16161f;
  --bg-input: #1a1a24;
  --bg-table-header: #0d0d14;

  --border: #1e1e2a;
  --border-focus: #6366f1;

  --text-primary: #e4e4eb;
  --text-secondary: #8888a0;
  --text-muted: #55556a;

  --accent: #6366f1;
  --accent-hover: #818cf8;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --danger: #ef4444;
  --danger-hover: #f87171;

  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --success-border: rgba(34, 197, 94, 0.25);

  --error-bg: rgba(239, 68, 68, 0.1);
  --error-border: rgba(239, 68, 68, 0.25);

  --radius: 10px;
  --radius-sm: 6px;
  --transition: 0.2s ease;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---- Navbar ---- */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  height: 60px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
  font-weight: 700;
  font-size: 17px;
}

.navbar-brand svg {
  color: #8b5cf6;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.navbar-user {
  color: var(--text-secondary);
  font-size: 13px;
}

/* ---- Container ---- */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

/* ---- Page Header ---- */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.3px;
}

.subtitle {
  color: var(--text-secondary);
  font-size: 13px;
  margin-top: 2px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #fff;
  box-shadow: 0 2px 12px rgba(99, 102, 241, 0.25);
}

.btn-primary:hover {
  box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-primary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: var(--accent);
  color: var(--accent-hover);
}

.btn-danger {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid transparent;
}

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

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  padding: 8px 14px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-input);
}

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

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px;
  font-size: 14px;
}

/* ---- Table ---- */
.table-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
}

thead {
  background: var(--bg-table-header);
}

th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 14px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

tr:hover td {
  background: var(--bg-card-hover);
}

.td-title {
  font-weight: 500;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-url code {
  font-size: 11px;
  color: var(--text-secondary);
  background: var(--bg-input);
  padding: 3px 8px;
  border-radius: 4px;
  max-width: 250px;
  display: inline-block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.td-date {
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.td-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
}

.badge {
  display: inline-block;
  background: var(--bg-input);
  color: var(--text-secondary);
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* ---- Empty State ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 24px;
  text-align: center;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.empty-state svg {
  color: var(--text-muted);
  margin-bottom: 20px;
  opacity: 0.5;
}

.empty-state h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 13px;
  margin-bottom: 24px;
}

/* ---- Form Card ---- */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 600px;
}

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

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

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

.form-group input::placeholder {
  color: var(--text-muted);
}

.form-group input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.form-hint {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 5px;
}

.form-actions {
  margin-top: 28px;
}

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 20px;
}

.alert-error {
  background: var(--error-bg);
  color: var(--danger);
  border: 1px solid var(--error-border);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  transition: opacity 0.3s ease, transform 0.3s ease;
  transform: translateY(0);
}

.toast.hidden {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

.toast.toast-success {
  background: #16a34a;
}

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

/* ---- Login Page ---- */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-body);
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 24px;
}

.login-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 32px;
}

.login-header {
  text-align: center;
  margin-bottom: 28px;
}

.login-header svg {
  margin-bottom: 12px;
}

.login-header h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  margin-bottom: 4px;
}

.login-header p {
  color: var(--text-secondary);
  font-size: 13px;
}

.login-form .form-group {
  margin-bottom: 18px;
}

.login-form .btn-full {
  margin-top: 6px;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .container {
    padding: 20px 16px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .table-wrapper {
    overflow-x: auto;
  }

  table {
    min-width: 600px;
  }

  .form-card {
    padding: 24px 20px;
  }

  .login-card {
    padding: 32px 24px;
  }
}
