/* ============================================================
   MEDERI CLÍNICA — Sistema de Diseño Global
   Zero CDNs | Fuentes del sistema | Variables CSS
   ============================================================ */

/* ---------- TOKENS ---------- */
/* ---------- FUENTES ---------- */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;600;700;800&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

:root {
  --clr-primary: #cc0000;
  --clr-primary-dk: #990000;
  --clr-primary-lt: #ff3333;
  --clr-accent: #f39c12;
  --clr-success: #27ae60;
  --clr-warning: #e67e22;
  --clr-danger: #cc0000;
  --clr-info: #2980b9;

  --clr-bg: #fcfdfe;
  --clr-bg-card: #ffffff;
  --clr-surface: #f1f5f9;
  --clr-border: #e2e8f0;

  --clr-text-main: #0f172a;
  --clr-text-muted: #475569;
  --clr-text-light: #94a3b8;

  --font-display: 'Outfit', sans-serif;
  --font-body: 'Plus Jakarta Sans', sans-serif;

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --shadow-sm: 0 1px 4px rgba(0, 0, 0, .08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, .10);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, .14);

  --transition: all .22s cubic-bezier(.4, 0, .2, 1);
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth
}

body {
  font-family: var(--font-body);
  background: var(--clr-bg);
  color: var(--clr-text-main);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--clr-primary);
  text-decoration: none
}

a:hover {
  text-decoration: underline
}

img {
  max-width: 100%;
  display: block
}

button {
  cursor: pointer;
  font-family: inherit
}

input,
select,
textarea {
  font-family: inherit
}

h1, h2, h3 {
  font-family: var(--font-display);
}

h1 {
  font-size: 2.2rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 1.6rem;
  font-weight: 700
}

h3 {
  font-size: 1.2rem;
  font-weight: 700
}

p {
  color: var(--clr-text-muted)
}

/* ---------- UTILIDADES ---------- */
.container {
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 1.5rem
}

.text-center {
  text-align: center
}

.text-muted {
  color: var(--clr-text-muted)
}

.mt-1 {
  margin-top: .5rem
}

.mt-2 {
  margin-top: 1rem
}

.mt-3 {
  margin-top: 1.5rem
}

.mt-4 {
  margin-top: 2rem
}

.mb-1 {
  margin-bottom: .5rem
}

.mb-2 {
  margin-bottom: 1rem
}

.mb-3 {
  margin-bottom: 1.5rem
}

.d-flex {
  display: flex
}

.align-center {
  align-items: center
}

.gap-1 {
  gap: .5rem
}

.gap-2 {
  gap: 1rem
}

.flex-wrap {
  flex-wrap: wrap
}

.w-100 {
  width: 100%
}

.hidden {
  display: none !important
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: .2rem .7rem;
  border-radius: 50px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .03em
}

.badge-success {
  background: #d4edda;
  color: #155724
}

.badge-warning {
  background: #fff3cd;
  color: #856404
}

.badge-danger {
  background: #f8d7da;
  color: #721c24
}

.badge-info {
  background: #d1ecf1;
  color: #0c5460
}

.badge-muted {
  background: #e9ecef;
  color: #495057
}

/* ---------- BOTONES ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  padding: .75rem 1.6rem;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 700;
  border: none;
  transition: all .3s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: var(--clr-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(204, 0, 0, 0.2);
}

.btn-primary:hover {
  background: var(--clr-primary-dk);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(204, 0, 0, 0.35);
}

.btn-secondary {
  background: #fff;
  color: var(--clr-text-main);
  border: 1px solid var(--clr-border);
}

.btn-secondary:hover {
  background: var(--clr-surface);
  transform: translateY(-2px);
  border-color: var(--clr-text-main);
}

.btn-success {
  background: var(--clr-success);
  color: #fff
}

.btn-success:hover {
  background: #1e8449
}

.btn-danger {
  background: var(--clr-danger);
  color: #fff
}

.btn-danger:hover {
  background: #922b21
}

.btn-ghost {
  background: transparent;
  color: var(--clr-text-muted);
  border: 1px solid var(--clr-border)
}

.btn-ghost:hover {
  background: var(--clr-surface);
  color: var(--clr-text-main)
}

.btn-sm {
  padding: .4rem .9rem;
  font-size: .8rem
}

.btn-lg {
  padding: .85rem 2rem;
  font-size: 1.05rem
}

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

/* ---------- CARDS ---------- */
.card {
  background: var(--clr-bg-card);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--clr-border);
  overflow: visible
}

