/* ===== ESTILOS COMUNES - COLEGIO ENFERMERÍA CÁDIZ ===== */

/* Variables CSS para consistencia */
:root {
  --primary-color: #003366;
  --primary-light: #004080;
  --secondary-color: #e6f0ff;
  --background-color: #f5f7fa;
  --text-color: #333;
  --border-color: #e0e0e0;
  --shadow-light: 0 2px 4px rgba(0,0,0,0.05);
  --shadow-medium: 0 4px 12px rgba(0,0,0,0.1);
  --border-radius: 8px;
  --border-radius-large: 12px;
  --transition: 0.3s ease;
}

/* Reset y estilos base */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* ===== HEADER COMÚN ===== */
header {
  background-color: #f8f9fa;
  color: var(--text-color);
  padding: 16px 24px;
  border-bottom: 2px solid #ccc;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-medium);
  flex-wrap: wrap;
}

.logo-title {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-title img {
  height: 50px;
  width: auto;
}

.logo-title h1 {
  margin: 0;
  font-size: 1.3em;
  font-weight: 600;
  line-height: 1.2;
  color: #222;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
  background-color: var(--secondary-color);
  padding: 12px 24px;
  font-size: 0.9em;
  border-bottom: 1px solid var(--border-color);
}

.breadcrumb a {
  color: var(--primary-color);
  text-decoration: none;
  margin-right: 5px;
}

.breadcrumb a:hover {
  text-decoration: underline;
}

/* ===== CONTENEDORES ===== */
.container {
  max-width: 600px;
  margin: 40px auto;
  background-color: white;
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-medium);
  overflow: hidden;
}

.container-wide {
  max-width: 800px;
}

.container-grid {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 30px;
  max-width: 1200px;
}

/* ===== SECCIONES ===== */
.header-section {
  background-color: var(--primary-color);
  color: white;
  padding: 30px;
  text-align: center;
}

.header-section h2 {
  margin: 0 0 10px;
  font-size: 1.6em;
  font-weight: 600;
}

.header-section p {
  margin: 0;
  opacity: 0.9;
  font-size: 1em;
}

.content-section {
  padding: 30px;
}

/* ===== FORMULARIOS ===== */
.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-color);
}

.required {
  color: #dc3545;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid var(--border-color);
  border-radius: var(--border-radius);
  font-size: 1em;
  transition: border-color var(--transition);
  font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--primary-color);
}

.form-group textarea {
  min-height: 120px;
  resize: vertical;
}

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

/* ===== GRUPOS DE RADIO Y CHECKBOX ===== */
.radio-group {
  display: flex;
  gap: 20px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.radio-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.radio-item input[type="radio"],
.checkbox-group input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 20px 0;
}

.checkbox-group input[type="checkbox"] {
  margin-top: 4px;
}

.checkbox-label {
  font-size: 0.95em;
  line-height: 1.4;
}

.checkbox-label a {
  color: var(--primary-color);
  text-decoration: none;
}

.checkbox-label a:hover {
  text-decoration: underline;
}

/* ===== CAMPOS CONDICIONALES ===== */
.conditional-fields {
  margin-top: 15px;
  padding: 15px;
  background-color: #f8f9fa;
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);
  display: none;
}

.conditional-fields.show {
  display: block;
}

/* ===== BOTONES ===== */
.btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 1em;
  font-weight: 500;
  transition: background-color var(--transition);
  width: 100%;
  margin-bottom: 10px;
  font-family: inherit;
}

.btn:hover:not(:disabled) {
  background-color: var(--primary-light);
}

.btn:disabled {
  background-color: #ccc;
  cursor: not-allowed;
}

.btn-secondary {
  background-color: #6c757d;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #545b62;
}

.btn-link {
  background: none;
  color: var(--primary-color);
  border: none;
  padding: 8px 0;
  cursor: pointer;
  text-decoration: underline;
  font-size: 0.95em;
}

.btn-link:hover {
  color: var(--primary-light);
}

/* ===== ALERTAS ===== */
.alert {
  padding: 15px;
  border-radius: var(--border-radius);
  margin: 20px 0;
  font-weight: 500;
}

.alert-info {
  background-color: #d1ecf1;
  color: #0c5460;
  border: 1px solid #bee5eb;
}

