/**
 * Estilos Personalizados - Autorizador Dynamicoz
 * D'Agostini Sistemas
 * Diseño profesional con colores Dynamicoz
 */

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

:root {
  --primary-color: #0A2540;
  --primary-dark: #061729;
  --secondary-color: #425466;
  --accent-color: #00A86B;
  --dark: #1a202c;
  --text: #4a5568;
  --bg-light: #F6F9FC;
  --bg-white: #FFFFFF;
  --text-dark: #0A2540;
  --text-gray: #6C757D;
  --border-color: #e6ebf1;
  --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --border-radius: 12px;
  --border-radius-sm: 8px;
  --border-radius-lg: 16px;
  --transition: all 0.3s ease;
}

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

body {
  font-family: 'Poppins', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-light);
  color: var(--text-dark);
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Loader Mejorado con ECG */
.loader {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(10, 37, 64, 0.97);
  backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.hidden {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  text-align: center;
}

.loader-logo {
  font-size: 3.5rem;
  font-weight: 800;
  color: white;
  margin-bottom: 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.loader-logo i {
  color: var(--accent-color);
  animation: heartbeatPulse 1.2s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(0, 168, 107, 0.6));
}

@keyframes heartbeatPulse {
  0%, 100% {
    transform: scale(1);
    color: var(--accent-color);
  }
  10% {
    transform: scale(1.3);
    color: #00d680;
  }
  20% {
    transform: scale(1);
    color: var(--accent-color);
  }
}

/* ECG Line Container */
.ecg-container {
  width: 300px;
  height: 80px;
  position: relative;
  margin: 0 auto;
  overflow: hidden;
}

.ecg-line {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}

.ecg-line svg {
  width: 100%;
  height: 100%;
}

.ecg-path {
  stroke: #00d680;
  stroke-width: 2.5;
  fill: none;
  filter: drop-shadow(0 0 8px rgba(0, 214, 128, 0.8));
  animation: ecgAnimation 1.2s ease-in-out infinite;
}

@keyframes ecgAnimation {
  0% {
    stroke-dashoffset: 0;
    opacity: 1;
  }
  100% {
    stroke-dashoffset: -600;
    opacity: 0.8;
  }
}

/* Loader Pequeño (para cargas internas) */
.mini-loader {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(10, 37, 64, 0.95);
  backdrop-filter: blur(8px);
  padding: 2rem 2.5rem;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  display: none;
  text-align: center;
}

.mini-loader.show {
  display: block;
  animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
  from {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.mini-loader-content {
  text-align: center;
}

.mini-loader-logo {
  font-size: 2rem;
  font-weight: 800;
  color: white;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
}

.mini-loader-logo i {
  color: var(--accent-color);
  font-size: 2.2rem;
  animation: heartbeatPulse 1.2s ease-in-out infinite;
  filter: drop-shadow(0 0 10px rgba(0, 168, 107, 0.6));
}

.mini-ecg-container {
  width: 200px;
  height: 50px;
  position: relative;
  margin: 0 auto;
  overflow: hidden;
}

.mini-ecg-line {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
}

.mini-ecg-line svg {
  width: 100%;
  height: 100%;
}

.mini-ecg-path {
  stroke: #00d680;
  stroke-width: 2;
  fill: none;
  filter: drop-shadow(0 0 6px rgba(0, 214, 128, 0.8));
  animation: ecgAnimation 1.2s ease-in-out infinite;
}

.mini-loader-text {
  color: rgba(255,255,255,0.85);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 1.2rem;
  letter-spacing: 1px;
}

/* Notificación de Bienvenida */
.welcome-notification {
  position: fixed;
  top: 20px;
  right: -400px;
  width: 350px;
  background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  z-index: 9998;
  transition: right 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.welcome-notification.show {
  right: 20px;
}

.welcome-notification.hide {
  right: -400px;
}

.welcome-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.welcome-icon {
  font-size: 2.5rem;
  animation: bounceWelcome 1s ease infinite;
}

@keyframes bounceWelcome {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

.welcome-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin: 0;
}

.welcome-message {
  font-size: 0.95rem;
  opacity: 0.95;
  margin-bottom: 0.5rem;
}

.welcome-user {
  font-weight: 600;
  font-size: 1.1rem;
}

.welcome-role {
  font-size: 0.85rem;
  opacity: 0.85;
  font-style: italic;
}

.loader-text {
  color: rgba(255,255,255,0.85);
  margin-top: 2rem;
  font-size: 1rem;
  letter-spacing: 3px;
  font-weight: 500;
  text-transform: uppercase;
}

@media (max-width: 768px) {
  .loader-logo {
    font-size: 2.5rem;
  }

  .ecg-container {
    width: 250px;
  }
}

@media (max-width: 480px) {
  .loader-logo {
    font-size: 2rem;
  }

  .ecg-container {
    width: 200px;
    height: 60px;
  }
}

/* Marca de agua flotante */
.watermark {
  position: fixed;
  bottom: 20px;
  right: 20px;
  font-size: 11px;
  color: rgba(10, 37, 64, 0.3);
  font-weight: 600;
  letter-spacing: 0.5px;
  z-index: 9999;
  pointer-events: none;
  user-select: none;
  text-align: right;
  line-height: 1.4;
}

.watermark-login {
  position: absolute;
  bottom: 30px;
  right: 30px;
}

/* ========== LOGIN PAGE ========== */

.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  animation: rotate 30s linear infinite;
}

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

.login-card {
  background: var(--bg-white);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 50px 40px;
  width: 100%;
  max-width: 440px;
  position: relative;
  z-index: 1;
  animation: slideUp 0.6s ease;
}

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

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

.login-logo h1 {
  font-size: 28px;
  font-weight: 700;
  color: var(--primary-color);
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.login-logo p {
  font-size: 13px;
  color: var(--text-gray);
  font-weight: 500;
}

.form-label {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dark);
  margin-bottom: 8px;
  display: block;
}

.form-control {
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  transition: var(--transition);
  font-family: inherit;
}

.form-control:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 0 4px rgba(0, 168, 107, 0.1);
  outline: none;
}

/* ========== BUTTONS ========== */

.btn {
  border-radius: var(--border-radius-sm);
  padding: 12px 24px;
  font-weight: 600;
  font-size: 14px;
  transition: var(--transition);
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-color) 0%, #00c97b 100%);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  background: linear-gradient(135deg, #00c97b 0%, var(--accent-color) 100%);
}

.btn-success {
  background: linear-gradient(135deg, var(--accent-color) 0%, #00c97b 100%);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-success:hover {
  background: linear-gradient(135deg, #00c97b 0%, var(--accent-color) 100%);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: var(--accent-color);
  color: white;
}

.btn-danger:hover {
  background: #ff5252;
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

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

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

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
}

/* ========== MAIN LAYOUT ========== */

.app-container {
  display: flex;
  min-height: 100vh;
  background: var(--bg-light);
}

/* Sidebar */
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, var(--primary-color) 0%, #0f3a5f 100%);
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  position: fixed;
  height: 100vh;
  z-index: 1000;
  transition: width 0.3s ease;
  overflow: visible;
}

.sidebar.collapsed {
  width: 70px;
}

.sidebar-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 15px 6px;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.sidebar-logo-img {
    width: 120px;
    height: 120px;
    margin-bottom: 6px;
    object-fit: contain;
    border-radius: 6px;
}

.convenio-subtitle {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.15);
    padding: 4px 10px;
    border-radius: 6px;
    margin-top: 0;
    margin-bottom: 0;
    display: inline-block;
    border: 1px solid rgba(255, 255, 255, 0.3);
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

.sidebar.collapsed .sidebar-header {
  padding: 15px 10px;
}

.sidebar-logo-icon {
  font-size: 35px;
  color: var(--accent-color);
  margin-bottom: 8px;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.2));
  animation: heartbeat 2s ease-in-out infinite;
  transition: font-size 0.3s ease;
}