.card-header {
  padding: 1.2rem 1.5rem;
  border-bottom: 1px solid var(--clr-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem
}

.card-body {
  padding: 1.5rem
}

.card-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--clr-border);
  background: var(--clr-surface)
}

/* ---------- FORMULARIOS ---------- */
.form-group {
  margin-bottom: 1.5rem;
  position: relative;
}

.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 700;
  color: var(--clr-text-main);
  margin-bottom: .5rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Estilo Premium para Selector de Fecha Nativo */
input[type="date"] {
  position: relative;
  appearance: none;
  -webkit-appearance: none;
  min-height: 2.8rem;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  background: transparent;
  bottom: 0;
  color: transparent;
  cursor: pointer;
  height: auto;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
  width: auto;
  z-index: 1;
}

input[type="date"]::after {
  content: '📅';
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  pointer-events: none;
  opacity: 0.6;
}

input[type="date"]:focus::after {
  opacity: 1;
  color: var(--clr-primary);
}

.form-control {
  width: 100%;
  padding: .75rem 1rem;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius-md);
  font-size: .95rem;
  background: #f8fafc;
  color: var(--clr-text-main);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
}

.form-control:focus {
  border-color: var(--clr-primary);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(192, 57, 43, .08), var(--shadow-sm);
  transform: translateY(-1px);
}

.form-control::placeholder {
  color: #94a3b8
}

.form-error {
  font-size: .78rem;
  color: var(--clr-danger);
  margin-top: .4rem;
  font-weight: 500;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem
}

@media(max-width:600px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

/* ---------- TABLAS ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--clr-border)
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem
}

thead tr {
  background: var(--clr-surface)
}

th {
  padding: .75rem 1rem;
  text-align: left;
  font-weight: 600;
  color: var(--clr-text-main);
  white-space: nowrap;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 2px solid var(--clr-border)
}

td {
  padding: .7rem 1rem;
  border-bottom: 1px solid var(--clr-border);
  color: var(--clr-text-main);
  vertical-align: middle
}

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

tbody tr:hover {
  background: var(--clr-surface)
}

/* ---------- MODAL ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  z-index: 99998;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  transition: all .3s ease;
}

.modal-overlay.active {
  display: flex !important;
  opacity: 1 !important
}

.modal {
  background: #fff;
  border-radius: 1.25rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  width: 100%;
  max-width: 720px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(20px) scale(.98);
  transition: all .4s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: 99999;
  opacity: 0;
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
  opacity: 1 !important
}

.modal-header {
  padding: 1.5rem 2rem;
  border-bottom: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
}

.modal-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: #1e293b;
  letter-spacing: -0.02em;
}

.modal-close {
  background: #f1f5f9;
  border: none;
  font-size: 1.25rem;
  line-height: 1;
  color: #64748b;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s ease;
  cursor: pointer;
}

.modal-close:hover {
  background: #fee2e2;
  color: var(--clr-danger);
  transform: rotate(90deg);
}

.modal-body {
  padding: 2rem;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: none;
}

.modal-body::-webkit-scrollbar {
  display: none;
}

.modal-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid #f1f5f9;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  background: #f8fafc;
}

/* ---------- TOAST ---------- */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: .5rem
}

.toast {
  background: #1a2332;
  color: #fff;
  padding: .75rem 1.2rem;
  border-radius: var(--radius-md);
  font-size: .88rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: .6rem;
  min-width: 260px;
  max-width: 380px;
  animation: slideIn .3s ease forwards
}

.toast-success {
  border-left: 4px solid var(--clr-success)
}

.toast-error {
  border-left: 4px solid var(--clr-danger)
}

.toast-info {
  border-left: 4px solid var(--clr-info)
}

.toast-warning {
  border-left: 4px solid var(--clr-accent)
}

@keyframes slideIn {
  from {
    transform: translateX(110%);
    opacity: 0
  }

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

@keyframes slideOut {
  from {
    transform: translateX(0);
    opacity: 1
  }

  to {
    transform: translateX(110%);
    opacity: 0
  }
}

.toast.removing {
  animation: slideOut .3s ease forwards
}

/* ---------- PAGINACIÓN ---------- */
.pagination {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-top: 1rem;
  justify-content: center
}

.page-btn {
  padding: .4rem .8rem;
  border: 1px solid var(--clr-border);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: .85rem;
  transition: var(--transition)
}

.page-btn:hover {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary)
}

