/*
 * LinkLedger — UI adapted from Dream Pulse (templatemo.com/tm-536-dream-pulse)
 * Primary: #006699 | Font: Open Sans | Layout: Fixed sidebar + scrollable content
 */

@import url('https://fonts.googleapis.com/css?family=Open+Sans:400,600,700&display=swap');

:root {
  --primary: #006699;
  --primary-dark: #004d73;
  --primary-light: #e8f4f8;
  --sidebar-bg: rgba(0,0,0,0.88);
  --sidebar-width: 240px;
  --accent: #ff9933;
  --success: #28a745;
  --danger: #dc3545;
  --warning: #ffc107;
  --info: #17a2b8;
  --gray: #707172;
  --border: #cdcecf;
  --bg: #f4f6f9;
}

* { box-sizing: border-box; }

body {
  font-family: 'Open Sans', Arial, Helvetica, sans-serif;
  font-size: 14px;
  color: var(--gray);
  background: var(--bg);
  overflow-x: hidden;
}

/* ─── SIDEBAR ─────────────────────────────────── */
.ll-sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-width: none;
}
.ll-sidebar::-webkit-scrollbar { width: 0; }

.ll-brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.ll-brand-inner {
  border: 1px solid rgba(255,255,255,0.4);
  padding: 12px 16px;
  position: relative;
}
.ll-brand-inner::after {
  content: '';
  position: absolute;
  top: 5px; left: 5px; right: -5px; bottom: -5px;
  border: 1px solid rgba(255,255,255,0.2);
  pointer-events: none;
}
.ll-brand h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.ll-brand span {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Nav */
.ll-nav {
  list-style: none;
  padding: 16px 0;
  margin: 0;
  flex: 1;
}
.ll-nav li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  transition: all 0.2s;
  border-left: 3px solid transparent;
}
.ll-nav li a:hover,
.ll-nav li a.active {
  color: #fff;
  background: rgba(255,255,255,0.08);
  border-left-color: var(--primary);
}
.ll-nav li a i { width: 16px; text-align: center; opacity: 0.8; }
.ll-nav .nav-section {
  padding: 12px 20px 4px;
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.3);
}

