/* =============================================
   CITCP – Portal de Delegados (Design System)
   ============================================= */

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

:root {
  --bg:          #0A0F1E;
  --bg-card:     rgba(26, 35, 64, 0.65);
  --green:       #6BBF3D;
  --green-dim:   rgba(107, 191, 61, 0.12);
  --green-border:rgba(107, 191, 61, 0.22);
  --green-glow:  rgba(107, 191, 61, 0.18);
  --white:       #FFFFFF;
  --slate:       #94A3B8;
  --border:      rgba(255,255,255,0.06);
  --nav-h:       72px;
  --radius:      16px;
  --radius-sm:   10px;
  --transition:  0.3s cubic-bezier(0.4,0,0.2,1);
}

body {
  font-family: 'Futura', 'Trebuchet MS', Arial, sans-serif;
  background: var(--bg);
  color: var(--white);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  position: relative;
}

/* Background Gradients and Orbs */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -2;
  background: radial-gradient(circle at 80% 20%, #102a0a 0%, transparent 45%),
              radial-gradient(circle at 10% 80%, #081a3a 0%, transparent 45%),
              #070a14;
  transition: background var(--transition);
}

/* Grid overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(107,191,61,0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(107,191,61,0.015) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
}

/* ===== TYPOGRAPHY ===== */
h1, h2, h3, h4 { font-weight: 800; line-height: 1.2; letter-spacing: -0.02em; }
.text-green { color: var(--green); }
.text-muted { color: var(--slate); }

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* ===== BUTTONS ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--green);
  color: #0A0F1E;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
  box-shadow: 0 4px 15px var(--green-glow);
  border: none;
  cursor: pointer;
  gap: 8px;
}
.btn-primary:hover {
  background: #7fd44a;
  box-shadow: 0 6px 20px rgba(107,191,61,0.4);
  transform: translateY(-2px);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--white);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 11px 24px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1.5px solid rgba(255,255,255,0.15);
  transition: var(--transition);
  cursor: pointer;
  gap: 8px;
}
.btn-outline:hover {
  border-color: var(--white);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-2px);
}

.btn-danger-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: #ef4444;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1.5px solid rgba(239, 68, 68, 0.2);
  transition: var(--transition);
  cursor: pointer;
  gap: 8px;
}
.btn-danger-outline:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239,68,68,0.15);
  transform: translateY(-1px);
}

/* ===== GLASS CARD ===== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--green-border);
  border-radius: var(--radius);
  transition: var(--transition);
}

/* ===== NAVBAR ===== */
.navbar {
  height: var(--nav-h);
  background: rgba(10, 15, 30, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background var(--transition);
}

.nav-inner {
  max-width: 1250px;
  margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo-img {
  height: 52px;
  width: auto;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(107,191,61,0.25));
}

.logo-text {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--slate);
  margin: 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.logo-uso {
  height: 34px;
}

.nav-controls {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--slate);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: var(--transition);
}

.theme-toggle:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.08);
}

/* ===== LOCK SCREEN (FORMULARIO DE ACCESO) ===== */
.lock-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  padding: 40px 0;
  animation: fadeIn 0.5s ease;
}

.lock-card {
  width: 100%;
  max-width: 440px;
  padding: 48px 40px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5), 0 0 30px rgba(107,191,61,0.1);
}

.lock-icon {
  margin: 0 auto 24px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  color: var(--green);
  box-shadow: 0 0 20px rgba(107, 191, 61, 0.1);
}

.lock-title {
  font-size: 1.8rem;
  margin-bottom: 8px;
}

.lock-subtitle {
  font-size: 0.95rem;
  color: var(--slate);
  margin-bottom: 32px;
  line-height: 1.5;
}

.lock-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.input-group {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-group input {
  width: 100%;
  padding: 14px 48px 14px 18px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--white);
  font-family: inherit;
  font-size: 1rem;
  transition: var(--transition);
}

.input-group input:focus {
  outline: none;
  border-color: var(--green);
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 0 16px rgba(107, 191, 61, 0.15);
}

.toggle-password {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--slate);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.toggle-password:hover {
  color: var(--white);
}

.error-message {
  color: #ef4444;
  font-size: 0.88rem;
  text-align: left;
  min-height: 20px;
  margin-top: -10px;
  font-weight: 600;
  display: none;
  animation: fadeIn 0.2s ease;
}

.error-message.visible {
  display: block;
}

/* Shake animation for errors */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.lock-card.shake {
  animation: shake 0.4s ease-in-out;
  border-color: #ef4444;
  box-shadow: 0 0 25px rgba(239, 68, 68, 0.2);
}

/* ===== DASHBOARD (PANEL PRINCIPAL) ===== */
.dashboard {
  padding: 40px 0 60px;
  display: none;
  flex-direction: column;
  gap: 36px;
  animation: fadeIn 0.6s ease;
}

.dashboard.active {
  display: flex;
}