.page-btn.active {
  background: var(--clr-primary);
  color: #fff;
  border-color: var(--clr-primary)
}

.page-btn:disabled {
  opacity: .4;
  cursor: not-allowed
}

/* ---------- SPINNER ---------- */
.spinner {
  display: inline-block;
  width: 1.2rem;
  height: 1.2rem;
  border: 2.5px solid rgba(255, 255, 255, .3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite
}

.spinner-dark {
  border-color: rgba(0, 0, 0, .15);
  border-top-color: var(--clr-primary)
}

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

/* ---------- EMPTY STATE ---------- */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--clr-text-muted)
}

.empty-state svg {
  opacity: .3;
  margin: 0 auto 1rem
}

.empty-state h3 {
  font-size: 1.1rem;
  margin-bottom: .4rem;
  color: var(--clr-text-muted)
}

/* ============================================================
   PORTAL PÚBLICO
   ============================================================ */
.portal-header {
  background: var(--clr-primary);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
  border-bottom: none
}

.portal-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between
}

.portal-logo {
  display: flex;
  align-items: center;
  gap: .8rem
}

.portal-logo img {
  height: 45px;
  width: auto
}

.portal-logo .brand-name {
  font-size: 1.4rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em
}

.portal-logo .brand-sub {
  font-size: .75rem;
  color: rgba(255, 255, 255, .85);
  letter-spacing: .08em;
  text-transform: uppercase;
  display: block;
  font-weight: 500
}

.btn-portal-admin {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  padding: .5rem 1.2rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  font-weight: 600;
  transition: var(--transition);
  cursor: pointer
}

.btn-portal-admin:hover {
  background: #fff;
  color: var(--clr-primary)
}

.hero-section {
  background: radial-gradient(circle at top right, #fff 0%, #f8fafc 100%);
  color: var(--clr-text-main);
  padding: 8rem 0;
  text-align: left;
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--clr-border)
}

.hero-section::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.025;
  pointer-events: none;
}

.hero-section .container {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 2rem;
  align-items: center
}

.hero-content {
  position: relative;
  z-index: 10
}

.hero-section h1 {
  font-size: 3.5rem;
  font-weight: 800;
  line-height: 1.1;
  margin-bottom: 1.5rem;
  color: var(--clr-text-main);
  letter-spacing: -0.03em
}

.hero-section h1 span {
  color: var(--clr-primary)
}

.hero-section p {
  color: var(--clr-text-muted);
  font-size: 1.2rem;
  max-width: 520px;
  margin-bottom: 2.5rem;
  line-height: 1.6;
  text-align: justify;
}

.hero-actions {
  display: flex;
  gap: 1.2rem;
  justify-content: flex-start
}

.btn-hero-primary {
  background: var(--clr-primary);
  color: #fff;
  padding: .9rem 2.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  border: none;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(192, 57, 43, .3);
  cursor: pointer
}

.btn-hero-primary:hover {
  background: #a93226;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(192, 57, 43, .4)
}

.btn-hero-outline {
  background: transparent;
  color: var(--clr-text-main);
  padding: .9rem 2.5rem;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid var(--clr-border);
  transition: var(--transition);
  cursor: pointer
}

.btn-hero-outline:hover {
  background: var(--clr-surface);
  border-color: var(--clr-text-main)
}

.hero-visual {
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 1
}

.clinical-card {
  width: 280px;
  height: 360px;
  background: linear-gradient(135deg, #fff 0%, #f0f4f8 100%);
  border-radius: 24px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.12);
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
  border: 1px solid #fff
}

.card-line {
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  width: 100%
}

.card-circle {
  width: 60px;
  height: 60px;
  background: rgba(192, 57, 43, 0.1);
  border-radius: 50%;
  margin-top: auto
}

.hero-section h1 span {
  color: var(--clr-primary);
  display: block
}

.section {
  padding: 5rem 0;
  background: #fff
}

.section-title {
  text-align: center;
  margin-bottom: 4rem
}

.section-title h2 {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--clr-text-main);
  letter-spacing: -0.02em
}

.section-title p {
  color: var(--clr-text-muted);
  font-size: 1.1rem;
  margin-top: .6rem
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem
}

.service-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  text-align: left;
  border: 1px solid var(--clr-border);
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  gap: 1rem
}

.service-card:hover {
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.05);
  transform: translateY(-5px);
  border-color: var(--clr-primary)
}

.service-icon {
  width: 54px;
  height: 54px;
  background: rgba(192, 57, 43, .08);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0
}

