/* =========================================================
   SISTEMA DE DISEÑO 2026 – UNIVERSIDAD PROFESIONAL
   Verde institucional elegante y moderno
========================================================= */

:root {

  /* ===== TIPOGRAFÍA FLUIDA ===== */
  --font-base: clamp(1.5rem, 1rem + 0.5vw, 1.50rem);
  --font-h1: clamp(2rem, 1.8rem + 1.6vw, 6rem);
  --font-h2: clamp(1.9rem, 1.5rem + 1.3vw, 2.5rem);
  --font-h3: clamp(1.5rem, 1.3rem + 0.8vw, 1.8rem);
  --font-btn: 1.50rem;
  --font-table: 1.50rem;

  /* ===== COLORES INSTITUCIONALES ===== */
  --primary-500: #00e676;
  --primary-600: #00c853;
  --primary-700: #00b248;

  --primary-color: var(--primary-500);
  --primary-hover: var(--primary-600);
  --primary-soft: rgba(0, 230, 118, 0.08);
  --primary-glow: rgba(0, 230, 118, 0.25);

  --black: #0f172a;
  --gray-900: #1e293b;
  --gray-700: #475569;
  --gray-600: #64748b;
  --gray-500: #94a3b8;
  --gray-400: #94a3b8;
  --gray-200: #e2e8f0;
  --gray-100: #f8fafc;
  --white: #ffffff;

  /* ===== FONDOS Y EFECTOS ===== */
  --bg-gradient-dark: linear-gradient(135deg, #0f172a, #1e293b);

  /* ===== SOMBRAS ===== */
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.12);
  --shadow-xl: 0 25px 60px rgba(15, 23, 42, 0.18);

  /* ===== BORDES ===== */
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;
  --border-radius-xxl: 32px;

  --transition: 0.3s cubic-bezier(.4,0,.2,1);
  --transition-smooth: 0.4s cubic-bezier(.4,0,.2,1);
}

/* =========================================================
   RESET BASE
========================================================= */

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

body {
  margin: 0;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: var(--font-base);
  background: var(--gray-100);
  color: var(--gray-900);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   CONTENEDOR GLOBAL CENTRADO
========================================================= */

.page-wrapper {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  width: 100%;
}

@media (max-width: 1200px) {
  .page-wrapper { max-width: 960px; }
}

@media (max-width: 992px) {
  .page-wrapper { max-width: 720px; }
}

@media (max-width: 768px) {
  .page-wrapper {
    max-width: 100%;
    padding: 1.5rem 1rem;
  }
}

/* =========================================================
   NAVBAR PROFESIONAL
========================================================= */

.navbar {
  position: sticky;
  top: 0;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  padding: 0.8rem 2rem;
  z-index: 1000;
  border-bottom: 1px solid rgba(0,230,118,0.15);
}

.navbar-brand {
  font-weight: 800;
  font-size: 1.4rem;
  color: var(--white) !important;
  letter-spacing: 1px;
}

.navbar-nav .nav-link {
  color: #cbd5e1 !important;
  font-weight: 600;
  padding: 0.7rem 1.2rem !important;
  border-radius: 50px;
  transition: var(--transition);
}

.navbar-nav .nav-link:hover {
  background: var(--primary-soft);
  transform: translateY(-2px);
}

.navbar-nav .nav-link.active {
  background: var(--primary-color);
  color: white !important;
  box-shadow: 0 0 15px var(--primary-glow);
}

/* =========================================================
   BOTONES
========================================================= */

.btn {
  border-radius: 50px;
  font-weight: 700;
  padding: 0.7rem 1.6rem;
  transition: var(--transition);
}

.btn-success {
  background: var(--primary-color);
  border: none;
}

.btn-success:hover {
  background: var(--primary-hover);
  transform: translateY(-3px);
  box-shadow: 0 8px 25px var(--primary-glow);
}

.btn-outline-success {
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
}

.btn-outline-success:hover {
  background: var(--primary-color);
  color: white;
}

/* =========================================================
   TARJETAS
========================================================= */

.card {
  border: none;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  background: var(--white);
}

.card:hover {
  transform: translateY(-8px);
  box-shadow: var(--shadow-xl);
}

.card-header {
  font-weight: 700;
  background: transparent;
  border-bottom: 1px solid var(--gray-200);
}

/* =========================================================
   TABLAS MODERNAS
========================================================= */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  background: var(--white);
  box-shadow: var(--shadow-md);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-table);
}

.table thead {
  background: var(--gray-900);
  color: white;
}

.table th,
.table td {
  padding: 1rem;
}

.table tbody tr:hover {
  background: var(--primary-soft);
  cursor: pointer;
}

