/* =========================================
MAIN.CSS - Estilos Globales
Clínica Santa Teresa - CST
========================================= */

/* =========================================
VARIABLES GLOBALES
========================================= */
:root {
    /* Colores corporativos */
    --primary: #007bff;
    --primary-dark: #0056b3;
    --primary-light: #e6f3ff;
    
    --success: #28a745;
    --success-light: #e6ffe6;
    
    --danger: #dc3545;
    --danger-light: #ffe6e6;
    
    --warning: #ffc107;
    --warning-light: #fff3cd;
    
    --info: #17a2b8;
    --info-light: #e6f7f9;
    
    /* Colores neutros */
    --gray: #6c757d;
    --gray-light: #f5f5f5;
    --gray-dark: #343a40;
    
    --border: #ddd;
    --text: #333;
    --text-muted: #666;
    --white: #ffffff;
    --black: #000000;
    
    /* Sombras */
    --shadow: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 16px rgba(0,0,0,0.15);
    --shadow-hover: 0 6px 20px rgba(0,0,0,0.2);
    
    /* Bordes */
    --radius: 8px;
    --radius-lg: 12px;
    --radius-sm: 4px;
    
    /* Transiciones */
    --transition: all 0.3s ease;
    --transition-fast: 0.15s ease;
    
    /* Espaciado */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    
    /* Tipografía */
    --font-family-base: Arial, sans-serif;
    --font-size-base: 1rem;
    --line-height-base: 1.6;
}

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

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

body {
    font-family: var(--font-family-base);
    background: var(--gray-light);
    color: var(--text);
    line-height: var(--line-height-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

a:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

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

/* =========================================
CONTENEDOR PRINCIPAL
========================================= */
.portal-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--gray-light);
}

.portal-content {
    flex: 1;
    padding: 40px 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

.container {
    max-width: 700px;
    margin: 0 auto;
    background: var(--white);
    padding: 25px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

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

.container-small {
    max-width: 500px;
}

/* =========================================
HEADER
========================================= */
.portal-header {
    background: #fff;
    padding: 15px 20px;
    text-align: left;  /* ← Cambiado de center a left */
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    display: flex;  /* ← Flexbox para mejor control */
    align-items: center;  /* ← Centrar verticalmente */
    justify-content: space-between;  /* ← Logo izquierda, nav derecha */
    flex-wrap: wrap;  /* ← Permitir que se ajuste en móviles */
    gap: 15px;
}

.logo {
     max-width: 120px;  /* ← Tamaño reducido */
    height: auto;
    margin: 0;  /* ← Sin margen inferior */
    display: block;
}

.portal-header h1 {
    color: var(--primary);
    margin: 0 0 0 15px;  /* ← Margen solo a la izquierda */
    font-size: 1.5rem;
    font-weight: 600;
    display: inline-block;
    vertical-align: middle;
}

.portal-header h2 {
    color: var(--text);
    font-size: 1.25rem;
    font-weight: 500;
}

.portal-nav {
    display: flex;
    justify-content: flex-end;  /* ← Navegación a la derecha */
    gap: 15px;
    flex-wrap: wrap;
    margin-left: auto;  /* ← Empujar a la derecha */
}

.portal-nav a {
    color: var(--text);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 6px;
    transition: var(--transition);
    font-size: 0.9rem;
    white-space: nowrap;
}

.portal-nav a:hover {
    background: var(--primary);
    color: white;
    text-decoration: none;
}


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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 0.95rem;
}

select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="time"],
input[type="tel"],
input[type="hidden"],
input[type="number"],
textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    font-size: 1rem;
    transition: var(--transition);
    background: var(--white);
    color: var(--text);
    font-family: inherit;
}

select:focus,
input:focus,
textarea:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.15);
}

select:disabled,
input:disabled,
textarea:disabled {
    background: var(--gray-light);
    cursor: not-allowed;
    opacity: 0.7;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
    opacity: 1;
}

