/**
 * Sistema Médico - Estilos CSS
 * Tema: Salud y Medicina
 */

/* Variables de colores - Tema Médico */
:root {
    --primary-color: #0d6efd;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #0dcaf0;
    --light-color: #f8f9fa;
    --dark-color: #212529;
    --medical-blue: #2c5aa0;
    --medical-green: #4caf50;
    --medical-light-blue: #e3f2fd;
    --alert-orange: #ff9800;
    --white: #ffffff;
    --border-color: #dee2e6;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--light-color);
    color: var(--dark-color);
    line-height: 1.6;
}

/* Página de Login */
.login-page {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--medical-blue) 0%, var(--medical-green) 100%);
}

.login-container {
    width: 100%;
    max-width: 450px;
    padding: 20px;
}

.login-box {
    background: var(--white);
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    padding: 40px;
}

.login-header {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo {
    width: 100px;
    height: 100px;
    object-fit: contain;
    margin-bottom: 20px;
    border-radius: 50%;
}

.login-header h1 {
    color: var(--medical-blue);
    font-size: 24px;
    margin-bottom: 10px;
}

.site-info {
    color: var(--secondary-color);
    font-size: 14px;
    margin: 5px 0;
}

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

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

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.1);
}

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

/* Botones */
.btn {
    display: inline-block;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s;
}

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

.btn-primary:hover {
    background-color: #234a7e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(44, 90, 160, 0.3);
}

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

.btn-success:hover {
    background-color: #146c43;
}

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

.btn-danger:hover {
    background-color: #bb2d3b;
}

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

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

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

/* Alertas */
.alert {
    padding: 15px 20px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
}

.alert-error {
    background-color: #f8d7da;
    color: #842029;
    border: 1px solid #f5c2c7;
}

.alert-success {
    background-color: #d1e7dd;
    color: #0f5132;
    border: 1px solid #badbcc;
}

.alert-warning {
    background-color: #fff3cd;
    color: #664d03;
    border: 1px solid #ffecb5;
}

.alert-info {
    background-color: #cff4fc;
    color: #055160;
    border: 1px solid #b6effb;
}

/* Alerta de emergencia (parpadeante) */
.alert-emergency {
    background-color: var(--alert-orange);
    color: var(--white);
    border: 2px solid #f57c00;
    animation: blink 1s infinite;
    font-weight: bold;
    padding: 15px;
    margin: 15px 0;
}

@keyframes blink {
    0%, 50%, 100% {
        opacity: 1;
    }
    25%, 75% {
        opacity: 0.5;
    }
}

