/* style.css - Design System for DETRAN Gateway */
:root {
  --bg-primary: #0f172a;
  --bg-glass: rgba(30, 41, 59, 0.7);
  --bg-glass-hover: rgba(51, 65, 85, 0.8);
  --border-glass: rgba(255, 255, 255, 0.1);
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --status-up: #10b981;
  --status-up-bg: rgba(16, 185, 129, 0.1);
  --status-degraded: #f59e0b;
  --status-degraded-bg: rgba(245, 158, 11, 0.1);
  --status-down: #ef4444;
  --status-down-bg: rgba(239, 68, 68, 0.1);
  --gray-dark: #1e293b;
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
  --radius-md: 12px;
  --radius-lg: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-primary);
  background-image: radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15) 0%, transparent 50%),
                    radial-gradient(circle at 85% 30%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.5;
}

/* Glassmorphism Utilities */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-lg);
}

.glass-panel {
  background: var(--bg-glass);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

/* Login Page */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-container {
  width: 100%;
  max-width: 400px;
  padding: 2.5rem;
  border-radius: var(--radius-lg);
  text-align: center;
}

.logo h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 0.5rem; background: linear-gradient(90deg, #60a5fa, #34d399); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo p { color: var(--text-secondary); margin-bottom: 2rem; font-size: 0.9rem; }

.form-group { margin-bottom: 1.25rem; text-align: left; }
.form-group label { display: block; margin-bottom: 0.5rem; font-size: 0.875rem; color: var(--text-secondary); }
.form-group input { width: 100%; padding: 0.75rem 1rem; border-radius: 8px; border: 1px solid var(--gray-dark); background: rgba(0,0,0,0.2); color: var(--text-primary); outline: none; transition: border-color 0.2s; font-family: inherit; }
.form-group input:focus { border-color: var(--accent); }

.btn { padding: 0.75rem 1.5rem; border-radius: 8px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; font-size: 0.9rem; border: none; }
.btn-block { width: 100%; }
.primary-btn { background: var(--accent); color: white; }
.primary-btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.outline-btn { background: transparent; border: 1px solid var(--border-glass); color: var(--text-primary); }
.outline-btn:hover { background: rgba(255,255,255,0.05); }

.error-box { background: var(--status-down-bg); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.3); padding: 0.75rem; border-radius: 8px; margin-bottom: 1.5rem; font-size: 0.875rem; }
.hidden { display: none; }

/* Dashboard Layout */
.navbar { display: flex; justify-content: space-between; align-items: center; padding: 1rem 2rem; position: sticky; top: 0; z-index: 100; border-bottom: 1px solid var(--border-glass); }
.nav-brand { display: flex; align-items: center; gap: 0.75rem; }
.nav-brand h1 { font-size: 1.25rem; font-weight: 600; }
.nav-metrics { display: flex; gap: 2rem; }
.metric { color: var(--text-secondary); font-size: 0.9rem; }
.metric span { color: var(--text-primary); font-weight: 600; }
.nav-user { display: flex; align-items: center; gap: 1rem; }

.container { max-width: 1400px; margin: 0 auto; padding: 2rem; }
.section { margin-bottom: 2.5rem; }
.section-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.section-header h2 { font-size: 1.25rem; font-weight: 500; }
.icon-btn { background: none; font-size: 1.25rem; padding: 0.5rem; border-radius: 50%; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.icon-btn:hover { background: var(--bg-glass-hover); }

/* Provider Grid */
.providers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 1.5rem; }
.provider-card { transition: transform 0.2s, box-shadow 0.2s; position: relative; overflow: hidden; }
.provider-card:hover { transform: translateY(-3px); box-shadow: 0 20px 25px -5px rgba(0,0,0,0.4); }

.card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 1.5rem; }
.uf-badge { width: 48px; height: 48px; background: rgba(0,0,0,0.3); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; font-weight: 700; border: 1px solid var(--border-glass); }