input:invalid:not(:placeholder-shown) {
    border-color: var(--danger);
}

small.text-muted {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 0.9em;
}

/* Login form específico */
.login-form {
    margin-top: 20px;
}

.login-form .form-group:last-child {
    margin-bottom: 0;
}

/* =========================================
BOTONES
========================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    text-align: center;
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    transform: translateY(-1px);
    text-decoration: none;
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

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

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

.btn-secondary {
    background: var(--gray);
    color: var(--white);
}

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

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

.btn-success:hover:not(:disabled) {
    background: #218838;
}

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

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

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

.btn-info:hover:not(:disabled) {
    background: #138496;
}

.btn-warning {
    background: var(--warning);
    color: var(--black);
}

.btn-warning:hover:not(:disabled) {
    background: #e0a800;
}

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

.btn-lg {
    padding: 16px 32px;
    font-size: 1.1rem;
}

.btn-block {
    width: 100%;
    display: flex;
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    justify-content: center;
}

.btn-group .btn {
    flex: 1;
    min-width: 150px;
    max-width: 250px;
}

/* =========================================
ALERTAS
========================================= */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    margin: 15px 0;
    font-weight: 500;
    border-left: 4px solid transparent;
}

.alert-error {
    background: var(--danger-light);
    color: var(--danger);
    border-color: var(--danger);
}

.alert-info {
    background: var(--primary-light);
    color: var(--primary-dark);
    border-color: var(--primary);
}

.alert-success {
    background: var(--success-light);
    color: var(--success);
    border-color: var(--success);
}

.alert-warning {
    background: var(--warning-light);
    color: #856404;
    border-color: var(--warning);
}

/* =========================================
TABLAS
========================================= */
.table-responsive {
    overflow-x: auto;
    margin-top: 15px;
    width: 100%;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: var(--white);
}

th,
td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

th {
    background: var(--primary);
    color: var(--white);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
}

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

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

/* Tabla para información de sesión */
.session-info table {
    background: transparent;
}

.session-info td {
    background: transparent;
}

.session-info td:first-child {
    font-weight: 600;
    color: var(--text-muted);
    width: 40%;
}

/* =========================================
ESTADOS
========================================= */
.status {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 500;
    display: inline-block;
}

.status-0 {
    background: var(--success-light);
    color: var(--success);
}

.status-1 {
    background: var(--warning-light);
    color: #856404;
}

.status-2 {
    background: var(--danger-light);
    color: var(--danger);
}

.status-3 {
    background: var(--gray-light);
    color: var(--gray);
}

.status-active {
    background: var(--success-light);
    color: var(--success);
}

.status-pending {
    background: var(--warning-light);
    color: #856404;
}

.status-inactive {
    background: var(--danger-light);
    color: var(--danger);
}

/* =========================================
LOADING
========================================= */
.loading {
    text-align: center;
    padding: 15px;
    color: var(--text-muted);
    font-style: italic;
}

.loading.hidden {
    display: none;
}

.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--gray-light);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

.hidden {
    display: none !important;
}

.invisible {
    visibility: hidden;
}

/* =========================================
GRID DE DÍAS
========================================= */
.dias-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 10px;
}

.dia-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 6px;
    cursor: pointer;
    transition: var(--transition);
    background: var(--white);
}

.dia-checkbox:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.dia-checkbox input[type="radio"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin: 0;
}

.dia-checkbox:has(input:checked) {
    border-color: var(--success);
    background: var(--success-light);
}

.dia-fecha {
    font-weight: 600;
    display: block;
}

.dia-hora {
    font-size: 0.9em;
    color: var(--text-muted);
}

/* =========================================
INFO DE SELECCIÓN
========================================= */
.selection-info {
    background: var(--primary-light);
    padding: 10px 15px;
    border-radius: 6px;
    margin: 10px 0;
    font-size: 0.95em;
}

