/* InstaFlow SaaS — Design System PREMIUM v2.0 (Modern Midnight Zinc) */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700;800;900&display=swap');

/* ═══════════════════════════════════════════
   TOKENS DE DESIGN (PREMIUM)
═══════════════════════════════════════════ */
:root {
  /* Cores principais - Paleta Zinc High-End */
  --bg-main:       #09090b;   /* Zinc 950 */
  --bg-sidebar:    #09090b;
  --bg-card:       #121216;   /* Zinc 900 + subtle elevation */
  --bg-card-hover: #18181b;

  /* Accent & Brand - Refined Electric Violet */
  --accent:         #8B5CF6;   /* Violet 500 */
  --accent-soft:    rgba(139,92,246, 0.12);
  --cyan:           #06B6D4;   /* Cyan 500 */
  --cyan-soft:      rgba(6,182,212, 0.1);
  --pink:           #D946EF;   /* Fuchsia 500 */
  
  /* Semânticas */
  --success:      #10B981;   /* Emerald 500 */
  --success-soft: rgba(16,185,129, 0.1);
  --warning:      #F59E0B;
  --warning-soft: rgba(245,158,11, 0.1);
  --danger:       #EF4444;
  --danger-soft:  rgba(239,68,68, 0.1);
  --info:         #3B82F6;

  /* Texto - Hierarquia Refinada */
  --text-primary:   #FAFAFA;   /* Zinc 50 */
  --text-secondary: #A1A1AA;   /* Zinc 400 */
  --text-muted:     #52525B;   /* Zinc 600 */

  /* Linhas e Bordas */
  --border:         rgba(255,255,255, 0.08);
  --border-strong:  rgba(255,255,255, 0.15);

  /* Efeitos Glass */
  --glass:          rgba(24, 24, 27, 0.6);
  --glass-blur:     blur(12px);

  /* Sombras Profundas */
  --shadow:    0 10px 30px -10px rgba(0,0,0,0.6), 0 0 0 1px var(--border);
  --shadow-sm: 0 4px 12px -2px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 20px rgba(139,92,246, 0.3);

  /* Radii */
  --radius:    14px;
  --radius-sm: 10px;
  --radius-lg: 20px;

  /* Layout */
  --sidebar-width:  250px;
  --header-height:  64px;

  /* Transitions */
  --transition: .25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ═══════════════════════════════════════════
   RESET + BASE
═══════════════════════════════════════════ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.6;
  overflow: hidden;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4, h5, h6, .logo-text, .section-title, .topbar-title { 
  font-family: 'Outfit', sans-serif; 
}
a { color: inherit; text-decoration: none; transition: all var(--transition); }
svg { flex-shrink: 0; }
button, input, select, textarea { font-family: inherit; font-size: inherit; outline: none; }

/* Scrollbar Automática - Estilo Premium */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ═══════════════════════════════════════════
   LAYOUT APP
═══════════════════════════════════════════ */
.app { display: flex; height: 100vh; overflow: hidden; background: radial-gradient(circle at 0% 0%, rgba(139,92,246,0.05) 0%, transparent 40%); }
.main, .admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg-main); }
.page-content, .admin-body { flex: 1; overflow-y: auto; padding: 24px 32px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

/* ═══════════════════════════════════════════
   SIDEBAR (REFINED GLASS)
═══════════════════════════════════════════ */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  z-index: 100;
}
.sidebar-header { padding: 24px 20px 16px; }
.logo { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.logo-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), var(--cyan));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white; box-shadow: var(--shadow-glow);
}
.logo-text { font-size: 22px; font-weight: 800; letter-spacing: -0.5px; }
.logo-text span { color: var(--accent); }

.account-select {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 10px 12px; cursor: pointer;
  transition: all var(--transition);
}
.account-select:hover { background: rgba(255,255,255,0.06); border-color: var(--accent-soft); }
.account-avatar {
  width: 32px; height: 32px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, #1e1e24, #2a2a33);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: var(--text-primary);
  border: 1px solid var(--border);
}

.sidebar-nav { flex: 1; padding: 10px 12px; overflow-y: auto; }
.nav-section-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-muted);
  padding: 18px 12px 8px;
}
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 500; color: var(--text-secondary);
  transition: all var(--transition);
  margin-bottom: 4px;
}
.nav-item svg { width: 18px; height: 18px; stroke-width: 2; opacity: 0.7; }
.nav-item:hover { background: rgba(255,255,255,0.04); color: var(--text-primary); }
.nav-item:hover svg { opacity: 1; stroke: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px rgba(139,92,246, 0.2); }
.nav-item.active svg { stroke: var(--accent); opacity: 1; }

.sidebar-footer { padding: 16px 12px 24px; border-top: 1px solid var(--border); }
.upgrade-card {
  background: linear-gradient(135deg, rgba(139,92,246,0.1), rgba(6,182,212,0.1));
  border: 1px solid rgba(139,92,246,0.2);
  border-radius: var(--radius); padding: 16px; margin-bottom: 8px;
}

