/* =======================================================
   1) GLOBAL
   ======================================================= */

body {
    margin: 0;
    font-family: "Poppins", sans-serif;
    color: #062241;
    overflow-x: hidden;
}

/* =======================================================
   2) AUTOCOMPLETADO
   ======================================================= */

.autocomplete-list {
    border: 1px solid #ccc;
    background: #fff;
    border-radius: 10px;
    max-height: 180px;
    overflow-y: auto;
    position: absolute;
    width: 100%;
    z-index: 50;
    display: none;
}

.autocomplete-item {
    padding: 12px 14px;
    min-height: 44px;
    cursor: pointer;
}

.autocomplete-item:hover {
    background: #e6f2ff;
}

/* =======================================================
   3) MENSAJES DE ESTADO
   ======================================================= */

.mensaje {
    margin-top: 18px;
    padding: 16px 20px;
    border-radius: 12px;
    font-weight: 600;
    text-align: center;
    font-size: 1.05rem;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    animation: fadeIn 0.3s ease;
}

.mensaje.ok {
    background: linear-gradient(135deg, #e6f9f0, #d4f3e6);
    color: #0a7a3b;
    border-left: 6px solid #0a7a3b;
}

.mensaje.error {
    background: linear-gradient(135deg, #fff0f0, #ffe1e1);
    color: #b53030;
    border-left: 6px solid #b53030;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* =======================================================
   4) PORTAL MÉDICOS
   ======================================================= */

body.portal-medicos {
    background: #f4f7fb;
    color: #062241;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
}

.tx-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: #070b14;
    color: #fff;
    padding: 16px 24px;
    padding-top: max(16px, env(safe-area-inset-top));
}

.tx-header-inner {
    max-width: 880px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.tx-header-logo {
    height: 42px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
}

.tx-header-badge {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 4px 12px;
    color: #d7eef0;
    white-space: nowrap;
}

.tx-header-tagline {
    margin-left: auto;
    font-size: 0.85rem;
    font-weight: 300;
    color: rgba(255, 255, 255, 0.62);
}

.tx-main {
    max-width: 880px;
    margin: 0 auto;
    padding: 36px 20px 64px;
    padding-bottom: max(64px, env(safe-area-inset-bottom));
}

.tx-title {
    font-size: 2rem;
    font-weight: 700;
    margin: 0 0 6px;
    color: #062241;
}

.tx-subtitle {
    color: #6b7c8f;
    font-size: 1.05rem;
    margin-bottom: 22px;
}

.tx-notice {
    background: #e8f7f8;
    border-left: 4px solid #13a1ae;
    border-radius: 10px;
    padding: 14px 18px;
    font-size: 0.95rem;
    margin-bottom: 22px;
    color: #0b4f56;
}

.tx-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    padding: 28px;
    box-shadow: 0 10px 30px rgba(6, 34, 65, 0.06);
}

.tx-card-secondary {
    background: #eef2f6;
    box-shadow: none;
    scroll-margin-top: 88px;
}

.tx-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 22px;
}

.tx-card-title {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
}

.tx-card-lead {
    color: #5b6b7c;
    font-size: 0.95rem;
    margin: 8px 0 22px;
}

.tx-pill {
    background: #e8f7f8;
    color: #0b7580;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: 999px;
    padding: 5px 10px;
    white-space: nowrap;
}

.tx-label {
    display: block;
    font-size: 0.86rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: #062241;
}

.portal-medicos .tx-input,
.portal-medicos .tx-phone .input-group-text {
    border-radius: 12px;
    border-color: #d9e1ea;
    min-height: 48px;
    font-size: 16px;
}

.portal-medicos textarea.tx-input {
    min-height: 96px;
    padding-top: 12px;
}

.portal-medicos .tx-input:focus {
    border-color: #13a1ae;
    box-shadow: 0 0 0 3px rgba(19, 161, 174, 0.18);
}

.portal-medicos .tx-phone .input-group-text {
    background: #f4f7fb;
    color: #062241;
    font-weight: 600;
    border-right: 0;
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
}

.portal-medicos .tx-phone .tx-input {
    border-left: 0;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.tx-help {
    font-size: 0.82rem;
    color: #7a8a9a;
    margin: 8px 0 0;
}

.tx-empty {
    margin-top: 10px;
    background: #fff6e8;
    border: 1px solid #f0d3a0;
    color: #7a4b08;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.9rem;
    font-weight: 500;
}

.tx-empty a {
    display: inline-block;
    margin-left: 4px;
    color: #0b7580;
    font-weight: 700;
    text-decoration: none;
}

.tx-empty a:hover {
    text-decoration: underline;
}

.tx-btn {
    display: block;
    width: 100%;
    border-radius: 999px;
    padding: 14px 20px;
    font-size: 1.05rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: 0.2s ease;
}

.tx-btn-primary {
    background: #13a1ae;
    color: #fff;
    box-shadow: 0 8px 20px rgba(19, 161, 174, 0.28);
}

.tx-btn-primary:hover {
    background: #0e8792;
    color: #fff;
}

.tx-btn-outline {
    background: transparent;
    color: #062241;
    border: 1.5px solid #062241;
}

.tx-btn-outline:hover {
    background: #062241;
    color: #fff;
}

.tx-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
}

.tx-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 28px 0;
    color: #8a97a6;
    font-size: 0.85rem;
    font-weight: 600;
}

.tx-divider::before,
.tx-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: #d5dee8;
}

.tx-honeypot {
    position: absolute;
    left: -9999px;
    height: 0;
    overflow: hidden;
}