.sidebar.collapsed .sidebar-logo-icon {
  font-size: 24px;
  margin-bottom: 0;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.1); }
  50% { transform: scale(1); }
}

.sidebar-header h2 {
  font-size: 16px;
  font-weight: 700;
  color: white;
  margin-bottom: 3px;
  letter-spacing: -0.5px;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-header h2 {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar-header p {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .sidebar-header p {
  opacity: 0;
  height: 0;
  margin: 0;
  overflow: hidden;
}

/* Botón toggle */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  right: -18px;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent-color) 0%, #00c97b 100%);
  border: 3px solid white;
  border-radius: 50%;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 168, 107, 0.4);
  z-index: 1001;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.sidebar-toggle:hover {
  background: linear-gradient(135deg, #00c97b 0%, var(--accent-color) 100%);
  transform: translateY(-50%) scale(1.15);
  box-shadow: 0 6px 16px rgba(0, 168, 107, 0.6);
}

.sidebar-toggle:active {
  transform: translateY(-50%) scale(0.95);
}

.sidebar-toggle i {
  transition: transform 0.3s ease;
  font-size: 16px;
}

.sidebar.collapsed .sidebar-toggle i {
  transform: rotate(180deg);
}

.sidebar-nav {
  flex: 1;
  padding: 4px 0;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Scrollbar personalizado para el sidebar */
.sidebar-nav::-webkit-scrollbar {
  width: 6px;
}

.sidebar-nav::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  margin: 5px;
}

.sidebar-nav::-webkit-scrollbar-thumb {
  background: var(--accent-color);
  border-radius: 10px;
  transition: background 0.3s ease;
}

.sidebar-nav::-webkit-scrollbar-thumb:hover {
  background: #00d680;
}

/* Para Firefox */
.sidebar-nav {
  scrollbar-width: thin;
  scrollbar-color: var(--accent-color) rgba(255, 255, 255, 0.05);
}

.nav-item {
  margin: 0px 10px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  border-radius: var(--border-radius-sm);
  transition: var(--transition);
  font-weight: 500;
  font-size: 12px;
  white-space: nowrap;
}

.sidebar.collapsed .nav-link {
  padding: 10px;
  justify-content: center;
}

.nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateX(4px);
}

.sidebar.collapsed .nav-link:hover {
  transform: translateX(0);
}

.nav-link.active {
  background: var(--accent-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.nav-link i {
  width: 20px;
  text-align: center;
  font-size: 16px;
  flex-shrink: 0;
}

.nav-link span {
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .nav-link span {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

/* Separadores de sección */
.nav-section-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
  margin: 5px 18px 3px 18px;
  list-style: none;
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .nav-section-divider {
  margin: 5px 10px 3px 10px;
}

/* Títulos de sección */
.nav-section-title {
  padding: 3px 18px 1px 24px;
  color: rgba(255, 255, 255, 0.5);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  list-style: none;
  margin-bottom: 2px;
  transition: all 0.2s ease;
}

.sidebar.collapsed .nav-section-title {
  opacity: 0;
  height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.sidebar-footer {
  padding: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

.sidebar.collapsed .sidebar-footer {
  padding: 8px 5px;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 6px;
  color: white;
  margin-bottom: 6px;
  transition: all 0.3s ease;
}

.sidebar.collapsed .user-info {
  justify-content: center;
  margin-bottom: 6px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 13px;
  flex-shrink: 0;
}

.user-details {
  transition: opacity 0.2s ease;
}

.sidebar.collapsed .user-details {
  opacity: 0;
  width: 0;
  overflow: hidden;
}

.user-details h4 {
  font-size: 12px;
  font-weight: 600;
  margin: 0;
}

.user-details p {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  margin: 0;
}

/* Botón de Logout */
#logoutButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s ease;
}

#logoutButton i {
  font-size: 14px;
}

.sidebar.collapsed #logoutButton {
  padding: 8px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  gap: 0;
}

.sidebar.collapsed #logoutButton {
  font-size: 0;
}

.sidebar.collapsed #logoutButton i {
  font-size: 18px;
}

/* Main Content */
.main-content {
  flex: 1;
  margin-left: 260px;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s ease;
}

.sidebar.collapsed ~ .main-content {
  margin-left: 70px;
}

.topbar {
  background: var(--bg-white);
  padding: 20px 35px;
  box-shadow: var(--shadow-sm);
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.content-area {
  padding: 30px 35px;
  flex: 1;
}

/* ========== CARDS ========== */

.card {
  background: var(--bg-white);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  margin-bottom: 25px;
  transition: var(--transition);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  padding: 20px 25px;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-light);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.card-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.card-body {
  padding: 25px;
}

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

.stat-card {
  background: var(--bg-white);
  border-radius: var(--border-radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 18px;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

.stat-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: white;
}

.stat-icon.blue {
  background: linear-gradient(135deg, var(--primary-color) 0%, #0f3a5f 100%);
}

.stat-icon.green {
  background: linear-gradient(135deg, var(--accent-color) 0%, #00c97b 100%);
}

.stat-icon.red {
  background: linear-gradient(135deg, #FF6B6B 0%, #ff5252 100%);
}

.stat-icon.purple {
  background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
}

.stat-icon.orange {
  background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
}

.stat-icon.teal {
  background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
}

.stat-icon.indigo {
  background: linear-gradient(135deg, #5c6bc0 0%, #3f51b5 100%);
}

.stat-icon.pink {
  background: linear-gradient(135deg, #e91e63 0%, #c2185b 100%);
}

.stat-info h4 {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.stat-info p {
  font-size: 13px;
  color: var(--text-gray);
  margin: 0;
  font-weight: 500;
}

/* ========== FORMS ========== */

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 20px;
}

.input-with-icon {
  position: relative;
}

.input-with-icon input {
  padding-right: 45px;
}

.input-icon {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--accent-color);
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
}

.input-icon:hover {
  color: #00c97b;
  transform: translateY(-50%) scale(1.1);
}

/* ========== TABLES ========== */

.table-container {
  overflow-x: auto;
  border-radius: var(--border-radius-sm);
}

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

thead {
  background: var(--bg-light);
}

thead th {
  padding: 16px;
  text-align: left;
  font-weight: 600;
  font-size: 13px;
  color: var(--text-dark);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 2px solid var(--border-color);
}

tbody tr {
  border-bottom: 1px solid var(--border-color);
  transition: var(--transition);
}

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

tbody td {
  padding: 16px;
  font-size: 14px;
  color: var(--text-dark);
}

/* Badges */
.badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-success {
  background: #E8F8F0;
  color: var(--accent-color);
}

.badge-warning {
  background: #FFF4E5;
  color: #FFA726;
}

.badge-danger {
  background: #FFE9E9;
  color: #FF6B6B;
}

/* ========== MODALS ========== */

.modal-content {
  border-radius: var(--border-radius);
  border: none;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  background: var(--bg-light);
  border-bottom: 1px solid var(--border-color);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  padding: 20px 25px;
}

.modal-header h5 {
  font-weight: 700;
  color: var(--text-dark);
  margin: 0;
}

.modal-body {
  padding: 25px;
}

.modal-footer {
  border-top: 1px solid var(--border-color);
  padding: 20px 25px;
}

/* Search Results in Modal */
.search-results {
  max-height: 400px;
  overflow-y: auto;
}

.search-result-item {
  padding: 14px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  margin-bottom: 10px;
  cursor: pointer;
  transition: var(--transition);
}

.search-result-item:hover {
  background: var(--bg-light);
  border-color: var(--accent-color);
  transform: translateX(4px);
}

/* Autocompletado de Afiliados */
.sugerencias-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 2px solid var(--accent-color);
  border-top: none;
  border-radius: 0 0 var(--border-radius-sm) var(--border-radius-sm);
  max-height: 300px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-md);
  display: none;
}

.sugerencias-dropdown.show {
  display: block;
}

.sugerencia-item {
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  border-bottom: 1px solid var(--border-color);
}

.sugerencia-item:last-child {
  border-bottom: none;
}

.sugerencia-item:hover {
  background: var(--bg-light);
  color: var(--accent-color);
}

.sugerencia-item strong {
  color: var(--accent-color);
  display: block;
  margin-bottom: 4px;
}

.sugerencia-item small {
  color: var(--text-gray);
  font-size: 12px;
}

.form-group {
  position: relative;
}

/* ========== PRÁCTICA TABLE ========== */

.practicas-table {
  margin-top: 20px;
}

.practicas-table table {
  width: 100%;
}

.btn-remove {
  background: var(--accent-color);
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-remove:hover {
  background: #ff5252;
  transform: scale(1.1);
}

/* ========== LOADING ========== */

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* ========== ALERTS ========== */

.alert {
  padding: 16px 20px;
  border-radius: var(--border-radius-sm);
  margin-bottom: 20px;
  border-left: 4px solid;
  display: flex;
  align-items: center;
  gap: 12px;
}

.alert-success {
  background: #E8F8F0;
  border-color: #50C878;
  color: #2D6A4F;
}

.alert-danger {
  background: #FFE9E9;
  border-color: #FF6B6B;
  color: #C92A2A;
}

.alert-info {
  background: #E3F2FD;
  border-color: var(--accent-color);
  color: var(--primary-color);
}

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

@media (max-width: 992px) {
  .sidebar {
    transform: translateX(-100%);
    transition: var(--transition);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
  }

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

@media (max-width: 768px) {
  .content-area {
    padding: 20px 15px;
  }

  .topbar {
    padding: 15px 20px;
  }

  .card-body {
    padding: 20px;
  }
}

/* ========== UTILITIES ========== */

.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-3 {
  margin-top: 1rem;
}

.mb-3 {
  margin-bottom: 1rem;
}

.d-none {
  display: none;
}

.w-100 {
  width: 100%;
}

/* ========== FULLCALENDAR CUSTOM STYLES ========== */
#calendar {
    max-width: 100%;
    margin: 0 auto;
    background-color: var(--bg-white);
    padding: 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

.fc .fc-toolbar-title {
    font-size: 1.8em;
    font-weight: 700;
    color: var(--text-dark);
}

.fc .fc-button-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
    transition: var(--transition);
}

.fc .fc-button-primary:hover {
    background-color: var(--primary-dark);
    border-color: var(--primary-dark);
}

.fc .fc-button-primary:focus {
    box-shadow: 0 0 0 0.25rem rgba(10, 37, 64, 0.25);
}

.fc-event {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    font-size: 0.85em;
    padding: 3px 5px;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.fc-event:hover {
    background-color: #00c97b;
}

/* Estilo para turnos finalizados */
.fc-event-finalizado {
    background-color: var(--secondary-color); /* Un color más tenue */
    border-color: var(--secondary-color);
    opacity: 0.7; /* Menos prominente */
    text-decoration: line-through; /* Tachado para indicar finalizado */
}

.fc-event-finalizado:hover {
    background-color: var(--secondary-color);
    opacity: 0.8;
}

/* Estilo para la disponibilidad (background events) */
.fc-event-past {
    opacity: 0.5;
}

.fc-daygrid-event-harness {
    margin-bottom: 2px;
}

/* Estilos para el modal de Detalles del Turno */
.turno-detalles-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
    font-size: 0.95rem;
}

.turno-detalles-grid div {
    padding: 8px 0;
    border-bottom: 1px dashed var(--border-color);
}

.turno-detalles-grid div:last-child {
    border-bottom: none;
}

.turno-detalles-grid .grid-column-span-2 {
    grid-column: span 2;
}

.turno-detalles-grid strong {
    color: var(--primary-color);
    font-weight: 600;
}

.turno-detalles-grid i {
    color: var(--accent-color);
    margin-right: 5px;
}

/* Estilos para los input-group de WhatsApp y Email */
.input-group-text {
    background-color: var(--bg-light);
    border: 1px solid var(--border-color);
    border-right: none;
    color: var(--secondary-color);
}

.input-group .form-control {
    border-left: none;
}

.input-group .form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 168, 107, 0.1);
}

/* Estilos para el modal de Atender Paciente */
#atenderPacienteModal .modal-body {
    padding: 30px;
}

#atenderPacienteModal .modal-header {
    background-color: var(--primary-color);
    color: white;
    border-bottom: none;
}

#atenderPacienteModal .modal-header .modal-title {
    color: white;
}

#atenderPacienteModal .modal-header .btn-close {
    filter: invert(1);
}

#atenderPacienteModal h6 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 15px;
}