.alert-success {
  background-color: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.alert-error {
  background-color: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

.alert-warning {
  background-color: #fff3cd;
  color: #856404;
  border: 1px solid #ffeaa7;
}

/* ===== ELEMENTOS DE INFORMACIÓN ===== */
.info-box {
  background-color: #f8f9fa;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 20px;
  margin: 20px 0;
}

.info-box h4 {
  margin: 0 0 10px;
  color: var(--primary-color);
}

.info-box p {
  margin: 5px 0;
  font-size: 0.95em;
}

/* ===== SIDEBAR ===== */
.sidebar {
  background-color: white;
  border-radius: var(--border-radius-large);
  box-shadow: var(--shadow-medium);
  padding: 20px;
  height: fit-content;
}

.sidebar h3 {
  margin: 0 0 15px;
  color: var(--primary-color);
  font-size: 1.2em;
}

.contact-item {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f0;
}

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

.contact-item .icon {
  color: var(--primary-color);
  font-weight: bold;
}

/* ===== UTILIDADES ===== */
.hidden {
  display: none;
}

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

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

.char-counter {
  text-align: right;
  font-size: 0.85em;
  color: #666;
  margin-top: 5px;
}

.char-counter.warning {
  color: #dc3545;
}

.divider {
  text-align: center;
  margin: 20px 0;
  position: relative;
}

.divider::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 0;
  right: 0;
  height: 1px;
  background-color: var(--border-color);
}

.divider span {
  background-color: white;
  padding: 0 15px;
  color: #666;
  font-size: 0.9em;
}

/* ===== FOOTER ===== */
footer {
  background-color: var(--primary-color);
  color: white;
  text-align: center;
  padding: 20px;
  font-size: 0.9em;
  border-top-left-radius: var(--border-radius-large);
  border-top-right-radius: var(--border-radius-large);
  margin-top: 40px;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .container {
    margin: 20px;
    max-width: none;
  }
  
  .container-grid {
    grid-template-columns: 1fr;
    margin: 20px;
    max-width: none;
  }
  
  .content-section {
    padding: 20px;
  }

  .logo-title {
    flex-direction: column;
    gap: 8px;
  }

  .logo-title h1 {
    font-size: 1.1em;
    text-align: center;
  }

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

  .radio-group {
    flex-direction: column;
    gap: 10px;
  }

.sidebar {
    order: -1;
  }
}

/* ===== BUZÓN DE MENSAJES - INTEGRACIÓN SIN MODIFICAR EXISTENTE ===== */

/* Contenedor del buzón */
.mailbox-container {
  position: relative;
  display: flex;
  align-items: center;
}

/* Icono del buzón */
.mailbox-icon {
  position: relative;
  cursor: pointer;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border: 1px solid #dee2e6;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.mailbox-icon:hover {
  background: linear-gradient(135deg, #e9ecef 0%, #dee2e6 100%);
  transform: scale(1.05);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.mailbox-icon svg {
  width: 18px;
  height: 18px;
  fill: #495057;
  transition: fill 0.3s ease;
}

.mailbox-icon:hover svg {
  fill: #343a40;
}

/* Badge de notificación */
.notification-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
  color: white;
  border-radius: 50%;
  width: 18px;
  height: 18px;
  font-size: 11px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: mailboxPulse 2s infinite;
  border: 2px solid white;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

/* Dropdown del buzón */
.mailbox-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
  width: 380px;
  max-height: 500px;
  overflow: hidden;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.3s ease;
}

.mailbox-dropdown.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Header del dropdown */
.mailbox-header {
  background: linear-gradient(135deg, #003366 0%, #004080 100%);
  color: white;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.mailbox-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.unread-count {
  background: rgba(255, 255, 255, 0.2);
  padding: 4px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
}

/* Lista de mensajes */
.messages-list {
  max-height: 350px;
  overflow-y: auto;
}

.message-item {
  padding: 12px 20px;
  border-bottom: 1px solid #f1f3f4;
  cursor: pointer;
  transition: background-color 0.2s ease;
  position: relative;
}

.message-item:hover {
  background-color: #f8f9fa;
}

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

.message-item.unread {
  background-color: #f0f8ff;
  border-left: 4px solid #004080;
}

.message-item.unread::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 8px;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  background: #004080;
  border-radius: 50%;
}

.message-sender {
  font-weight: 600;
  font-size: 13px;
  color: #2d3748;
  margin-bottom: 4px;
  display: block;
}

.message-subject {
  font-size: 12px;
  color: #4a5568;
  margin-bottom: 4px;
  font-weight: 500;
}

.message-preview {
  font-size: 11px;
  color: #718096;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}

.message-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 6px;
}

.message-date {
  font-size: 10px;
  color: #a0aec0;
  font-weight: 500;
}

.message-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.message-badge {
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.message-badge.alta {
  background: #fed7d7;
  color: #c53030;
}

.message-badge.respuesta {
  background: #fef5e7;
  color: #d69e2e;
}

.message-badge.nuevo {
  background: #c6f6d5;
  color: #38a169;
}

.message-badge.respondido {
  background: #e6fffa;
  color: #319795;
}

/* Footer del dropdown */
.mailbox-footer {
  padding: 12px 20px;
  background: #f8f9fa;
  border-top: 1px solid #e9ecef;
  text-align: center;
}

.view-all-btn {
  background: linear-gradient(135deg, #003366 0%, #004080 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.view-all-btn:hover {
  background: linear-gradient(135deg, #002244 0%, #003366 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 51, 102, 0.3);
}

/* Estado de carga */
.mailbox-loading {
  text-align: center;
  padding: 30px 20px;
  color: #718096;
}

.mailbox-loading-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid #f1f3f4;
  border-top: 2px solid #004080;
  border-radius: 50%;
  animation: mailboxSpin 1s linear infinite;
  margin-right: 8px;
}

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

/* Estado vacío */
.mailbox-empty {
  text-align: center;
  padding: 30px 20px;
  color: #a0aec0;
}

.mailbox-empty-icon {
  font-size: 24px;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Ajustes de espaciado para el buzón */
.user-menu {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Responsive para el buzón */
@media (max-width: 768px) {
  .user-area {
    margin-right: 80px; /* Más espacio para el buzón en móvil */
  }
  
  .mailbox-dropdown {
    width: 320px;
    right: -10px;
  }
  
  .mailbox-header {
    padding: 12px 15px;
  }
  
  .mailbox-title {
    font-size: 14px;
  }
  
  .message-item {
    padding: 10px 15px;
  }
  
  .message-sender {
    font-size: 12px;
  }
  
  .message-subject {
    font-size: 11px;
  }
  
  .message-preview {
    font-size: 10px;
  }
  
  .mailbox-footer {
    padding: 10px 15px;
  }
}