.portal-medicos .autocomplete-list {
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(6, 34, 65, 0.12);
    max-height: 220px;
}

.portal-medicos .autocomplete-item:hover {
    background: #e8f7f8;
}

.portal-medicos .mensaje {
    margin-top: 16px;
}

@media (max-width: 768px) {
    .tx-header {
        padding: 10px 16px;
        padding-top: max(10px, env(safe-area-inset-top));
    }

    .tx-header-inner {
        flex-wrap: nowrap;
        gap: 10px;
    }

    .tx-header-logo {
        height: 32px;
        max-width: 140px;
    }

    .tx-header-badge {
        font-size: 0.68rem;
        padding: 3px 9px;
    }

    .tx-header-tagline {
        display: none;
    }

    .tx-main {
        padding: 20px 16px 40px;
        padding-bottom: max(40px, env(safe-area-inset-bottom));
    }

    .tx-title {
        font-size: 1.35rem;
    }

    .tx-subtitle {
        font-size: 0.92rem;
        margin-bottom: 14px;
    }

    .tx-notice {
        font-size: 0.88rem;
        padding: 12px 14px;
        margin-bottom: 16px;
    }

    .tx-card {
        padding: 18px 16px;
        border-radius: 14px;
    }

    .tx-card-head {
        margin-bottom: 16px;
    }

    .tx-card-title {
        font-size: 1.05rem;
    }

    .tx-card-lead {
        font-size: 0.88rem;
        margin-bottom: 16px;
    }

    .tx-card-secondary {
        scroll-margin-top: 72px;
    }

    .tx-empty a {
        display: block;
        margin: 8px 0 0;
        margin-left: 0;
    }

    .tx-btn {
        padding: 14px 16px;
        font-size: 1rem;
    }

    .tx-divider {
        margin: 22px 0;
        font-size: 0.8rem;
    }

    .mensaje {
        font-size: 0.95rem;
        padding: 14px 16px;
    }
}

/* =======================================================
   5) ADMINISTRACIÓN
   ======================================================= */

body.portal-admin {
    background: #f4f7fb;
    min-height: 100vh;
    min-height: 100dvh;
}

body.portal-admin .tx-header-inner.tx-header-wide {
    max-width: 1280px;
}

.tx-header-action {
    margin-left: auto;
    color: #d7eef0;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    padding: 5px 14px;
}

.tx-header-action:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

.tx-admin-login {
    min-height: calc(100dvh - 80px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 32px 16px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
}

.tx-admin-card {
    width: 100%;
    max-width: 420px;
}

.tx-admin-card .tx-input {
    min-height: 48px;
}

.tx-admin-wrap {
    max-width: 1280px;
    margin: 0 auto;
    padding: 28px 20px 48px;
    padding-bottom: max(48px, env(safe-area-inset-bottom));
}

.tx-admin-tabs .nav-link {
    border: none;
    border-radius: 999px;
    color: #5b6b7c;
    font-weight: 600;
    padding: 8px 18px;
    background: #fff;
}

.tx-admin-tabs .nav-link.active {
    background: #13a1ae;
    color: #fff;
}

body.portal-admin .tx-input,
body.portal-admin .form-control,
body.portal-admin .form-select {
    border-radius: 12px;
    border-color: #d9e1ea;
    font-size: 16px;
}

body.portal-admin .form-control:focus,
body.portal-admin .form-select:focus,
body.portal-admin .tx-input:focus {
    border-color: #13a1ae;
    box-shadow: 0 0 0 3px rgba(19, 161, 174, 0.18);
}

body.portal-admin .btn-primary {
    background: #13a1ae;
    border-color: #13a1ae;
    font-weight: 600;
}

body.portal-admin .btn-primary:hover,
body.portal-admin .btn-primary:focus {
    background: #0e8792;
    border-color: #0e8792;
}

body.portal-admin .btn-outline-primary {
    color: #0b7580;
    border-color: #13a1ae;
}

body.portal-admin .btn-outline-primary:hover {
    background: #13a1ae;
    border-color: #13a1ae;
    color: #fff;
}

body.portal-admin .tx-btn-inline {
    width: auto;
    display: inline-block;
    padding: 10px 22px;
    font-size: 0.95rem;
}

body.portal-admin .tx-btn-filter {
    min-height: 38px;
    border-radius: 10px;
    font-weight: 600;
}

body.portal-admin .table {
    color: #062241;
}

body.portal-admin .table thead th {
    background: #070b14;
    color: #fff;
    font-weight: 600;
    border: none;
    white-space: nowrap;
    vertical-align: middle;
}

body.portal-admin .table-striped > tbody > tr:nth-of-type(odd) > * {
    background: #f7fafc;
}

body.portal-admin .dt-buttons .btn {
    border-radius: 999px;
    font-weight: 600;
    margin-bottom: 12px;
}

body.portal-admin .dataTables_filter input {
    border-radius: 10px;
    border: 1px solid #d9e1ea;
}

body.portal-admin .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
}

body.portal-admin .modal-header {
    background: #070b14;
    color: #fff;
    border-bottom: none;
}

body.portal-admin .modal-header .btn-close {
    filter: invert(1);
}

body.portal-admin .badge.bg-primary {
    background-color: #13a1ae !important;
}

@media (max-width: 768px) {
    .tx-header-action {
        margin-left: auto;
        font-size: 0.78rem;
        padding: 4px 12px;
    }

    .tx-admin-wrap {
        padding: 18px 14px 36px;
    }

    .tx-admin-tabs {
        gap: 8px;
    }

    body.portal-admin .tx-btn-inline {
        width: 100%;
        text-align: center;
    }
}
