:root {
    --primary: #00a896;
    --primary-dark: #028090;
    --accent: #05668d;
    --card-bg: rgba(255, 255, 255, 0.94);
    --text-main: #1e293b;
    --text-muted: #64748b;
    --danger: #ef4444;
    --success: #10b981;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
}

body {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(rgba(15, 23, 42, 0.2), rgba(15, 23, 42, 0.2)), 
                url('img/emizlab.jpg') center/cover no-repeat fixed;
    padding: 16px;
}

.container {
    width: 100%;
    max-width: 440px;
}

.dashboard-container {
    max-width: 850px;
}

.card {
    background: #ffffff; /* Fallback para navegadores antiguos */
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    box-shadow: 0 25px 35px -5px rgba(0, 0, 0, 0.3);
    padding: 36px 30px;
    animation: fadeIn 0.4s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.brand-header {
    text-align: center;
    margin-bottom: 28px;
}

.brand-logo-container {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 6px;
}

.brand-icon {
    width: 38px;
    height: 38px;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 14px rgba(0, 168, 150, 0.4);
}

.brand-title {
    font-size: 28px;
    color: var(--text-main);
    font-weight: 700;
    letter-spacing: -0.5px;
}

.brand-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.form-group {
    margin-bottom: 18px;
}

.form-control {
    width: 100%;
    padding: 13px 16px;
    border: 1.5px solid #cbd5e1;
    border-radius: 12px;
    font-size: 16px;
    color: var(--text-main);
    background-color: rgba(255, 255, 255, 0.95);
    transition: all 0.25s ease;
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    background-color: #ffffff;
    box-shadow: 0 0 0 4px rgba(0, 168, 150, 0.15);
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
}

.btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 6px 16px rgba(0, 168, 150, 0.3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn:hover {
    opacity: 0.95;
    transform: translateY(-1px);
}

.btn-secondary {
    background: linear-gradient(135deg, var(--accent), var(--primary-dark));
    box-shadow: 0 4px 12px rgba(5, 102, 141, 0.3);
    padding: 10px 14px;
    font-size: 12px;
    width: auto;
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger);
    border: 1.5px solid var(--danger);
    box-shadow: none;
    width: auto;
    padding: 8px 18px;
    font-size: 13px;
}

.btn-outline-danger:hover {
    background-color: #fef2f2;
}

.forgot-password-container {
    margin-top: 14px;
    text-align: center;
}

.forgot-password-link {
    font-size: 13px;
    color: var(--primary-dark);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

.forgot-password-link:hover {
    text-decoration: underline;
    color: var(--accent);
}

.alert-error {
    background-color: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    padding: 11px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 18px;
    display: none;
    text-align: center;
}

.user-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1.5px solid #e2e8f0;
    padding-bottom: 16px;
    margin-bottom: 22px;
    flex-wrap: wrap;
    gap: 12px;
}

.user-info h3 {
    font-size: 18px;
    color: var(--text-main);
    font-weight: 600;
}

.user-info p {
    font-size: 13px;
    color: var(--text-muted);
}

.bacteriologist-detail {
    font-size: 12px;
    color: var(--primary-dark);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 5px;
    margin-top: 4px;
    flex-wrap: wrap;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 8px;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-main);
}

.header-action-buttons {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.date-group-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--primary-dark);
    background-color: #e0f2fe;
    padding: 6px 12px;
    border-radius: 8px;
    margin-top: 20px;
    margin-bottom: 10px;
}

.lab-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.lab-item {
    background-color: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.lab-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pdf-custom-icon {
    width: 42px;
    height: 48px;
    flex-shrink: 0;
}

.lab-details h4 {
    font-size: 14px;
    color: var(--text-main);
    font-weight: 600;
    margin-bottom: 2px;
}

.lab-details p {
    font-size: 12px;
    color: var(--text-muted);
}

.location-tag {
    font-size: 11px;
    color: var(--primary-dark);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 2px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    margin-top: 4px;
}

.status-pending {
    background-color: #fef9c3;
    color: #854d0e;
    border: 1px solid #fef08a;
}

.status-ready {
    background-color: #dcfce7;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.btn-download.disabled {
    background: #cbd5e1;
    color: #64748b;
    pointer-events: none;
    box-shadow: none;
    border: 1px solid #94a3b8;
}

.btn-download {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 9px 16px;
    border-radius: 10px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    transition: all 0.2s ease;
}

.btn-view-file {
    background-color: #028090;
    color: white;
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-view-file:hover {
    background-color: #05668d;
}

.btn-view-file.disabled {
    background-color: #cbd5e1;
    color: #94a3b8;
    pointer-events: none;
    border: 1px solid #e2e8f0;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 5px;
    margin-bottom: 15px;
}

.admin-table th, .admin-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
}

.admin-table th {
    background-color: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
}

.edit-exam-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-dark);
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.edit-exam-btn:hover {
    background-color: #e0f2fe;
    color: var(--accent);
}

.exam-date-small {
    font-size: 10.5px;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background-color: #25d366;
    color: #ffffff !important;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    margin-top: 6px;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.4);
    transition: all 0.2s ease;
}

