/* ======================================================
   FONTS & VARIABLES
====================================================== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');

:root {
  /* Colors */
  --bg: #070A0F;
  --panel: #0B111B;
  --panel-glass: rgba(11, 17, 27, 0.7);
  --line: rgba(255, 255, 255, 0.08); /* Mais sutil */
  --text: #E8EEF8;
  --text-dim: #9FB0C7;
  
  /* Brand */
  --primary: #FF6A00;
  --primary-hover: #FF8A3D;
  --primary-glow: rgba(255, 106, 0, 0.3);
  
  /* Status */
  --success: #22c55e;
  --success-bg: rgba(34, 197, 94, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.1);

  /* Measurements */
  --radius: 12px;
  --radius-lg: 18px;
  --header-height: 70px;
  --sidebar-width: 260px;
  
  /* Effects */
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 30px -5px rgba(0, 0, 0, 0.4);
  --glass: blur(12px) saturate(110%);
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* ======================================================
   RESET & BASE
====================================================== */
* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: 
    radial-gradient(circle at 15% 0%, rgba(255, 106, 0, 0.08), transparent 40%),
    radial-gradient(circle at 85% 0%, rgba(255, 138, 61, 0.05), transparent 40%),
    var(--bg);
  color: var(--text);
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; transition: color 0.2s var(--ease); }
h1, h2, h3, h4, h5, h6 { margin: 0; line-height: 1.2; }

/* Custom Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #2a3441; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }

/* Utilities */
.muted { color: var(--text-dim); font-size: 0.875rem; }
.text-right { text-align: right; }
.w-full { width: 100%; }

/* ======================================================
   LAYOUT
====================================================== */
.app {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 24px 16px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  height: 100vh;
}

.sidebar-logo {
  font-size: 1.5rem;
  font-weight: 800;
  padding: 0 12px 24px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
  letter-spacing: -0.02em;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-logo span { color: var(--primary); }

.userbox {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 16px 12px;
  margin-bottom: 8px;
  border-radius: var(--radius);
  transition: background 0.2s;
}
.userbox:hover { background: rgba(255, 255, 255, 0.03); }

.avatar {
  width: 42px; height: 42px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 106, 0, 0.1);
  border: 1px solid rgba(255, 106, 0, 0.2);
  color: var(--primary);
  font-weight: 700;
  font-size: 1.1rem;
}
.username { font-weight: 600; font-size: 0.95rem; display: block; }
.userrole { font-size: 0.75rem; color: var(--text-dim); display: block; }

/* Navigation */
.nav {
  display: flex; flex-direction: column; gap: 4px;
  flex: 1; overflow-y: auto;
}

.navlink {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius);
  color: var(--text-dim);
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s var(--ease);
  border: 1px solid transparent;
}
.navlink i { font-size: 1.25rem; transition: color 0.2s; }

.navlink:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  transform: translateX(4px);
}
.navlink.active {
  background: rgba(255, 106, 0, 0.08);
  color: var(--primary);
  border-color: rgba(255, 106, 0, 0.15);
  font-weight: 600;
}
.navlink.active i { color: var(--primary); }

.navlink.danger { margin-top: auto; }
.navlink.danger:hover { background: var(--danger-bg); color: var(--danger); border-color: rgba(239, 68, 68, 0.2); }
.navlink.danger i { color: var(--danger); }

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

.topbar {
  height: var(--header-height);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 10, 15, 0.8);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
  position: sticky; top: 0; z-index: 40;
}
.topbar-title { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; }

.content {
  padding: 32px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

/* ======================================================
   COMPONENTS
====================================================== */
/* Cards */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  position: relative;
  overflow: hidden;
}
/* Optional: Glow effect on card header */
.card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.section-title {
  font-weight: 700;
  margin: 0 0 16px;
  font-size: 1rem;
  color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
}

/* Forms */
label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-dim);
  margin-bottom: 8px;
}
input, select, textarea {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.2s var(--ease);
}
input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.2); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(0, 0, 0, 0.3);
  box-shadow: 0 0 0 3px rgba(255, 106, 0, 0.15);
}
textarea { min-height: 120px; resize: vertical; line-height: 1.5; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.2s var(--ease);
  box-shadow: 0 4px 12px rgba(255, 106, 0, 0.25);
  text-shadow: 0 1px 2px rgba(0,0,0,0.1);
}
.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 106, 0, 0.35);
}
.btn:active { transform: translateY(0); }

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.08);
  color: var(--text);
  box-shadow: none; text-shadow: none;
}
.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  box-shadow: none; text-shadow: none;
}
.btn-danger:hover {
  background: var(--danger);
  color: white;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}

/* Grids */
.grid { display: grid; gap: 24px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* Tables */
.table-container {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.table { width: 100%; border-collapse: separate; border-spacing: 0; }
.table th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.75rem;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}
.table td {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  color: var(--text);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Alerts/Badges */
.alert {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: #fecaca;
  font-size: 0.9rem;
  display: flex; align-items: center; gap: 10px;
}
.alert.ok {
  border-color: var(--success);
  background: var(--success-bg);
  color: #bbf7d0;
}
.pill, .badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.1);
}

.badge.ok {
  border-color: var(--success);
  background: var(--success-bg);
  color: #bbf7d0;
}
.badge.warn {
  border-color: rgba(245,158,11,0.65);
  background: rgba(245,158,11,0.14);
  color: #fde68a;
}

/* ======================================================
   LOGIN & HERO
====================================================== */
.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.login-left {
  padding: 60px;
  display: flex; flex-direction: column; justify-content: center;
  position: relative;
  background: radial-gradient(circle at bottom left, rgba(255,106,0,0.1), transparent 50%);
}
.login-right {
  display: flex; align-items: center; justify-content: center;
  padding: 30px;
  background: var(--panel);
  border-left: 1px solid var(--line);
}

.login-card {
  width: 100%; max-width: 400px;
}
.login-title { font-size: 1.75rem; font-weight: 800; margin-bottom: 8px; }
.login-sub { color: var(--text-dim); margin-bottom: 32px; font-size: 0.95rem; }

/* Hero Typography */
.hero { max-width: 600px; }
.hero h1 {
  font-size: 3.5rem; line-height: 1.1; font-weight: 800;
  background: linear-gradient(135deg, #fff, #999);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.03em;
  margin-bottom: 24px;
}
.hero p { font-size: 1.1rem; color: var(--text-dim); max-width: 480px; }

/* ======================================================
   STEPPER
====================================================== */
.stepper { display: flex; gap: 12px; margin-bottom: 24px; flex-wrap: wrap; }
.step {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}
.step:hover { background: rgba(255, 255, 255, 0.04); }
.step.active {
  border-color: var(--primary);
  background: rgba(255, 106, 0, 0.08);
  color: var(--text);
  box-shadow: 0 0 0 1px rgba(255, 106, 0, 0.2);
}
.step i { font-size: 1.1rem; }
.step-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.step-panel { display: none; animation: fadeIn 0.3s ease; }
.step-panel.active { display: block; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* ======================================================
   RESPONSIVE
====================================================== */
@media (max-width: 1024px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-left { display: none; }
  .login-right { background: transparent; border: none; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.3s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .topbar { padding: 0 20px; }
  .content { padding: 20px; }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .hero h1 { font-size: 2.5rem; }
}