/* =========================================================
   FORMULARIOS
========================================================= */

.form-control {
  border-radius: var(--radius-md);
  border: 2px solid var(--gray-200);
  padding: 0.9rem 1rem;
  transition: var(--transition);
}

.form-control:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

label {
  font-weight: 600;
  margin-bottom: .4rem;
}

/* =========================================================
   ALERTAS
========================================================= */

.alert-success {
  background: var(--primary-soft);
  border-left: 5px solid var(--primary-color);
  border-radius: var(--radius-md);
}

/* =========================================================
   PAGINACIÓN
========================================================= */

.pagination .page-link {
  border-radius: 50px !important;
  border: none;
  margin: 0 4px;
  transition: var(--transition);
}

.pagination .page-link:hover {
  background: var(--primary-color);
  color: white;
}

/* =========================================================
   ERROR PAGE
========================================================= */

.utlvte-error-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  background: var(--bg-gradient-dark);
}

.utlvte-error-card {
  width: 100%;
  max-width: 750px;
  background: var(--white);
  border-radius: var(--border-radius-xxl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: fadeInUp 0.6s ease;
}

.utlvte-error-header {
  padding: 2rem;
  background: var(--bg-gradient-dark);
  border-bottom: 3px solid var(--primary-color);
}

.utlvte-error-body {
  padding: 3rem 2rem;
  text-align: center;
}

.error-title {
  font-size: var(--font-h1);
  font-weight: 800;
  margin-bottom: 1rem;
}

.error-description {
  color: var(--gray-700);
  margin-bottom: 2rem;
}

/* =========================================================
   ANIMACIÓN
========================================================= */

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

/* =========================================================
   ACCESIBILIDAD
========================================================= */

:focus-visible {
  outline: 3px solid var(--primary-color);
  outline-offset: 3px;
  border-radius: 6px;
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* =========================================================
   SCROLL MODERNO
========================================================= */

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--primary-color);
  border-radius: 20px;
}

/* =========================================================
   RESPONSIVE
========================================================= */

@media (max-width: 992px) {
  .navbar { padding: 0.8rem 1rem; }
  .card { margin-bottom: 1.5rem; }
}

@media (max-width: 576px) {
  body { font-size: 0.95rem; }
  .btn { width: 100%; }
}
/* Mejora para el GridView de Yii2 */
.grid-view .filters input {
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    border: 1px solid var(--gray-200);
}

.grid-view .summary {
    margin-bottom: 1rem;
    font-weight: 600;
    color: var(--gray-600);
}

/* Efecto de Vidrio (Glassmorphism) para elementos flotantes */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Badge dinámico para estados (Activo/Inactivo) */
.badge {
    padding: 0.5em 1em;
    border-radius: 50px;
    font-weight: 600;
}

.badge-success { background: var(--primary-soft); color: var(--primary-700); }

/* Animación de carga para botones al hacer submit */
.btn-loading {
    position: relative;
    color: transparent !important;
}

.btn-loading::after {
    content: "";
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px;
    border: 3px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}
/* El contenedor del anillo */
.lds-ring {
  display: inline-block;
  position: relative;
  width: 20px;
  height: 20px;
  vertical-align: middle;
  margin-right: 8px;
}

/* Las 4 capas del anillo para crear el efecto de giro */
.lds-ring div {
  box-sizing: border-box;
  display: block;
  position: absolute;
  width: 100%;
  height: 100%;
  border: 3px solid #fff;
  border-radius: 50%;
  animation: lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
  border-color: #fff transparent transparent transparent;
}

/* Retrasos para que se vea fluido */
.lds-ring div:nth-child(1) { animation-delay: -0.45s; }
.lds-ring div:nth-child(2) { animation-delay: -0.3s; }
.lds-ring div:nth-child(3) { animation-delay: -0.15s; }

@keyframes lds-ring {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Corrección para validación de formularios Yii2 */
.has-error .form-control {
    border-color: #ef4444 !important;
    background-color: #fef2f2;
}
.has-error .help-block {
    color: #ef4444;
    font-size: 0.875rem;
    margin-top: 0.25rem;
    font-weight: 500;
}

/* Mejora de legibilidad en GridView */
.grid-view {
    padding: 1rem;
}
.grid-view table thead th a {
    color: white;
    text-decoration: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.grid-view table thead th a:after {
    content: ' ↕';
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Seguridad: Evitar que el contenido se pegue a los bordes en móviles */
@media (max-width: 768px) {
    .table-container {
        border-radius: 0;
        margin: 0 -1rem;
    }
}

.fade-in {
    animation: fadeInUp 0.5s ease-out;
}

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