.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 16px;
}

.modal-content {
    background: white;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.modal-header h3 {
    font-size: 18px;
    color: var(--text-main);
}

.close-modal {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
}

.current-pdf-box {
    background-color: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.current-pdf-info {
    font-size: 12px;
    color: var(--text-main);
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-delete-pdf {
    background-color: #fef2f2;
    color: var(--danger);
    border: 1px solid #fecaca;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-delete-pdf:hover {
    background-color: var(--danger);
    color: white;
}

.load-more-container {
    text-align: center;
    margin-top: 15px;
    margin-bottom: 10px;
}

.btn-load-more {
    background-color: #f1f5f9;
    color: var(--primary-dark);
    border: 1px solid #cbd5e1;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.metric-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
}

.metric-card h4 {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.metric-card .metric-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--primary-dark);
}

.app-footer {
    margin-top: 24px;
    padding: 16px 8px 0 8px;
    text-align: center;
    font-size: 11px;
    color: #ffffff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.app-footer-ajustes-bac {
    margin-top: 24px;
    padding: 16px 8px 0 8px;
    text-align: center;
    font-size: 11px;
    color: #000000;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.footer-links a {
    color: #ffffff;
    text-decoration: underline;
}

.btn-sm-action {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    margin-right: 4px;
}

.btn-toggle-active { background-color: #fef3c7; color: #d97706; }
.btn-toggle-inactive { background-color: #d1fae5; color: #059669; }
.btn-delete-staff { background-color: #fee2e2; color: #dc2626; }
.btn-edit-staff { background-color: #e0f2fe; color: #0369a1; }

.role-tag {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 600;
    display: inline-block;
}

.role-bact { background-color: #e0f2fe; color: #0369a1; }
.role-aux { background-color: #fef3c7; color: #b45309; }

.dynamic-fields-container {
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px;
    margin-top: 10px;
    margin-bottom: 15px;
}

.dynamic-field-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    align-items: center;
}

.dynamic-field-row label {
    font-size: 12px;
    width: 45%;
    color: var(--text-main);
    font-weight: 500;
}

.dynamic-field-row input, .dynamic-field-row select {
    width: 55%;
    padding: 8px 10px;
    font-size: 13px;
}

.hidden {
    display: none !important;
}

.exam-details h4 {
    margin: 0 0 2px 0;
    color: #2b2c34;
    font-size: 0.88rem;
    font-weight: 600;
}

.exam-date {
    margin: 1px 0;
    color: #8c92a0;
    font-size: 0.75rem;
}

.exam-location {
    margin: 1px 0 4px 0;
    font-size: 0.75rem;
    display: flex;
    align-items: center;
    gap: 4px;
}

.exam-location span {
    color: #00a896;
    font-weight: 500;
}

.badge-success {
    background: #dcfce7;
    color: #16a34a;
    font-size: 0.7rem;
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    font-weight: 500;
}

/* Layout Web (Por defecto de 2 columnas) */
.grid-form {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.form-group {
    flex: 1 1 calc(50% - 15px);
    display: flex;
    flex-direction: column;
}

.form-group.field-name,
.form-group.field-doctor,
.form-group.field-email {
    flex: 1 1 100%;
}

.birthdate-container {
    display: flex;
    gap: 8px;
    align-items: center;
}

.age-badge {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
    min-width: 70px;
    text-align: center;
}

/* Reordenamiento Responsive exclusivo para Móviles (<= 768px) */
@media (max-width: 768px) {
    .card { 
        padding: 20px 14px; 
    }
    
    .admin-table th, .admin-table td { 
        font-size: 11px; 
        padding: 8px 4px; 
    }
    
    .lab-item { 
        flex-direction: column; 
        align-items: flex-start; 
    }
    
    .btn-download { 
        width: 100%; 
        justify-content: center; 
    }

    .grid-form {
        display: flex;
        flex-wrap: wrap;
        gap: 12px;
    }

    .form-group {
        flex: 1 1 100%;
    }

    /* Orden de apilamiento vertical especificado */
    .field-doc-type { order: 1; }
    .field-doc-num  { order: 2; }
    .field-name     { order: 3; }
    .field-birthdate{ order: 4; }

    /* Sexo y Teléfono juntos en una sola fila en celular */
    .field-sex   { order: 5; flex: 1 1 calc(50% - 6px) !important; }
    .field-phone { order: 6; flex: 1 1 calc(50% - 6px) !important; }

    .field-email  { order: 7; flex: 1 1 100% !important; }
    .field-doctor { order: 8; flex: 1 1 100% !important; }

    /* Asegura legibilidad en inputs de fecha para navegadores móviles */
    input[type="date"] {
        font-size: 16px;
    }
}
.btn-icon-settings {
    width: 36px;
    height: 36px;
    padding: 0;
    background-color: transparent;
    border: 1.5px solid #cbd5e1;
    border-radius: 10px;
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-icon-settings svg {
    width: 18px;
    height: 18px;
}

.btn-icon-settings:hover {
    background-color: #e0f2fe;
    border-color: var(--primary);
    color: var(--primary);
    transform: translateY(-1px);
}

