/* ========================================
   DETP - Sistema de Seguimiento
   Global Styles
   ======================================== */

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

/* --- CSS Variables ---
   Paleta alineada a la identidad visual del sitio institucional
   (detplr.com.ar): mismos tonos, sin el estilo "glass"/degradé violeta
   que tenía este sistema antes. */
:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-glass: #f8fafc;
  --bg-glass-hover: #f1f5f9;
  --border-glass: #e2e8f0;
  --border-glass-hover: #cbd5e1;

  --text-primary: #242c4f;
  --text-secondary: #334155;
  --text-muted: #64748b;

  --accent-blue: #45658d;
  --accent-blue-hover: #242c4f;
  --accent-blue-glow: rgba(69, 101, 141, 0.15);
  --accent-green: #16a34a;
  --accent-green-glow: rgba(22, 163, 74, 0.1);
  --accent-purple: #35507a;
  --accent-purple-glow: rgba(53, 80, 122, 0.1);
  --accent-amber: #d97706;
  --accent-amber-glow: rgba(217, 119, 6, 0.1);
  --accent-red: #c40404;
  --accent-red-glow: rgba(196, 4, 4, 0.1);

  --gradient-main: linear-gradient(135deg, #242c4f 0%, #45658d 100%);
  --gradient-card: linear-gradient(135deg, rgba(36, 44, 79, 0.05), rgba(69, 101, 141, 0.03));

  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.1);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-glow-blue: 0 0 15px rgba(44, 74, 115, 0.1);

  --transition: all 0.2s ease-in-out;
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Arimo', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Títulos con la misma tipografía (Ubuntu) que usa el sitio institucional
   para sus encabezados. */
h1, h2, h3, h4,
.login-logo h1,
.dashboard-header h1,
.welcome-card h1,
.topbar-brand h2 {
  font-family: 'Ubuntu', 'Arimo', sans-serif;
}

/* --- Background Decoration --- */
body::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background:
    radial-gradient(circle at 20% 20%, rgba(69, 101, 141, 0.05) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(53, 80, 122, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(61, 161, 220, 0.04) 0%, transparent 50%);
  z-index: 0;
  animation: bgFloat 20s ease-in-out infinite;
}

@keyframes bgFloat {

  0%,
  100% {
    transform: translate(0, 0) rotate(0deg);
  }

  33% {
    transform: translate(1%, -1%) rotate(1deg);
  }

  66% {
    transform: translate(-1%, 1%) rotate(-1deg);
  }
}

/* --- Utility Classes --- */
.container {
  position: relative;
  z-index: 1;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
}

/* --- Login Specific --- */
.login-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  padding: 48px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-lg), var(--shadow-glow-blue);
  animation: cardAppear 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes cardAppear {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.login-logo {
  text-align: center;
  margin-bottom: 36px;
}

.login-logo .logo-icon {
  width: 72px;
  height: 72px;
  background: var(--gradient-main);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 32px;
  box-shadow: 0 4px 20px rgba(61, 161, 220, 0.35);
  animation: logoPulse 3s ease-in-out infinite;
}

@keyframes logoPulse {

  0%,
  100% {
    box-shadow: 0 4px 20px rgba(61, 161, 220, 0.35);
  }

  50% {
    box-shadow: 0 4px 30px rgba(61, 161, 220, 0.55);
  }
}

.login-logo h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.login-logo p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  margin-top: 4px;
}

/* --- Form Elements --- */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-glass);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: 'Arimo', sans-serif;
  font-size: 0.95rem;
  transition: var(--transition);
  outline: none;
}

.form-input::placeholder {
  color: var(--text-muted);
}

.form-input:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px var(--accent-blue-glow);
  background: rgba(255, 255, 255, 0.06);
}

.form-input:hover:not(:focus) {
  border-color: var(--border-glass-hover);
  background: var(--bg-glass-hover);
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-family: 'Arimo', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  width: 100%;
  background: var(--gradient-main);
  color: white;
  box-shadow: 0 4px 16px rgba(61, 161, 220, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(61, 161, 220, 0.45);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-glass);
  color: var(--text-primary);
  border: 1px solid var(--border-glass);
}

.btn-secondary:hover {
  background: var(--bg-glass-hover);
  border-color: var(--border-glass-hover);
}

.btn-danger {
  background: rgba(196, 4, 4, 0.12);
  color: var(--accent-red);
  border: 1px solid rgba(196, 4, 4, 0.2);
  padding: 8px 14px;
  font-size: 0.8rem;
}

.btn-danger:hover {
  background: rgba(196, 4, 4, 0.2);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 0.8rem;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
}

/* Spinner inside button */
.btn .spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --- Alert Messages --- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 20px;
  display: none;
  align-items: center;
  gap: 8px;
  animation: alertSlide 0.3s ease;
}