.service-icon svg {
  color: var(--clr-primary)
}

.service-card h3 {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--clr-text-main)
}

.service-card p {
  font-size: .95rem;
  color: var(--clr-text-muted);
  line-height: 1.5
}

.results-section {
  background: #f8f9fa;
  padding: 6rem 0
}

.results-box {
  background: #fff;
  border-radius: 24px;
  padding: 3.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.04);
  max-width: 600px;
  margin: 0 auto;
  border: 1px solid var(--clr-border);
  text-align: center
}

.results-box h2 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--clr-text-main)
}

.results-box p {
  color: var(--clr-text-muted);
  margin-bottom: 2rem
}

.search-input-wrap {
  display: flex;
  background: #fff;
  padding: 6px;
  border-radius: 16px;
  border: 2px solid var(--clr-border);
  transition: var(--transition)
}

.search-input-wrap:focus-within {
  border-color: var(--clr-primary);
  box-shadow: 0 0 0 4px rgba(192, 57, 43, .08)
}

.search-input-wrap .form-control {
  border: none;
  background: transparent;
  padding: 1rem;
  font-size: 1.1rem
}

.search-input-wrap .form-control:focus {
  box-shadow: none
}

.search-input-wrap .btn {
  border-radius: 12px;
  padding: 0 2rem
}

.portal-footer {
  background: #1a2332;
  color: rgba(255, 255, 255, .6);
  padding: 4rem 0;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, .05)
}

.portal-footer strong {
  color: #fff;
  font-size: 1.2rem;
  display: block;
  margin-bottom: .5rem
}

.portal-footer p {
  max-width: 400px;
  margin: 0 auto
}

button {
  cursor: pointer
}

/* ============================================================
   PANEL ADMIN
   ============================================================ */
#admin-app {
  display: none;
  min-height: 100vh
}

#admin-app.active {
  display: flex
}

.admin-sidebar {
  width: 260px;
  background: #0f172a;
  color: #fff;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: all 0.3s ease;
  position: relative;
  z-index: 100;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-brand {
  padding: 1.5rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-brand .brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.sidebar-brand .brand-sub {
  font-size: 0.65rem;
  color: var(--clr-text-light);
  opacity: 0.7;
}

.sidebar-nav {
  padding: .75rem 0;
  flex: 1
}

.nav-section-title {
  padding: .5rem 1.2rem;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: #5a6a7e
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.9rem 1.25rem;
  text-decoration: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  border-left: 3px solid transparent;
  font-size: 0.9rem;
  font-weight: 500;
  color: #94a3b8;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
}

.nav-item.active {
  background: rgba(192, 57, 43, 0.1);
  border-left-color: var(--clr-primary);
  color: #fff;
  font-weight: 600;
}

.nav-item svg {
  flex-shrink: 0;
  opacity: .8
}

.sidebar-footer {
  padding: 1rem 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, .08)
}

.admin-user-info {
  font-size: .8rem;
  color: #8695a8
}

.admin-user-info strong {
  color: #fff;
  display: block
}

.admin-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden
}

.admin-topbar {
  background: #fff;
  border-bottom: 1px solid var(--clr-border);
  padding: 0.9rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 1px 2px rgba(0,0,0,0.02);
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: #0f172a;
}

.admin-content {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto
}

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem
}

.stat-card {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 1.5rem;
  border: 1px solid var(--clr-border);
  display: flex;
  gap: 1.25rem;
  align-items: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0
}

.stat-icon.red {
  background: rgba(192, 57, 43, .12)
}

.stat-icon.blue {
  background: rgba(41, 128, 185, .12)
}

.stat-icon.green {
  background: rgba(39, 174, 96, .12)
}

.stat-icon.orange {
  background: rgba(230, 126, 22, .12)
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  line-height: 1
}

.stat-label {
  font-size: .78rem;
  color: var(--clr-text-muted);
  margin-top: .2rem
}

/* File drop zone */
.drop-zone {
  border: 2.5px dashed var(--clr-border);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background: var(--clr-surface)
}

.drop-zone:hover,
.drop-zone.dragover {
  border-color: var(--clr-primary);
  background: rgba(192, 57, 43, .04)
}

.drop-zone input[type=file] {
  display: none
}

.drop-zone-icon {
  width: 50px;
  height: 50px;
  margin: 0 auto .75rem;
  opacity: .4
}