#atenderPacienteModal .border-start {
    border-left: 1px solid var(--border-color) !important;
    padding-left: 25px;
}

#atenderPacienteModal textarea.form-control {
    min-height: 100px;
    border-color: var(--border-color);
}

#atenderPacienteModal textarea.form-control:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 168, 107, 0.1);
}

#atenderPacienteModal .modal-footer {
    background-color: var(--bg-light);
    border-top: 1px solid var(--border-color);
}

/* ========================================
   ESTILOS PARA AUTORIZACIONES - TURNOS
   ======================================== */

/* Autorizaciones Autorizadas (Verde) */
.list-group-item-success-subtle {
    background-color: #d1f2e8 !important;
    border-left: 4px solid #28a745 !important;
    transition: all 0.3s ease;
}

.list-group-item-success-subtle:hover {
    background-color: #c1e9db !important;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
}

/* Autorizaciones Pendientes (Amarillo/Naranja) */
.list-group-item-warning-subtle {
    background-color: #fff3cd !important;
    border-left: 4px solid #dc3545 !important;
    opacity: 0.85;
    transition: all 0.3s ease;
}

.list-group-item-warning-subtle:hover {
    opacity: 1;
    box-shadow: 0 2px 8px rgba(220, 53, 69, 0.15);
}

/* Badge de estado Autorizada */
.badge.bg-success i {
    margin-right: 3px;
}

