/* =============================================================
   BASE — Variables, reset, tipografía, layout general
   ============================================================= */

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

:root {
  --bg-app: #f3f6fc;    
  --card-bg: #ffffff;
  --primary: #4f46e5;    
  --primary-gradient: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
  --accent: #0ea5e9;     
  --text-main: #1e293b;
  --text-muted: #64748b;
  --border-light: #e2e8f0;
  --success: #10b981;
  --success-bg: #d1fae5;
  --warning: #f59e0b;
  --danger: #ef4444;
  --gold: #fbbf24;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --shadow-soft: 0 4px 20px -2px rgba(0, 0, 0, 0.05);
  --shadow-hover: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

* { box-sizing: border-box; }
html, body {
  overflow-x: hidden;
  max-width: 100vw;
}
body { 
  font-family: 'Inter', sans-serif; 
  background: var(--bg-app); 
  color: var(--text-main); 
  margin: 0; 
  padding: 20px;
  min-height: 100vh;
  display: flex; 
  flex-direction: column; 
  align-items: center; 
}

/* ===== HEADER ===== */
header {
  width: 100%;
  max-width: 1200px;
  background: var(--card-bg);
  padding: 16px 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-soft);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 20px;
  border: 1px solid rgba(255,255,255,0.5);
}
.header-brand h1 { margin: 0; font-size: 18px; font-weight: 800; color: var(--text-main); letter-spacing: -0.5px; }
.header-brand span { font-size: 13px; color: var(--text-muted); font-weight: 500; }
.score-badge {
  background: var(--bg-app);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-light);
  text-align: right;
}
.score-badge .label { font-size: 10px; text-transform: uppercase; color: var(--text-muted); font-weight: 700; letter-spacing: 0.5px; }
.score-badge .value { font-size: 20px; font-weight: 800; color: var(--primary); line-height: 1; }

/* ===== LAYOUT ===== */
.layout { 
  width: 100%; 
  max-width: 1200px; 
  display: grid; 
  grid-template-columns: 1fr 340px; 
  gap: 24px; 
}
.task-container, .card-box {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-light);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  padding: 20px;
  transition: var(--transition);
}

/* ===== PESTAÑAS ===== */
.nav-tabs { display: flex; gap: 8px; background: #f1f5f9; padding: 4px; border-radius: var(--radius-md); }
.tab-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  color: var(--text-muted);
  font-size: 13px;
  transition: var(--transition);
}
.tab-btn:hover { color: var(--primary); background: rgba(255,255,255,0.5); }
.tab-btn.active {
  background: var(--card-bg);
  color: var(--primary);
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* ===== SIDEBAR ===== */
.staff-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px; margin-bottom: 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
}
.staff-row:hover { background: #f8fafc; }
.staff-row.active { 
  background: #eff6ff; 
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(79, 70, 229, 0.15);
}
.xp-bar { height: 6px; background: #e2e8f0; border-radius: 3px; margin-top: 6px; overflow: hidden; }
.xp-fill { height: 100%; border-radius: 3px; transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1); }

/* ===== BOTONES ===== */
.btn-action {
  width: 100%; padding: 14px; border: none; border-radius: var(--radius-md);
  font-weight: 600; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: var(--transition);
}
.btn-print { background: var(--text-main); color: white; }
.btn-print:hover { background: black; transform: translateY(-1px); }
.btn-csv { background: white; border: 1px solid var(--border-light); color: var(--text-muted); }
.btn-csv:hover { border-color: var(--primary); color: var(--primary); }
.btn-reset {
  background: none;
  border: 1px solid transparent;
  color: #94a3b8; 
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  margin-top: 15px;
  padding: 8px;
  width: 100%;
  border-radius: 8px;
  transition: all 0.2s ease;
  text-decoration: none; 
}
.btn-reset:hover {
  background: #fef2f2; 
  color: #ef4444;   
  border-color: #fecaca;
}

/* ===== TOAST ===== */
.toast-container {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #1e293b;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.2);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 10000;
  font-weight: 600;
  font-size: 14px;
}
.toast-active { transform: translateX(-50%) translateY(0); }
.toast-error { border-left: 4px solid #ef4444; }
.toast-success { border-left: 4px solid #22c55e; }
.toast-warning { border-bottom: 4px solid #f59e0b; }

/* ===== ALERTAS ===== */
#priorityAlert { 
  width: 100%; max-width: 1200px;
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b;
  padding: 15px; border-radius: var(--radius-md); text-align: center;
  margin-bottom: 20px; display: none;
  animation: bounce 0.5s;
}
@keyframes bounce { 0%{transform:scale(0.95);opacity:0} 70%{transform:scale(1.02)} 100%{transform:scale(1)} }
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE BASE ===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  header { justify-content: center; text-align: center; }
  .header-brand { width: 100%; margin-bottom: 10px; }
  .nav-tabs { width: 100%; justify-content: center; }
}
@media (max-width: 600px) {
  body { padding: 8px; }
  header {
    padding: 10px 8px;
    gap: 8px;
    border-radius: 12px;
    width: calc(100vw - 16px);
    box-sizing: border-box;
  }
  .header-tabs {
    padding: 6px 2px;
    gap: 0;
    width: 100%;
    overflow: hidden;
  }
  .tab-btn {
    flex: 1;
    min-width: 0;
    padding: 4px 0;
    max-width: 60px;
  }
  .tab-icon { font-size: 18px; line-height: 1; }
  .nav-avatar {
    width: 22px !important;
    height: 22px !important;
    font-size: 12px !important;
  }
  .tab-text,
  .tab-btn:hover .tab-text,
  .tab-btn.active .tab-text {
    display: none !important;
  }
  header { overflow: hidden; }
}