/* Sidebar footer */
.ll-sidebar-footer {
  padding: 14px 20px;
  border-top: 1px solid rgba(255,255,255,0.1);
  font-size: 0.72rem;
  color: rgba(255,255,255,0.35);
}
.ll-sidebar-footer a { color: rgba(255,255,255,0.5); text-decoration: none; }
.ll-sidebar-footer .user-info { color: rgba(255,255,255,0.6); margin-bottom: 8px; }
.ll-sidebar-footer .user-info strong { color: #fff; }

/* ─── MAIN CONTENT ────────────────────────────── */
.ll-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.ll-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.ll-topbar h2 {
  font-size: 1rem;
  font-weight: 700;
  color: #333;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ll-topbar .topbar-actions { display: flex; gap: 8px; align-items: center; }

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

/* ─── CARDS ───────────────────────────────────── */
.ll-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  margin-bottom: 20px;
}
.ll-card-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.ll-card-header h3 {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #333;
  margin: 0;
}
.ll-card-body { padding: 20px; }

/* Double-border card (from Dream Pulse motif) */
.ll-dbl-card {
  border: 1px solid var(--border);
  position: relative;
  padding: 20px;
  background: #fff;
  margin-bottom: 20px;
}
.ll-dbl-card::before {
  content: '';
  position: absolute;
  top: 5px; left: 5px; right: -5px; bottom: -5px;
  border: 1px solid var(--border);
  pointer-events: none;
  z-index: -1;
}

/* ─── STAT CARDS ──────────────────────────────── */
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-top: 3px solid var(--primary);
  border-radius: 3px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-card.stat-new { border-top-color: var(--primary); }
.stat-card.stat-exported { border-top-color: var(--info); }
.stat-card.stat-reported { border-top-color: var(--warning); }
.stat-card.stat-both { border-top-color: var(--success); }
.stat-card.stat-today { border-top-color: var(--accent); }
.stat-card.stat-total { border-top-color: #6c757d; }

.stat-icon {
  width: 44px; height: 44px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}
.stat-new .stat-icon { background: var(--primary-light); color: var(--primary); }
.stat-exported .stat-icon { background: #d1ecf1; color: var(--info); }
.stat-reported .stat-icon { background: #fff3cd; color: #856404; }
.stat-both .stat-icon { background: #d4edda; color: var(--success); }
.stat-today .stat-icon { background: #fff8ee; color: var(--accent); }
.stat-total .stat-icon { background: #f8f9fa; color: #6c757d; }

.stat-val { font-size: 1.6rem; font-weight: 700; color: #333; line-height: 1; }
.stat-lbl { font-size: 0.72rem; color: var(--gray); text-transform: uppercase; letter-spacing: 0.5px; }

/* ─── TABLE ───────────────────────────────────── */
.ll-table-wrap { overflow-x: auto; }
.ll-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}
.ll-table th {
  background: #f8f9fa;
  border-bottom: 2px solid var(--border);
  padding: 10px 12px;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.5px;
  color: #555;
  white-space: nowrap;
}
.ll-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: middle;
}
.ll-table tr:hover td { background: #fafcff; }
.ll-table tr.is-exported td { background: #f0f9ff; }
.ll-table tr.is-reported td { background: #fffbf0; }
.ll-table tr.is-both td { background: #f0fff4; }
.ll-table tr.is-archived td { opacity: 0.55; }

.url-cell {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.url-cell a { color: var(--primary); text-decoration: none; }
.url-cell a:hover { text-decoration: underline; }

/* ─── BADGES ──────────────────────────────────── */
.ll-badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 2px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.badge-new { background: var(--primary); color: #fff; }
.badge-exported { background: var(--info); color: #fff; }
.badge-reported { background: var(--warning); color: #333; }
.badge-both { background: var(--success); color: #fff; }
.badge-archived { background: #6c757d; color: #fff; }

/* ─── FILTER PANEL ────────────────────────────── */
.filter-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.filter-panel .form-row { margin-bottom: 0; }
.filter-panel label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #555;
  margin-bottom: 4px;
}
.filter-panel .form-control, .filter-panel .form-select {
  font-size: 0.82rem;
  border-color: var(--border);
  border-radius: 2px;
  height: 34px;
  padding: 4px 10px;
}

/* ─── FORMS ───────────────────────────────────── */
.ll-form label {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: #444;
  margin-bottom: 4px;
}
.ll-form .form-control, .ll-form select {
  border-color: var(--border);
  border-radius: 2px;
  font-size: 0.85rem;
}
.ll-form .form-control:focus, .ll-form select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(0,102,153,0.15);
  outline: none;
}
.ll-form .form-group { margin-bottom: 18px; }
.ll-form .help-text {
  font-size: 0.72rem;
  color: #888;
  margin-top: 3px;
}

/* ─── BUTTONS ─────────────────────────────────── */
.btn-primary-ll {
  background: var(--primary);
  border: none;
  color: #fff;
  padding: 8px 18px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-radius: 2px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-primary-ll:hover { background: var(--primary-dark); color: #fff; }
.btn-sm-ll {
  padding: 4px 10px;
  font-size: 0.72rem;
}
.btn-outline-ll {
  background: transparent;
  border: 1px solid var(--primary);
  color: var(--primary);
  padding: 7px 16px;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  display: inline-block;
}
.btn-outline-ll:hover { background: var(--primary); color: #fff; }

/* ─── ALERTS ──────────────────────────────────── */
.ll-alert {
  padding: 10px 16px;
  border-radius: 2px;
  font-size: 0.82rem;
  margin-bottom: 14px;
  border-left: 4px solid;
}
.ll-alert-success { background: #d4edda; border-color: var(--success); color: #155724; }
.ll-alert-error { background: #f8d7da; border-color: var(--danger); color: #721c24; }
.ll-alert-warning { background: #fff3cd; border-color: var(--warning); color: #856404; }
.ll-alert-info { background: #d1ecf1; border-color: var(--info); color: #0c5460; }

/* ─── PAGINATION ──────────────────────────────── */
.ll-pagination { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.ll-pagination a, .ll-pagination span {
  display: inline-block;
  padding: 5px 11px;
  border: 1px solid var(--border);
  border-radius: 2px;
  font-size: 0.78rem;
  color: var(--primary);
  text-decoration: none;
  background: #fff;
}
.ll-pagination .current {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.ll-pagination a:hover { background: var(--primary-light); }

/* ─── DUPLICATE WARNING ───────────────────────── */
.duplicate-warning {
  background: #fff3cd;
  border: 1px solid #ffc107;
  border-left: 4px solid #ffc107;
  border-radius: 2px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.82rem;
}

/* ─── LOGIN PAGE ──────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-box {
  width: 100%;
  max-width: 380px;
  padding: 20px;
}
.login-brand {
  text-align: center;
  margin-bottom: 24px;
}
.login-brand-inner {
  display: inline-block;
  border: 1px solid rgba(255,255,255,0.4);
  padding: 16px 32px;
  position: relative;
}
.login-brand-inner::after {
  content: '';
  position: absolute;
  top: 6px; left: 6px; right: -6px; bottom: -6px;
  border: 1px solid rgba(255,255,255,0.2);
}
.login-brand h1 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  margin: 0;
  letter-spacing: 2px;
  text-transform: uppercase;
}
.login-brand p { color: rgba(255,255,255,0.5); font-size: 0.75rem; margin: 4px 0 0; }
.login-form-wrap {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.15);
  padding: 28px;
}
.login-form-wrap label {
  color: rgba(255,255,255,0.7);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.login-form-wrap .form-control {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.2);
  color: #fff;
  border-radius: 2px;
}
.login-form-wrap .form-control:focus {
  background: rgba(255,255,255,0.12);
  border-color: var(--primary);
  box-shadow: none;
  color: #fff;
}
.login-form-wrap .form-control::placeholder { color: rgba(255,255,255,0.3); }

/* ─── MISC ────────────────────────────────────── */
.text-primary-ll { color: var(--primary) !important; }
.monospace { font-family: monospace; font-size: 0.8em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #aaa;
}
.empty-state i { font-size: 3rem; margin-bottom: 12px; display: block; }

/* Multi-select categories */
select[multiple] {
  height: auto;
  min-height: 100px;
}

/* Mobile toggle */
.sidebar-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 1100;
  background: var(--primary);
  color: #fff;
  border: none;
  width: 36px; height: 36px;
  border-radius: 3px;
  font-size: 1rem;
  cursor: pointer;
}

@media (max-width: 768px) {
  .ll-sidebar {
    left: calc(-1 * var(--sidebar-width));
    transition: left 0.3s ease;
  }
  .ll-sidebar.show { left: 0; }
  .ll-main { margin-left: 0; }
  .sidebar-toggle { display: flex; align-items: center; justify-content: center; }
  .ll-content { padding: 16px; }
  .ll-topbar { padding: 10px 16px 10px 56px; }
}