/* Layout principal */
.main-container {
    display: flex;
    min-height: 100vh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    background: linear-gradient(180deg, var(--medical-blue) 0%, #1a3d6b 100%);
    color: var(--white);
    padding: 20px 0;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-header {
    text-align: center;
    padding: 0 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

.sidebar-logo {
    width: 80px;
    height: 80px;
    object-fit: contain;
    margin-bottom: 15px;
    border-radius: 50%;
    border: 3px solid var(--white);
}

.sidebar-header h2 {
    font-size: 18px;
    margin-bottom: 5px;
}

.sidebar-header p {
    font-size: 12px;
    opacity: 0.8;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li {
    margin-bottom: 5px;
}

.sidebar-menu a {
    display: block;
    padding: 12px 20px;
    color: var(--white);
    text-decoration: none;
    transition: all 0.3s;
}

.sidebar-menu a:hover,
.sidebar-menu a.active {
    background-color: rgba(255, 255, 255, 0.1);
    border-left: 4px solid var(--medical-green);
}

/* Contenido principal */
.main-content {
    margin-left: 260px;
    flex: 1;
    padding: 0;
}

/* Header */
.header {
    background: var(--white);
    padding: 20px 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-title h1 {
    color: var(--medical-blue);
    font-size: 24px;
}

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

.header-info p {
    margin: 2px 0;
    font-size: 13px;
    color: var(--secondary-color);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-name {
    font-weight: 500;
    color: var(--dark-color);
}

/* Contenido de página */
.page-content {
    padding: 30px;
}

/* Tarjetas */
.card {
    background: var(--white);
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    padding: 25px;
    margin-bottom: 25px;
}

.card-header {
    border-bottom: 2px solid var(--medical-light-blue);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.card-header h2 {
    color: var(--medical-blue);
    font-size: 20px;
}

.card-body {
    padding: 0;
}

/* Búsqueda */
.search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
}

.search-box input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
}

/* Tablas */
.table-responsive {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

table th {
    background-color: var(--medical-light-blue);
    color: var(--medical-blue);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    border-bottom: 2px solid var(--primary-color);
}

table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

table tr:hover {
    background-color: var(--light-color);
}

/* Información del paciente */
.patient-info {
    background: var(--medical-light-blue);
    border-left: 4px solid var(--medical-blue);
    padding: 20px;
    margin-bottom: 25px;
    border-radius: 8px;
}

.patient-info h3 {
    color: var(--medical-blue);
    margin-bottom: 15px;
}

.patient-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-weight: 600;
    color: var(--secondary-color);
    font-size: 12px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.detail-value {
    color: var(--dark-color);
    font-size: 16px;
}

/* Datos de última consulta */
.last-visit-data {
    background: #fff3cd;
    border: 2px solid var(--warning-color);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.last-visit-data h4 {
    color: #664d03;
    margin-bottom: 10px;
    font-size: 16px;
}

.vital-signs {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.vital-sign {
    flex: 1;
    min-width: 150px;
    text-align: center;
    padding: 10px;
    background: var(--white);
    border-radius: 6px;
}

.vital-sign-label {
    font-size: 12px;
    color: var(--secondary-color);
    display: block;
    margin-bottom: 5px;
}

.vital-sign-value {
    font-size: 20px;
    font-weight: bold;
    color: var(--medical-blue);
}

/* Historial médico */
.history-item {
    border-left: 3px solid var(--medical-green);
    padding: 15px;
    margin-bottom: 15px;
    background: var(--light-color);
    border-radius: 5px;
}

.history-date {
    font-weight: 600;
    color: var(--medical-blue);
    margin-bottom: 10px;
}

.history-content p {
    margin: 5px 0;
}

/* Footer */
.login-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--secondary-color);
    font-size: 13px;
}

/* Utilidades */
.text-center {
    text-align: center;
}

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

.mb-20 {
    margin-bottom: 20px;
}

.mt-20 {
    margin-top: 20px;
}

/* Botón de menú hamburguesa para móviles */
.menu-toggle {
    display: none;
    position: fixed;
    top: 15px;
    left: 15px;
    z-index: 1001;
    background: var(--medical-blue);
    color: white;
    border: none;
    padding: 12px 15px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.menu-toggle:active {
    transform: scale(0.95);
}

/* Overlay para cerrar menú en móviles */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

.sidebar-overlay.active {
    display: block;
}

/* Responsive - Tablets */
@media (max-width: 1024px) {
    .sidebar {
        width: 220px;
    }

    .main-content {
        margin-left: 220px;
    }

    .header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }

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

/* Responsive - Móviles */
@media (max-width: 768px) {
    /* Mostrar botón hamburguesa */
    .menu-toggle {
        display: block;
    }

    /* Sidebar oculto por defecto en móviles */
    .sidebar {
        position: fixed;
        left: -280px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 1000;
        transition: left 0.3s ease;
        overflow-y: auto;
    }

    .sidebar.active {
        left: 0;
        box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
    }

    /* Contenido principal ocupa todo el ancho */
    .main-content {
        margin-left: 0;
        width: 100%;
    }

    /* Header responsive */
    .header {
        padding: 70px 15px 15px;
        flex-direction: column;
        gap: 10px;
    }

    .header-title h1 {
        font-size: 20px;
    }

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

    .header-info p {
        font-size: 12px;
    }

    /* Contenido de página */
    .page-content {
        padding: 15px;
    }

    /* Tarjetas */
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }

    /* Detalles del paciente */
    .patient-details {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    /* Signos vitales */
    .vital-signs {
        flex-direction: column;
        gap: 10px;
    }

    .vital-sign {
        min-width: 100%;
    }

    /* Tablas responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    table {
        font-size: 13px;
    }

    table th,
    table td {
        padding: 8px;
        white-space: nowrap;
    }

    /* Formularios */
    .form-group input,
    .form-group select,
    .form-group textarea {
        font-size: 16px; /* Evita zoom en iOS */
    }

    /* Botones */
    .btn {
        padding: 10px 20px;
        font-size: 14px;
        width: 100%;
        margin-bottom: 10px;
    }

    /* Búsqueda */
    .search-box {
        flex-direction: column;
    }

    .search-box input {
        width: 100%;
        margin-bottom: 10px;
    }

    /* Dashboard - estadísticas */
    .card h3 {
        font-size: 16px;
    }

    .card p {
        font-size: 28px;
    }

    /* Alertas de emergencia */
    .alert-emergency {
        font-size: 14px;
        padding: 12px;
    }

    /* Historial */
    .history-item {
        padding: 12px;
        font-size: 14px;
    }

    /* Login responsive */
    .login-container {
        padding: 10px;
    }

    .login-box {
        padding: 25px;
    }

    .login-logo {
        width: 80px;
        height: 80px;
    }

    .login-header h1 {
        font-size: 20px;
    }
}

/* Responsive - Móviles pequeños */
@media (max-width: 480px) {
    .header-title h1 {
        font-size: 18px;
    }

    .page-content {
        padding: 10px;
    }

    .card {
        padding: 12px;
    }

    .card-header h2 {
        font-size: 18px;
    }

    table {
        font-size: 12px;
    }

    table th,
    table td {
        padding: 6px;
    }

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

    .detail-value {
        font-size: 14px;
    }

    .vital-sign-value {
        font-size: 18px;
    }
}