.status-badge { display: inline-flex; align-items: center; gap: 0.375rem; padding: 0.25rem 0.75rem; border-radius: 999px; font-size: 0.75rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.status-badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; }
.status-up { background: var(--status-up-bg); color: var(--status-up); border: 1px solid rgba(16, 185, 129, 0.2); }
.status-up::before { background: var(--status-up); box-shadow: 0 0 8px var(--status-up); }
.status-degraded { background: var(--status-degraded-bg); color: var(--status-degraded); border: 1px solid rgba(245, 158, 11, 0.2); }
.status-degraded::before { background: var(--status-degraded); box-shadow: 0 0 8px var(--status-degraded); }
.status-down { background: var(--status-down-bg); color: var(--status-down); border: 1px solid rgba(239, 68, 68, 0.2); }
.status-down::before { background: var(--status-down); box-shadow: 0 0 8px var(--status-down); }
.status-disabled { background: rgba(255,255,255,0.05); color: var(--text-secondary); border: 1px solid var(--border-glass); }
.status-disabled::before { background: var(--text-secondary); }

.card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; padding: 1rem; background: rgba(0,0,0,0.2); border-radius: 8px; }
.stat-box { display: flex; flex-direction: column; }
.stat-label { font-size: 0.75rem; color: var(--text-secondary); margin-bottom: 0.25rem; }
.stat-value { font-size: 1.125rem; font-weight: 600; }
.lat-good { color: var(--status-up); }
.lat-warn { color: var(--status-degraded); }
.lat-bad { color: var(--status-down); }

.card-footer { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; border-top: 1px solid var(--border-glass); }
.protocol-badge { font-size: 0.75rem; padding: 0.2rem 0.5rem; background: var(--gray-dark); border-radius: 4px; color: var(--text-secondary); font-family: monospace; }
.toggle-switch { position: relative; display: inline-block; width: 44px; height: 24px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--gray-dark); transition: .3s; border-radius: 24px; border: 1px solid var(--border-glass); }
.slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); border-color: var(--accent); }
input:checked + .slider:before { transform: translateX(20px); }

/* Tables */
.layout-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; }
.table-responsive { overflow-x: auto; margin: -1.5rem; margin-top: 0; padding: 0 1.5rem 1.5rem 1.5rem; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.875rem; }
.data-table th { padding: 1rem; border-bottom: 1px solid var(--border-glass); color: var(--text-secondary); font-weight: 500; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.data-table td { padding: 1rem; border-bottom: 1px solid rgba(255,255,255,0.02); }
.data-table tbody tr:hover { background: rgba(255,255,255,0.02); }
td.mono { font-family: monospace; color: #cbd5e1; }
.pill { padding: 0.25rem 0.5rem; border-radius: 4px; font-size: 0.75rem; font-weight: 600; background: rgba(255,255,255,0.1); }
.pill.br { background: rgba(59, 130, 246, 0.2); color: #93c5fd; }

/* Tabs Navigation */
.nav-tabs { display: flex; gap: 0.5rem; background: rgba(0,0,0,0.2); padding: 0.35rem; border-radius: var(--radius-md); border: 1px solid var(--border-glass); }
.nav-item { padding: 0.5rem 1rem; color: var(--text-secondary); text-decoration: none; border-radius: 8px; font-weight: 500; font-size: 0.9rem; transition: all 0.2s; }
.nav-item:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }
.nav-item.active { background: var(--accent); color: white; box-shadow: 0 4px 6px -1px rgba(0,0,0,0.2); }

/* Modals */
.modal-overlay { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(4px); z-index: 1000; display: flex; align-items: center; justify-content: center; }
.modal-overlay.hidden { display: none; }
.modal-content { width: 100%; max-width: 500px; padding: 2rem; position: relative; animation: modalDrop 0.3s cubic-bezier(0.16, 1, 0.3, 1); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.modal-header h3 { font-size: 1.25rem; font-weight: 600; }
.modal-footer { display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; }
@keyframes modalDrop { from { opacity: 0; transform: translateY(-20px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Alerts & Credentials Box */
.alert-box { padding: 1rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid rgba(255,255,255,0.1); }
.alert-box.success { background: rgba(16, 185, 129, 0.1); border-color: rgba(16, 185, 129, 0.3); color: #d1fae5; }
.alert-box h4 { margin-bottom: 0.5rem; color: #10b981; }
.credentials-box { background: rgba(0,0,0,0.4); padding: 1rem; border-radius: 6px; margin: 1rem 0; font-family: monospace; font-size: 1.1rem; border: 1px dashed rgba(255,255,255,0.2); }
.credentials-box code { color: #fcd34d; font-weight: bold; font-size: 1.2rem; }