/* Welcome Area */
.welcome-section {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.welcome-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.welcome-badge {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  gap: 6px;
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 6px;
}

.welcome-badge::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px var(--green);
}

.welcome-title {
  font-size: 2.2rem;
  font-weight: 900;
}

.welcome-subtitle {
  color: var(--slate);
  font-size: 1.05rem;
}

/* Date / Time Card */
.datetime-card {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.datetime-icon {
  color: var(--green);
}

.datetime-values {
  display: flex;
  flex-direction: column;
}

.time-display {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}

.date-display {
  font-size: 0.85rem;
  color: var(--slate);
  font-weight: 600;
}

/* Grid of applications */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 24px;
}

.tool-card {
  padding: 32px;
  display: flex;
  flex-direction: column;
  height: 100%;
  position: relative;
  overflow: hidden;
}

.tool-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--green), transparent);
  opacity: 0;
  transition: var(--transition);
}

.tool-card:hover {
  border-color: rgba(107,191,61,0.5);
  box-shadow: 0 12px 30px rgba(0,0,0,0.3), 0 0 20px var(--green-glow);
  transform: translateY(-4px);
}

.tool-card:hover::before {
  opacity: 1;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.tool-icon {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: 54px;
  height: 54px;
  border-radius: var(--radius-sm);
  background: var(--green-dim);
  border: 1px solid var(--green-border);
  color: var(--green);
}

.tool-badge {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--slate);
  border: 1px solid var(--border);
}

.tool-badge.featured {
  background: var(--green-dim);
  color: var(--green);
  border-color: var(--green-border);
}

.tool-card h3 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--slate);
  line-height: 1.6;
  margin-bottom: 28px;
  flex: 1;
}

.tool-action-btn {
  width: 100%;
}

/* ===== FOOTER ===== */
.footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
  padding: 24px 0;
}

.footer-inner {
  max-width: 1250px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.85rem;
  color: var(--slate);
}

.footer-links {
  display: flex;
  gap: 20px;
}

.footer-links a {
  color: var(--slate);
  text-decoration: none;
  transition: var(--transition);
}

.footer-links a:hover {
  color: var(--green);
}

/* ===== LIGHT MODE OVERRIDES ===== */
body.light-mode {
  --bg:          #F8FAFC;
  --bg-card:     rgba(255, 255, 255, 0.85);
  --green:       #5CA833;
  --green-dim:   rgba(92, 168, 51, 0.12);
  --green-border:rgba(92, 168, 51, 0.22);
  --green-glow:  rgba(92, 168, 51, 0.18);
  --white:       #0A0F1E;
  --slate:       #475569;
  --border:      rgba(0,0,0,0.08);
}

body.light-mode::before {
  background: radial-gradient(circle at 80% 20%, rgba(107,191,61,0.08) 0%, transparent 45%),
              radial-gradient(circle at 10% 80%, rgba(13,42,90,0.06) 0%, transparent 45%),
              #F1F5F9;
}

body.light-mode::after {
  background-image:
    linear-gradient(rgba(92,168,51,0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92,168,51,0.02) 1px, transparent 1px);
}

body.light-mode .navbar {
  background: rgba(248, 250, 252, 0.85);
}

body.light-mode .logo-img {
  filter: drop-shadow(0 0 6px rgba(92,168,51,0.15));
}

body.light-mode .logo-uso {
  filter: brightness(0.8) drop-shadow(0 0 6px rgba(0,0,0,0.05));
}

body.light-mode .input-group input {
  background: rgba(0, 0, 0, 0.02);
  color: #0A0F1E;
}

body.light-mode .input-group input:focus {
  background: rgba(0, 0, 0, 0.01);
}

body.light-mode .btn-outline {
  color: #0A0F1E;
  border-color: rgba(0, 0, 0, 0.15);
}

body.light-mode .btn-outline:hover {
  background: rgba(0, 0, 0, 0.04);
  border-color: #0A0F1E;
}

body.light-mode .footer {
  background: rgba(0,0,0,0.01);
}

body.light-mode .tool-badge {
  background: rgba(0, 0, 0, 0.03);
  color: var(--slate);
  border-color: var(--border);
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE MEDIA QUERIES ===== */
@media (max-width: 900px) {
  .logo-text {
    display: none;
  }
  .welcome-section {
    flex-direction: column;
    align-items: flex-start;
  }
  .datetime-card {
    width: 100%;
    justify-content: flex-start;
  }
  .tools-grid {
    grid-template-columns: 1fr;
  }
  .lock-card {
    padding: 36px 24px;
  }
}

@media (max-width: 600px) {
  .navbar {
    height: 64px;
  }
  .logo-img {
    height: 40px;
  }
  .logo-uso {
    height: 26px;
  }
  .nav-controls {
    gap: 8px;
  }
  .btn-danger-outline {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
  .welcome-title {
    font-size: 1.75rem;
  }
  .footer-inner {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }
}
