/* === TL27 Tools Design System === */

:root {
  --accent: #6366f1;
  --accent-dark: #4f46e5;
  --accent-light: #e0e7ff;

  --bg: #ffffff;
  --bg-secondary: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --border: #e2e8f0;

  --text: #0f172a;
  --text-muted: #64748b;

  --nav-bg: #0f172a;
  --nav-text: #94a3b8;
  --nav-text-active: #f1f5f9;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.1);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --accent-light: #312e81;

  --bg: #0f172a;
  --bg-secondary: #1e293b;
  --surface: #1e293b;
  --surface-2: #334155;
  --border: #334155;

  --text: #f1f5f9;
  --text-muted: #94a3b8;

  --nav-bg: #020617;

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.4);
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  padding-top: 60px;
  transition: background 0.2s, color 0.2s;
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

/* === Navbar === */
.tl-navbar {
  background: var(--nav-bg);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  padding: 0.4rem 0;
}

.tl-navbar .navbar-brand {
  font-weight: 700;
  color: var(--nav-text-active);
  font-size: 0.95rem;
  letter-spacing: -0.01em;
  gap: 0.5rem;
  display: flex;
  align-items: center;
}

.tl-navbar .navbar-brand:hover { color: #fff; }

.tl-navbar .nav-link {
  color: var(--nav-text);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.4rem 0.7rem;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.tl-navbar .nav-link:hover,
.tl-navbar .nav-link.active {
  color: var(--nav-text-active);
  background: rgba(255,255,255,0.07);
}

.tl-navbar .dropdown-toggle::after { opacity: 0.6; }

.tl-navbar .dropdown-menu {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.4rem;
  min-width: 210px;
}

.tl-navbar .dropdown-item {
  color: var(--text);
  font-size: 0.875rem;
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.12s, color 0.12s;
}

.tl-navbar .dropdown-item:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.tl-navbar .dropdown-divider { border-color: var(--border); margin: 0.3rem 0; }

.dark-toggle {
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.1);
  color: var(--nav-text);
  border-radius: 20px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  line-height: 1.4;
}

.dark-toggle:hover {
  background: rgba(255,255,255,0.14);
  color: var(--nav-text-active);
}

.btn-nav-cta {
  background: var(--accent);
  color: #fff !important;
  border-radius: var(--radius-sm);
  padding: 0.3rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  transition: background 0.15s;
}

.btn-nav-cta:hover { background: var(--accent-dark); color: #fff !important; }

/* === Page header === */
.page-header {
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.75rem;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.03em;
  margin: 0 0 0.2rem;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: 0;
}

/* === Cards === */
.tl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.tl-card-body { padding: 1.25rem; }

/* Bootstrap card overrides */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg) !important;
  box-shadow: var(--shadow-sm);
}

.card-body { color: var(--text); }

/* === Tool cards (home) === */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  height: 100%;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.18s;
}

.tool-card:hover {
  box-shadow: var(--shadow);
  border-color: var(--accent);
  transform: translateY(-2px);
  color: inherit;
  text-decoration: none;
}

.tool-icon {
  width: 38px;
  height: 38px;
  background: var(--accent-light);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  font-size: 1rem;
  flex-shrink: 0;
  margin-bottom: 0.25rem;
}

.tool-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.tool-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.45;
}

/* === Home hero === */
.home-hero {
  padding: 2.5rem 0 2rem;
}

.home-hero-title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.1;
}

.home-hero-title span { color: var(--accent); }

.home-hero-sub {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 440px;
  margin: 0;
}

/* === Buttons === */
.btn-primary {
  background: var(--accent) !important;
  border-color: var(--accent) !important;
  font-weight: 500;
  border-radius: var(--radius-sm) !important;
}

.btn-primary:hover, .btn-primary:focus {
  background: var(--accent-dark) !important;
  border-color: var(--accent-dark) !important;
}

.btn-secondary {
  background: var(--surface-2) !important;
  border-color: var(--border) !important;
  color: var(--text) !important;
  font-weight: 500;
  border-radius: var(--radius-sm) !important;
}

.btn-secondary:hover {
  background: var(--border) !important;
}

.btn-danger {
  border-radius: var(--radius-sm) !important;
  font-weight: 500;
}

.btn-outline-secondary {
  border-color: var(--border) !important;
  color: var(--text-muted) !important;
  border-radius: var(--radius-sm) !important;
}

.btn-outline-secondary:hover {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}

/* === Forms === */
.form-control, .form-select {
  background: var(--surface) !important;
  border: 1px solid var(--border) !important;
  color: var(--text) !important;
  border-radius: var(--radius-sm) !important;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-control:focus, .form-select:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px rgba(99,102,241,0.12) !important;
  color: var(--text) !important;
}

.form-control::placeholder { color: var(--text-muted); opacity: 0.7; }

.form-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.4rem;
}

.form-text { color: var(--text-muted); font-size: 0.8rem; }

.form-check-input:checked {
  background-color: var(--accent);
  border-color: var(--accent);
}