/* Resultado tags */
.tag-normal {
  color: #155724;
  background: #d4edda;
  border-radius: 4px;
  padding: .1rem .5rem;
  font-size: .75rem;
  font-weight: 600
}

.tag-alto {
  color: #856404;
  background: #fff3cd;
  border-radius: 4px;
  padding: .1rem .5rem;
  font-size: .75rem;
  font-weight: 600
}

.tag-bajo {
  color: #0c5460;
  background: #d1ecf1;
  border-radius: 4px;
  padding: .1rem .5rem;
  font-size: .75rem;
  font-weight: 600
}

.tag-critico {
  color: #721c24;
  background: #f8d7da;
  border-radius: 4px;
  padding: .1rem .5rem;
  font-size: .75rem;
  font-weight: 600
}

/* Responsive admin */
@media(max-width:900px) {
  #btn-toggle-sidebar {
    display: block !important
  }

  #btn-close-sidebar {
    display: block !important
  }

  .admin-sidebar {
    position: fixed;
    left: -250px;
    z-index: 9999;
    transition: left .3s ease;
    box-shadow: 10px 0 30px rgba(0, 0, 0, 0.3)
  }

  .admin-sidebar.open {
    left: 0
  }

  .admin-main {
    width: 100%
  }

  .admin-content {
    padding: 1rem
  }

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

@media(max-width:768px) {
  .admin-topbar {
    padding: 0.75rem 1rem;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .topbar-title {
    font-size: 0.9rem;
  }

  .card-header {
    padding: 1rem;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .card-header h3 {
    font-size: 1.1rem;
    line-height: 1.2;
  }

  .card-header .d-flex {
    width: 100%;
    justify-content: space-between;
    gap: 0.5rem;
  }

  .card-header .btn {
    flex: 1;
    font-size: 0.75rem;
    padding: 0.6rem 0.4rem;
    white-space: nowrap;
  }

  /* Transformar Tablas en Tarjetas Estilo App */
  .table-wrap {
    border: none;
    padding: 0;
  }

  table,
  thead,
  tbody,
  th,
  td,
  tr {
    display: block;
  }

  thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  tr {
    background: #fff;
    border: 1px solid var(--clr-border);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    padding: 0.5rem;
    box-shadow: var(--shadow-sm);
  }

  td {
    border: none !important;
    position: relative;
    padding: 0.6rem 0.5rem 0.6rem 40% !important;
    text-align: right;
    min-height: 2.2rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03) !important;
  }

  td:last-child {
    border-bottom: none !important;
  }

  td:before {
    position: absolute;
    top: 10px;
    left: 10px;
    width: 35%;
    padding-right: 10px;
    white-space: nowrap;
    font-weight: 800;
    color: var(--clr-text-muted);
    font-size: 0.65rem;
    text-transform: uppercase;
    text-align: left;
    letter-spacing: 0.02em;
    display: none; /* Oculto por defecto, se activa en cards */
  }

  /* Activar etiquetas solo cuando la tabla se vuelve bloque (móvil) */
  td:before {
    display: block;
  }

  /* Etiquetas específicas para tabla de Pacientes */
  #pac-table-body td:nth-of-type(1):before { content: "Nombre"; }
  #pac-table-body td:nth-of-type(2):before { content: "Cédula"; }
  #pac-table-body td:nth-of-type(3):before { content: "Teléfono"; }
  #pac-table-body td:nth-of-type(4):before { content: "Acciones"; }

  /* Etiquetas específicas para tabla de Informes */
  #inf-table-body td:nth-of-type(1):before { content: "Paciente"; }
  #inf-table-body td:nth-of-type(2):before { content: "Cédula"; }
  #inf-table-body td:nth-of-type(3):before { content: "Fecha"; }
  #inf-table-body td:nth-of-type(4):before { content: "Estado"; }
  #inf-table-body td:nth-of-type(5):before { content: "Admin"; }
  #inf-table-body td:nth-of-type(6):before { content: "Acciones"; }

  /* Etiquetas específicas para tabla de Citas */
  #citas-table-body td:nth-of-type(1):before { content: "Paciente"; }
  #citas-table-body td:nth-of-type(2):before { content: "Teléfono"; }
  #citas-table-body td:nth-of-type(3):before { content: "Fecha/Hora"; }
  #citas-table-body td:nth-of-type(4):before { content: "Motivo"; }
  #citas-table-body td:nth-of-type(5):before { content: "Estado"; }
  #citas-table-body td:nth-of-type(6):before { content: "Acciones"; }

  /* Etiquetas para tabla de Usuarios */
  #usr-table-body td:nth-of-type(1):before { content: "Usuario"; }
  #usr-table-body td:nth-of-type(2):before { content: "Nombre"; }
  #usr-table-body td:nth-of-type(3):before { content: "Rol"; }
  #usr-table-body td:nth-of-type(4):before { content: "Estado"; }
  #usr-table-body td:nth-of-type(5):before { content: "Acciones"; }

  /* Botones de acción en tarjetas */
  td .d-flex {
    justify-content: flex-end;
  }
}





@media(max-width:500px) {
  .stats-grid {
    grid-template-columns: 1fr
  }
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 9998;
  display: none;
  backdrop-filter: blur(2px)
}

.sidebar-overlay.active {
  display: block
}

/* LOGIN */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a2332 0%, #2c3e50 100%)
}