/* Badge de estado Pendiente */
.badge.bg-danger {
    animation: pulse-red 2s ease-in-out infinite;
}

@keyframes pulse-red {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

/* Botón deshabilitado para autorizaciones pendientes */
button[disabled] {
    opacity: 0.6;
    cursor: not-allowed !important;
}

/* Selector en cascada - Estilos */
#assignClinicSelector,
#assignProfessionalSelector {
    font-size: 1rem;
    padding: 0.5rem;
    border: 2px solid #dee2e6;
    transition: border-color 0.3s ease;
}

#assignClinicSelector:focus,
#assignProfessionalSelector:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 0.25rem rgba(0, 168, 107, 0.1);
}

/* Etiquetas de pasos */
#assign-professional-selector-container label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

#assign-professional-selector-container label i {
    color: var(--accent-color);
}

/* Animación para cuando aparece el segundo selector */
#assignPrestadorContainer {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Estilos para el calendario con eventos de disponibilidad */
.fc-event-finalizado {
    opacity: 0.7 !important;
    text-decoration: line-through !important;
}

.fc-event-finalizado .fc-event-title {
    font-style: italic;
}

/* Mejorar visualización de badges en lista */
.badge {
    font-size: 0.75rem;
    padding: 0.35em 0.65em;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* Info alert mejorado */
.alert-info {
    border-left: 4px solid #0dcaf0;
}

/* ========== MEJORAS PARA VISTAS DÍA Y SEMANA ========== */

/* Vista Semana - Mejorar altura y espaciado */
.fc .fc-timegrid-slot {
    height: 4em; /* Altura de cada slot de 30 minutos - MÁS GRANDE */
}

.fc .fc-timegrid-axis-cushion {
    padding: 0 6px;
}

/* Mejorar visualización de eventos en vista día/semana */
.fc-timegrid-event {
    border-radius: 5px !important;
    border-left-width: 5px !important;
    padding: 6px 8px !important;
    font-size: 1rem !important;
}

.fc-timegrid-event .fc-event-main {
    padding: 4px 6px;
}

.fc-timegrid-event .fc-event-title {
    font-weight: 600;
    font-size: 1rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
}

.fc-timegrid-event .fc-event-time {
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 1;
    margin-bottom: 2px;
}

/* Mejorar cabecera de columnas en vista semana */
.fc .fc-col-header-cell {
    padding: 12px 6px;
    font-weight: 600;
    font-size: 1rem;
    background-color: #f8f9fa;
    border-bottom: 2px solid #dee2e6;
}

.fc .fc-col-header-cell-cushion {
    padding: 6px;
}

/* Mejorar eje de tiempo (horas) */
.fc .fc-timegrid-axis {
    font-size: 0.95rem;
    color: #6c757d;
    font-weight: 600;
}

.fc .fc-timegrid-slot-label {
    border-right: 2px solid #dee2e6;
}

/* Líneas de hora más sutiles */
.fc .fc-timegrid-slot-minor {
    border-top-style: dotted;
    border-top-color: #e9ecef;
}

.fc .fc-timegrid-slot-major {
    border-top-color: #dee2e6;
}

/* Mejorar la columna de días */
.fc .fc-timegrid-col {
    border-right: 1px solid #dee2e6;
}

/* Vista día - ajustar ancho para mejor legibilidad */
.fc-timeGridDay-view .fc-timegrid-col {
    min-width: 300px;
}

/* Scroll más suave */
.fc .fc-scroller {
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

.fc .fc-scroller::-webkit-scrollbar {
    width: 8px;
}

.fc .fc-scroller::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.fc .fc-scroller::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.fc .fc-scroller::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Eventos de disponibilidad (background) más discretos */
.fc-timegrid-event.fc-event-start.fc-event-end[style*="background"] {
    opacity: 0.3 !important;
}

/* Hover sobre eventos más claro */
.fc-timegrid-event:hover {
    opacity: 0.95;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 3;
}

/* Hora actual marcada */
.fc .fc-timegrid-now-indicator-line {
    border-color: #dc3545;
    border-width: 2px;
}

.fc .fc-timegrid-now-indicator-arrow {
    border-color: #dc3545;
}

/* Mejorar espaciado general */
.fc .fc-view-harness {
    height: auto !important;
    min-height: 800px !important;
}

/* Título de eventos más legible */
.fc-timegrid-event .fc-event-main-frame {
    flex-direction: column;
}

/* Eventos finalizados en vista día/semana */
.fc-timegrid-event.fc-event-finalizado {
    opacity: 0.6 !important;
    background-color: #95a5a6 !important;
    border-left-color: #7f8c8d !important;
}

.fc-timegrid-event.fc-event-finalizado .fc-event-title {
    text-decoration: line-through;
    font-style: italic;
}

/* Mejorar botones de navegación */
.fc .fc-button {
    padding: 0.5em 1em;
    font-size: 1rem;
    font-weight: 500;
    border-radius: 6px;
}

.fc .fc-button-group {
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    border-radius: 6px;
}

/* Ajustar altura del header del calendario */
.fc .fc-toolbar {
    padding: 20px 15px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e9ecef;
}

/* Responsivo */
@media (max-width: 768px) {
    .list-group-item {
        flex-direction: column;
        align-items: flex-start !important;
    }

    .list-group-item button {
        margin-top: 10px;
        width: 100%;
    }

    /* Ajustes para calendario en móvil */
    .fc .fc-view-harness {
        height: 500px !important;
    }

    .fc .fc-toolbar-title {
        font-size: 1.3em;
    }

    .fc-timegrid-event .fc-event-title {
        font-size: 0.75rem;
    }
}

.sidebar-header p .pami-brand {
  background-color: #FFFFFF;
  color: #007BFF;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
  margin-left: 5px;
}

.pami-checkboxes-container {
  background-color: #f0f8ff;
  border: 1px solid #cce5ff;
  padding: 10px;
  border-radius: 5px;
  margin-bottom: 1rem;
}

/* Estilos para el contenido de eventos de FullCalendar */
.fc-event-main-frame {
    padding: 2px 4px;
}

.fc-event-title-container {
    font-weight: bold;
}

.fc-event-body {
    font-weight: normal;
    font-size: 0.85em;
    margin-top: 2px;
}

.fc-event-body i {
    margin-right: 4px;
}

/* Modal de Confirmación de Logout */
.logout-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(5px);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  animation: fadeIn 0.2s ease;
}

.logout-modal-overlay.show {
  display: flex;
}

.logout-modal {
  background: white;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 400px;
  width: 90%;
  padding: 0;
  animation: slideUp 0.3s ease;
  overflow: hidden;
}

.logout-modal-header {
  background: linear-gradient(135deg, #0A2540 0%, #1a3a5c 100%);
  color: white;
  padding: 20px 25px;
  display: flex;
  align-items: center;
  gap: 15px;
}

.logout-modal-header i {
  font-size: 28px;
  opacity: 0.9;
}

.logout-modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 600;
}

.logout-modal-body {
  padding: 30px 25px;
  text-align: center;
}

.logout-modal-body p {
  font-size: 1.05rem;
  color: #4a5568;
  margin: 0;
  line-height: 1.6;
}

.logout-modal-footer {
  padding: 20px 25px;
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
}

.logout-modal-btn {
  padding: 10px 25px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: 'Poppins', sans-serif;
}

.logout-modal-btn-cancel {
  background: #e9ecef;
  color: #495057;
}

.logout-modal-btn-cancel:hover {
  background: #dee2e6;
  transform: translateY(-1px);
}

.logout-modal-btn-confirm {
  background: #dc3545;
  color: white;
}

.logout-modal-btn-confirm:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(220, 53, 69, 0.3);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

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