/* === Tables === */
.table {
  color: var(--text);
  --bs-table-bg: transparent;
  --bs-table-striped-bg: var(--bg-secondary);
  --bs-table-hover-bg: var(--surface-2);
  --bs-table-border-color: var(--border);
}

.sticky-th th {
  position: sticky;
  top: 0;
  background: var(--surface) !important;
  z-index: 1;
  border-bottom: 2px solid var(--border) !important;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* === Status badges === */
.status-badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-success { background: #dcfce7; color: #15803d; }
.status-warning { background: #fef9c3; color: #92400e; }
.status-danger { background: #fee2e2; color: #991b1b; }
.status-info { background: #dbeafe; color: #1e40af; }

[data-theme="dark"] .status-success { background: rgba(21,128,61,0.2); color: #86efac; }
[data-theme="dark"] .status-warning { background: rgba(146,64,14,0.25); color: #fde68a; }
[data-theme="dark"] .status-danger { background: rgba(153,27,27,0.2); color: #fca5a5; }
[data-theme="dark"] .status-info { background: rgba(30,64,175,0.2); color: #93c5fd; }

/* Bootstrap badge overrides for dark mode */
[data-theme="dark"] .badge.bg-success { background-color: rgba(21,128,61,0.3) !important; color: #86efac !important; }
[data-theme="dark"] .badge.bg-danger { background-color: rgba(153,27,27,0.3) !important; color: #fca5a5 !important; }
[data-theme="dark"] .badge.bg-warning { background-color: rgba(146,64,14,0.3) !important; color: #fde68a !important; }
[data-theme="dark"] .badge.bg-secondary { background-color: var(--surface-2) !important; color: var(--text-muted) !important; }

/* === Alerts === */
.alert {
  border-radius: var(--radius-sm) !important;
  font-size: 0.875rem;
}

[data-theme="dark"] .alert-danger { background: rgba(153,27,27,0.15); border-color: rgba(153,27,27,0.3); color: #fca5a5; }
[data-theme="dark"] .alert-success { background: rgba(21,128,61,0.15); border-color: rgba(21,128,61,0.3); color: #86efac; }
[data-theme="dark"] .alert-warning { background: rgba(146,64,14,0.15); border-color: rgba(146,64,14,0.3); color: #fde68a; }
[data-theme="dark"] .alert-info { background: rgba(30,64,175,0.15); border-color: rgba(30,64,175,0.3); color: #93c5fd; }

/* === Monospace === */
.mono, textarea, pre, code { font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, monospace !important; }

/* === Section titles === */
.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

/* === Info rows (ip-checker, about) === */
.info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--border);
  gap: 1rem;
}

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

.info-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.info-value {
  font-size: 0.875rem;
  color: var(--text);
  text-align: right;
  word-break: break-all;
}

/* === Score circle === */
.score-circle {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 0.75rem;
  font-size: 1.6rem;
  font-weight: 800;
  color: white;
}

.score-excellent { background: linear-gradient(135deg, #22c55e, #16a34a); }
.score-good { background: linear-gradient(135deg, #84cc16, #65a30d); }
.score-average { background: linear-gradient(135deg, #f59e0b, #d97706); }
.score-poor { background: linear-gradient(135deg, #ef4444, #dc2626); }

/* === Crypto widget === */
.crypto-section {
  margin-top: 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.crypto-section-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 1rem;
}

.market-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.market-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  text-align: center;
}

.market-stat-label {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
}

.market-stat-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.market-stat-change {
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.15rem;
}

.coins-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.6rem;
}

.coin-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.7rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color 0.15s;
}

.coin-item:hover { border-color: var(--accent); }

.coin-header {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.coin-header img { border-radius: 50%; }

.coin-symbol {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.coin-price {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}

.coin-change {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  display: inline-block;
}

.coin-change.positive { background: rgba(34,197,94,0.12); color: #16a34a; }
.coin-change.negative { background: rgba(239,68,68,0.12); color: #dc2626; }
[data-theme="dark"] .coin-change.positive { color: #86efac; }
[data-theme="dark"] .coin-change.negative { color: #fca5a5; }

/* === Warning/info boxes === */
.info-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.warning-box {
  background: rgba(245,158,11,0.08);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius);
  padding: 1rem;
  color: var(--text);
  font-size: 0.875rem;
}

/* === Skill tags (about) === */
.skill-tag {
  display: inline-block;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 0.25rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 500;
  margin: 0.2rem;
}

/* === Footer === */
.tl-footer {
  margin-top: 3rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.tl-footer a { color: var(--text-muted); text-decoration: none; }
.tl-footer a:hover { color: var(--accent); }

/* === Scrollbar === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* === Responsive === */
@media (max-width: 768px) {
  .home-hero { padding: 1.5rem 0 1.25rem; }
  .market-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .coins-grid { grid-template-columns: repeat(2, 1fr); }
  .info-row { flex-direction: column; align-items: flex-start; }
  .info-value { text-align: left; }
}

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