.selection-info strong {
    color: var(--primary);
}
/* =========================================
UTILIDAD: MOSTRAR/OCULTAR CONTRASEÑA
========================================= */
.password-wrapper {
    position: relative;
    width: 100%;
    display: flex;
    align-items: center;
}

/* Aseguramos que el input ocupe todo el ancho pero deje espacio a la derecha */
.password-wrapper .form-control {
    padding-right: 45px; /* Espacio para el icono */
    width: 100%;
}

/* El botón del ojo */
.password-toggle-btn {
    position: absolute;
    right: 12px; /* Distancia desde la derecha */
    top: 50%;
    transform: translateY(-50%); /* Centrado vertical perfecto */
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray); /* Color gris por defecto */
    z-index: 10; /* Asegurar que esté por encima del input */
    outline: none;
}

.password-toggle-btn:hover {
    color: var(--primary); /* Color azul al pasar el ratón */
}

.password-toggle-btn svg {
    width: 20px;
    height: 20px;
    pointer-events: none; /* Evitar clicks en el SVG, solo en el botón */
}
/* =========================================
FOOTER
========================================= */
.portal-footer {
    background: var(--white);
    padding: 20px;
    text-align: center;  /* ← Centrado */
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.footer-nav {
    margin-top: 10px;
    color: var(--text-muted);
    display: flex;  /* ← Flexbox para mejor control */
    justify-content: center;  /* ← Centrar contenido */
    flex-wrap: wrap;  /* ← Permitir que se ajuste en móviles */
    gap: 10px;  /* ← Espacio entre enlaces */
}

.footer-nav a {
    color: var(--primary);
    text-decoration: none;
    padding: 5px 10px;  /* ← Área clickable más grande */
    font-size: 0.9rem;
}

.footer-nav a:hover {
    text-decoration: underline;
    color: var(--primary-dark);
}

.portal-footer p {
    text-align: center;  /* ← Asegurar centrado */
    margin: 10px 0 0 0;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* =========================================
UTILIDADES
========================================= */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

.text-muted { color: var(--text-muted) !important; }
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-warning { color: var(--warning) !important; }
.text-info { color: var(--info) !important; }
.text-negro { color: var(--negro) !important; }
.text-primary { color: var(--primary) !important; }

.bg-white { background: var(--white) !important; }
.bg-light { background: var(--gray-light) !important; }
.bg-primary { background: var(--primary) !important; }
.bg-success { background: var(--success) !important; }
.bg-danger { background: var(--danger) !important; }

.fw-normal { font-weight: 400 !important; }
.fw-medium { font-weight: 500 !important; }
.fw-bold { font-weight: 600 !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }

.flex-column { flex-direction: column !important; }
.flex-row { flex-direction: row !important; }
.justify-center { justify-content: center !important; }
.justify-between { justify-content: space-between !important; }
.align-center { align-items: center !important; }

.m-0 { margin: 0 !important; }
.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 0.5rem !important; }
.mt-2 { margin-top: 1rem !important; }
.mt-3 { margin-top: 1.5rem !important; }
.mt-4 { margin-top: 2rem !important; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 0.5rem !important; }
.mb-2 { margin-bottom: 1rem !important; }
.mb-3 { margin-bottom: 1.5rem !important; }
.mb-4 { margin-bottom: 2rem !important; }
.mx-auto


/* =========================================
RESPONSIVE - Ajustes para móviles
========================================= */
@media (max-width: 768px) {
    .portal-header {
        flex-direction: column;  /* ← Columna en móviles */
        text-align: center;
        justify-content: center;
    }
    
    .logo {
        margin: 0 auto 10px auto;  /* ← Centrado en móvil */
    }
    
    .portal-header h1 {
        margin: 0 0 10px 0;
        text-align: center;
    }
    
    .portal-nav {
        justify-content: center;  /* ← Nav centrado en móvil */
        margin-left: 0;
        width: 100%;
    }
    
    .portal-nav a {
        flex: 1;
        max-width: 200px;
        text-align: center;
    }
}