/* ═══════════════════════════════════════════
   TOP BAR
═══════════════════════════════════════════ */
.topbar {
  height: var(--header-height); flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; border-bottom: 1px solid var(--border);
  background: rgba(9, 9, 11, 0.8); backdrop-filter: var(--glass-blur);
}
.topbar-title { font-size: 18px; font-weight: 700; color: var(--text-primary); }

/* ═══════════════════════════════════════════
   COMPONENTES
═══════════════════════════════════════════ */

/* CARDS PREMIUM */
.card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.card-interactive:hover { 
  border-color: var(--border-strong); 
  transform: translateY(-2px); 
  box-shadow: var(--shadow); 
  background: var(--bg-card-hover);
}

/* BENTO GRID (MÉTRICAS) */
.metrics-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 20px; }
.metric-card {
  padding: 24px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); position: relative; overflow: hidden;
}
.metric-card::after { 
  content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
  background: radial-gradient(circle at top right, rgba(139,92,246,0.05), transparent 70%); 
}
.metric-icon { 
  width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; 
  font-size: 20px; margin-bottom: 16px; background: var(--bg-card-hover);
  border: 1px solid var(--border);
}
.metric-label { font-size: 12px; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; opacity: 0.8; }
.metric-value { font-size: 32px; font-weight: 800; color: var(--text-primary); letter-spacing: -0.5px; }

/* TABLE REFINED */
.table-wrap { border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); overflow: hidden; }
table { width: 100%; border-collapse: collapse; }
thead tr { background: rgba(255,255,255,0.02); }
th {
  padding: 12px 16px; text-align: left; font-size: 11px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px; color: var(--text-muted);
}
td { padding: 14px 16px; border-top: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
tr:hover td { background: rgba(255,255,255,0.015); }

/* ═══════════════════════════════════════════
   FORMULÁRIOS
═══════════════════════════════════════════ */
.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 8px; }
.input, .select, .textarea {
  width: 100%; background: #0c0c0f; border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text-primary);
  padding: 10px 14px; transition: all var(--transition);
}
.input:focus, .select:focus, .textarea:focus {
  border-color: var(--accent);
  background: #0f0f12;
  box-shadow: 0 0 0 4px rgba(139,92,246, 0.15);
}

/* ═══════════════════════════════════════════
   BOTÕES (PREMIUM FLOW)
═══════════════════════════════════════════ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 0 20px; height: 42px; border-radius: var(--radius-sm);
  font-weight: 700; font-size: 14px; border: 1px solid transparent;
  transition: all var(--transition); cursor: pointer;
}
.btn-primary { 
  background: var(--accent); color: white;
  box-shadow: 0 8px 16px -4px rgba(139,92,246, 0.4);
}
.btn-primary:hover { 
  background: #9d77f7; 
  transform: translateY(-1px);
  box-shadow: 0 12px 24px -6px rgba(139,92,246, 0.5);
}
.btn-secondary { 
  background: rgba(255,255,255,0.05); color: var(--text-primary); 
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: rgba(255,255,255,0.08); border-color: var(--border-strong); }

/* TAGS */
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; font-size: 11px; font-weight: 800; border: 1px solid transparent;
}
.tag-accent    { background: var(--accent-soft); color: var(--accent); border-color: rgba(139,92,246, 0.2); }
.tag-success   { background: var(--success-soft); color: var(--success); border-color: rgba(16,185,129, 0.2); }
.tag-danger    { background: var(--danger-soft); color: var(--danger); border-color: rgba(239,68,68, 0.2); }

/* ═══════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════ */
.glass { background: var(--glass); backdrop-filter: var(--glass-blur); border: 1px solid var(--border); }
.text-gradient { background: linear-gradient(135deg, #fff, rgba(255,255,255,0.6)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.badge-pro { background: linear-gradient(135deg, var(--accent), var(--cyan)); color: white; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 800; }

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pulseNeural { 
    0%, 100% { box-shadow: 0 0 20px rgba(139,92,246, 0.2); transform: scale(1); }
    50% { box-shadow: 0 0 40px rgba(139,92,246, 0.4); transform: scale(1.05); }
}
@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.animate-fade { animation: fadeIn 0.4s ease forwards; }
.animate-pulse-neural { animation: pulseNeural 3s infinite ease-in-out; }
.animate-float { animation: float 6s infinite ease-in-out; }

.hover-glow:hover { box-shadow: var(--shadow-glow); border-color: var(--accent); }
.glass-panel { background: rgba(255,255,255,0.03); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.08); border-radius: var(--radius); }

/* ═══════════════════════════════════════════
   RESPONSIVIDADE
═══════════════════════════════════════════ */
@media (max-width: 1024px) {
  :root { --sidebar-width: 80px; }
  .logo-text, .account-name, .account-plan, .nav-item span, .upgrade-card, .nav-section-label { display: none; }
  .logo { justify-content: center; }
  .nav-item { justify-content: center; padding: 12px; }
  .grid-2 { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 640px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .page-content { padding: 16px; }
}