.login-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg)
}

.login-logo {
  text-align: center;
  margin-bottom: 2rem
}

.login-logo .brand-name {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--clr-primary)
}

.login-logo .brand-sub {
  font-size: .8rem;
  color: var(--clr-text-muted)
}

/* Dropdowns */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-content {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--clr-surface);
  min-width: 220px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  z-index: 99999;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--clr-border);
  margin-top: 8px;
  backdrop-filter: blur(10px);
  animation: slideDown 0.2s cubic-bezier(0, 0, 0.2, 1);
}

.dropdown:hover .dropdown-content {
  display: block;
}

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

.dropdown-content a {
  color: var(--clr-text-main);
  padding: 12px 16px;
  text-decoration: none;
  display: block;
  font-size: .85rem;
}

.dropdown-content a:hover {
  background-color: var(--clr-bg);
  color: var(--clr-primary);
}

/* ---------- ANIMACIONES ---------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-up {
  animation: fadeInUp 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
}

.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }


/* ============================================================
   RESPONSIVE PORTAL PÚBLICO (MÓVIL)
   ============================================================ */
@media (max-width: 768px) {
  .hero-section {
    padding: 4rem 0 3rem;
    text-align: center;
    overflow: hidden;
  }

  .hero-section .container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0 1.5rem; /* Margen de seguridad lateral */
  }

  .hero-content {
    z-index: 10;
  }

  .hero-section h1 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    line-height: 1.2;
  }

  .hero-section p {
    font-size: 1.05rem;
    margin-left: auto;
    margin-right: auto;
    margin-bottom: 2rem;
    max-width: 100%;
  }

  .hero-actions {
    flex-direction: column;
    gap: 1rem;
    width: 100%;
  }

  .hero-actions .btn {
    width: 100%;
    justify-content: center;
    padding: 1rem;
  }

  /* Imagen como fondo transparente debajo de las letras */
  .hero-visual {
    position: absolute;
    top: 55%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    opacity: 0.12; /* Transparencia sugerida */
    z-index: 1;
    pointer-events: none;
    filter: grayscale(1) brightness(1.2); /* Estética sutil */
  }

  .hero-visual img {
    width: 100% !important;
    max-width: 100% !important;
    filter: none !important;
  }

  .btn-text-hide-mobile {
    display: none;
  }

  /* Ajustes de secciones inferiores */
  .services-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .hero-section h1 {
    font-size: 1.8rem;
  }
  
  .portal-logo .brand-name {
    font-size: 1.1rem;
  }
}
/* Estilos Linktree y Ubicación */
.btn-linktree {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #39E09B 0%, #16d47b 100%);
  color: #000;
  padding: 1.2rem 2.5rem;
  border-radius: 50px;
  font-weight: 700;
  font-size: 1.1rem;
  box-shadow: 0 10px 25px rgba(57, 224, 155, 0.3);
  transition: all 0.3s ease;
  border: none;
}

.btn-linktree:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 15px 35px rgba(57, 224, 155, 0.4);
  filter: brightness(1.05);
}

.location-flex {
  display: flex;
  gap: 3rem;
  align-items: center;
  margin-top: 2rem;
}

.location-info {
  flex: 1;
}

.location-map {
  flex: 1.2;
}

.info-item {
  display: flex;
  gap: 15px;
  margin-bottom: 1.5rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #555;
  text-align: justify;
}

.info-icon {
  width: 40px;
  height: 40px;
  background: rgba(204, 0, 0, 0.08);
  color: #cc0000;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

@media (max-width: 900px) {
  .location-flex {
    flex-direction: column;
    gap: 2rem;
  }
  .location-map {
    width: 100%;
  }
}