@keyframes alertSlide {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert.show {
  display: flex;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fee2e2;
  color: #991b1b;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #d1fae5;
  color: #065f46;
}

/* --- Top Navigation Bar --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--accent-blue);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 0 24px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.topbar-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.topbar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-brand .brand-icon {
  width: 36px;
  height: 36px;
  background: #ffffff;
  color: var(--accent-blue);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.topbar-brand h2 {
  font-size: 1.2rem;
  font-weight: 800;
  color: #ffffff;
}

.topbar-brand span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-left: 8px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  font-size: 0.85rem;
}

.topbar-user .user-avatar {
  width: 32px;
  height: 32px;
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: white;
}

.btn-logout {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: white;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-family: 'Arimo', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-logout:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* --- Dashboard Layout --- */
.dashboard {
  padding: 32px 0;
  position: relative;
  z-index: 1;
}

.dashboard-header {
  margin-bottom: 32px;
}

.dashboard-header h1 {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 4px;
}

.dashboard-header p {
  color: var(--text-secondary);
  font-size: 0.925rem;
}

/* --- Stats Grid --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.stat-card.blue::before {
  background: var(--accent-blue);
}

.stat-card.green::before {
  background: var(--accent-green);
}

.stat-card.purple::before {
  background: var(--accent-purple);
}

.stat-card.amber::before {
  background: var(--accent-amber);
}

.stat-card:hover {
  border-color: var(--border-glass-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-card .stat-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  margin-bottom: 16px;
}

.stat-card.blue .stat-icon {
  background: rgba(69, 101, 141, 0.15);
}

.stat-card.green .stat-icon {
  background: rgba(16, 185, 129, 0.15);
}

.stat-card.purple .stat-icon {
  background: rgba(53, 80, 122, 0.15);
}

.stat-card.amber .stat-icon {
  background: rgba(245, 158, 11, 0.15);
}

.stat-card .stat-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1;
  margin-bottom: 4px;
}

.stat-card .stat-label {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* --- Content Grid (Form + Table) --- */
.content-grid {
  display: grid;
  grid-template-columns: 400px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 900px) {
  .content-grid {
    grid-template-columns: 1fr;
  }
}

/* --- Panels / Cards --- */
.panel {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  overflow: hidden;
  animation: cardAppear 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.panel-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-glass);
  display: flex;
  align-items: center;
  gap: 12px;
}

.panel-header .panel-icon {
  font-size: 20px;
}

.panel-header h3 {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.panel-body {
  padding: 24px;
}

/* --- Form inside panels --- */
.panel-body .form-group {
  margin-bottom: 16px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* --- Table --- */
.table-wrapper {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

table thead th {
  padding: 14px 20px;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

table tbody td {
  padding: 14px 20px;
  font-size: 0.875rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.04);
  color: var(--text-secondary);
}

table tbody tr {
  transition: var(--transition);
}

table tbody tr:hover {
  background: var(--bg-glass-hover);
}

table tbody tr:last-child td {
  border-bottom: none;
}

.table-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-muted);
}

.table-empty .empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
  opacity: 0.3;
}

.table-empty p {
  font-size: 0.9rem;
}

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(69, 101, 141, 0.1);
  color: var(--accent-blue);
  border: 1px solid rgba(69, 101, 141, 0.2);
}

/* --- Institution Welcome --- */
.welcome-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 48px 24px;
  position: relative;
  z-index: 1;
}

.welcome-card {
  text-align: center;
  max-width: 600px;
  animation: cardAppear 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.welcome-icon {
  width: 100px;
  height: 100px;
  background: var(--gradient-main);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  margin: 0 auto 24px;
  box-shadow: 0 8px 32px rgba(61, 161, 220, 0.35);
  animation: logoPulse 3s ease-in-out infinite;
}

.welcome-card h1 {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 8px;
}

.welcome-card .institution-name {
  font-size: 1.25rem;
  background: var(--gradient-main);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: 700;
  margin-bottom: 8px;
}

.welcome-card .welcome-meta {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 32px;
}

.welcome-card .welcome-message {
  color: var(--text-secondary);
  font-size: 0.95rem;
  max-width: 480px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

/* Feature cards grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.feature-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  padding: 24px 16px;
  text-align: center;
  transition: var(--transition);
  position: relative;
}

.feature-card::after {
  content: 'Próximamente';
  position: absolute;
  top: 8px;
  right: 8px;
  font-size: 0.6rem;
  padding: 2px 8px;
  border-radius: 100px;
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.feature-card:hover {
  border-color: var(--border-glass-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.feature-card .feature-icon {
  font-size: 28px;
  margin-bottom: 12px;
}

.feature-card h4 {
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.feature-card p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* --- Toast Notification --- */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: var(--shadow-lg);
  transform: translateY(100px);
  opacity: 0;
  transition: var(--transition);
  z-index: 1000;
  max-width: 400px;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.success {
  border-left: 3px solid var(--accent-green);
}

.toast.error {
  border-left: 3px solid var(--accent-red);
}

.toast-message {
  font-size: 0.875rem;
  color: var(--text-primary);
}

/* --- Password toggle --- */
.input-wrapper {
  position: relative;
}

.input-wrapper .form-input {
  padding-right: 44px;
}

.toggle-password {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  transition: var(--transition);
}

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

/* --- Responsive --- */
@media (max-width: 640px) {
  .login-card {
    padding: 32px 24px;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .topbar-brand span {
    display: none;
  }

  .features-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* --- Export Menu --- */
.export-menu {
  animation: menuAppear 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes menuAppear {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.export-item:hover {
  background: var(--bg-glass-hover) !important;
  color: var(--accent-blue) !important;
}

.export-item span {
  filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.1));
}