/* ============================================================
   PORTAL CITAS - Estilos específicos
   Depende de: ../../shared/base.css
   ============================================================ */

/* ===== PORTAL BODY OVERRIDE ===== */
body {
    padding-bottom: 0;
}

/* ===== PORTAL MAIN ===== */
main {
    padding: 0;
}

#rutFormSection,
#appointmentsSection {
    max-width: var(--layout-content-max, 68rem);
    margin-left: auto;
    margin-right: auto;
}

/* ===== SECTION TITLE ===== */
.section-title {
    font-size: 1.875rem;
    margin-bottom: 1.25rem;
    color: var(--gray-900);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    justify-content: center;
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

/* ===== INTRO TEXT ===== */
.intro-text {
    text-align: center;
    margin-bottom: 1.75rem;
    font-size: 0.95rem;
    color: var(--gray-600);
    max-width: 650px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
    background-color: var(--gray-100);
    padding: 1.25rem;
    border-radius: var(--radius);
    border: 1px solid var(--gray-200);
}

/* ===== FORM GROUP (portal override) ===== */
.form-group {
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

/* ===== MESSAGES ===== */
.error-message {
    color: var(--danger);
    margin-top: 0.6rem;
    font-size: 0.9rem;
    display: none;
    font-weight: 500;
}

.error-message.show {
    display: block;
}

.success-message {
    color: var(--secondary);
    margin-top: 0.6rem;
    font-size: 0.9rem;
    display: none;
    font-weight: 500;
}

.success-message.show {
    display: block;
}

.success-message.error {
    color: var(--danger);
}

/* ===== LOADING SPINNER (portal-specific) ===== */
.loading-spinner {
    display: none;
    text-align: center;
    margin: 1rem 0;
}

/* ===== APPOINTMENTS HEADER ===== */
.appointments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--gray-200);
}

.user-rut-display {
    background: var(--primary-light);
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-weight: 600;
    color: var(--primary-dark);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9375rem;
    box-shadow: var(--shadow-sm);
}

.change-patient-btn {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.9375rem;
    box-shadow: var(--shadow-sm);
    font-family: inherit;
}

.change-patient-btn:hover {
    background: var(--primary-light);
    transform: translateY(-1px);
}

/* ===== NO APPOINTMENTS ===== */
.no-appointments {
    text-align: center;
    padding: 2.5rem 1.5rem;
    color: var(--gray-600);
}

.no-appointments p {
    margin-bottom: 0.75rem;
    font-size: 1.125rem;
    line-height: 1.5;
}

.no-appointments .highlight {
    color: var(--primary);
    font-weight: 700;
    font-size: 1.25rem;
    margin-top: 0.5rem;
    display: block;
}

/* ===== APPOINTMENTS LIST ===== */
.appointments-list {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    width: 100%;
}

.appointment-item {
    background: white;
    border-radius: var(--radius);
    padding: 1.5rem;
    border: 1px solid var(--gray-200);
    box-shadow: var(--shadow);
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.appointment-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--gray-300);
}

.appointment-item.confirmed {
    border-left: 4px solid var(--primary);
}

.appointment-item.missed {
    border-left: 4px solid #d8b4b4;
}

.appointment-item.scheduled {
    border-left: 4px solid var(--gray-400);
}

/* ===== APPOINTMENT MAIN ===== */
.appointment-main {
    flex: 1;
    min-width: 0;
    margin-right: 1.5rem;
}

.doctor-line {
    display: flex;
    align-items: baseline;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.doctor-name {
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--gray-900);
}

.specialty {
    color: #005f74;
    font-weight: 600;
    font-size: 0.9375rem;
    background: #e0f2f7;
    padding: 0.125rem 0.5rem;
    border-radius: var(--radius-full);
    border: 1px solid #8fc6d2;
}

.datetime-line {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.date {
    font-weight: 600;
    color: var(--gray-900);
    font-size: 1.05rem;
}

.time {
    color: var(--primary);
    font-weight: 600;
    font-size: 1.05rem;
}

.location-line {
    display: flex;
    gap: 0.75rem;
    color: var(--gray-600);
    font-size: 0.9375rem;
    margin-top: 0.25rem;
    flex-wrap: wrap;
}

.branch-status-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-start;
}

.branch {
    font-weight: 500;
}

.branch-utility-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* ===== APPOINTMENT META ===== */
.appointment-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: flex-end;
    align-self: stretch;
    min-width: 220px;
    width: 220px;
    gap: 0.75rem;
}

.state-badge {
    padding: 0.2rem 0.6rem;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    width: fit-content;
}

.state-badge.scheduled {
    background: #dff1f6;
    color: #005f74;
    border: 1px solid #88bfcc;
}

.state-badge.confirmed {
    background: #eaf3d8;
    color: #637300;
    border: 1px solid #b7c97c;
}

.state-badge.missed {
    background: #fbe9ea;
    color: #9d2323;
    border: 1px solid #e0a9ad;
}

/* ===== ACTION BUTTONS ===== */
.action-buttons {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
    width: 100%;
    margin-top: 0.5rem;
}

.btn-action {
    min-height: 2.875rem;
    padding: 0.625rem 0.85rem;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    border: 1px solid transparent;
    width: 100%;
    text-align: center;
    font-family: inherit;
}

.btn-action:focus-visible,
.btn-utility:focus-visible {
    outline: 3px solid rgba(0, 142, 169, 0.24);
    outline-offset: 2px;
}

.btn-confirm {
    background: white;
    color: #6f8200;
    border: 1px solid #8ea300;
}

.btn-confirm:hover:not(:disabled) {
    background: #edf4dc;
    transform: translateY(-1px);
}

.btn-reschedule {
    background: white;
    color: #007c95;
    border: 1px solid #0097b4;
}

.btn-reschedule:hover {
    background: #dff3f7;
    transform: translateY(-1px);
}

.btn-cancel {
    background: white;
    color: #b31f1f;
    border: 1px solid #cf2d2d;
}

.btn-cancel:hover {
    background: #fdeaea;
    transform: translateY(-1px);
}

.btn-action:disabled {
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-confirm.is-locked {
    background: white;
    color: #6f8200;
    border-color: #8ea300;
}

.btn-confirm.is-unavailable {
    background: var(--gray-100);
    color: var(--gray-600);
    border-color: var(--gray-300);
}

.utility-buttons {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}

.btn-utility {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2rem;
    padding: 0.375rem 0.7rem;
    border-radius: var(--radius-full);
    border: 1px solid transparent;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: var(--transition-fast);
    box-shadow: var(--shadow-sm);
}

.btn-map-chip {
    background: #eef8fb;
    color: #006f83;
    border-color: #b3d8e1;
}

.btn-map-chip:hover {
    background: #dff1f6;
    transform: translateY(-1px);
}

.btn-waze-chip {
    background: #eef2fb;
    color: #305f95;
    border-color: #becdea;
}

.btn-waze-chip:hover {
    background: #e0e8f7;
    transform: translateY(-1px);
}

/* Icon for map */
.icon-location {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ===== CONTACT INFO ===== */
.contact-info {
    text-align: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--gray-200);
    color: var(--gray-600);
    font-size: 0.9375rem;
}

.contact-info .phone {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0.5rem 0;
    text-decoration: none;
    transition: var(--transition);
}

.contact-info .phone:hover {
    color: var(--primary-dark);
    transform: scale(1.05);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .section-title {
        font-size: 1.625rem;
        margin-bottom: 1rem;
    }

    .intro-text {
        font-size: 1rem;
        margin-bottom: 1.5rem;
    }

    .appointment-item {
        flex-direction: column;
        align-items: stretch;
        padding: 1.25rem;
    }

    .appointment-main {
        margin-right: 0;
        margin-bottom: 1.25rem;
    }

    .datetime-line,
    .location-line {
        gap: 0.65rem;
    }

    .appointment-meta {
        align-items: flex-start;
        min-width: auto;
        width: 100%;
        flex-direction: column;
        align-self: auto;
    }

    .action-buttons {
        display: grid;
        grid-template-columns: minmax(0, 3fr) minmax(0, 4fr) minmax(0, 3fr);
        width: 100%;
        margin-top: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--gray-200);
    }

    .btn-action {
        min-width: auto;
        padding-left: 0.55rem;
        padding-right: 0.55rem;
        font-size: 0.875rem;
    }

    .branch-utility-row {
        align-items: flex-start;
    }

    .utility-buttons {
        width: 100%;
    }

    .btn-utility {
        flex: 0 0 auto;
    }

    .appointments-header {
        flex-direction: column;
        align-items: stretch;
    }

    .change-patient-btn {
        align-self: flex-start;
        margin-top: 0.75rem;
        width: 100%;
    }

    main {
        padding: 1.5rem 0;
    }
}

@media (max-width: 480px) {
    .section-title {
        font-size: 1.5rem;
    }

    .appointment-item {
        padding: 1rem;
    }

    .doctor-name {
        font-size: 1.125rem;
    }

    .date, .time {
        font-size: 1rem;
    }

    .btn-action {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }

    .state-badge {
        padding: 0.3125rem 0.75rem;
        font-size: 0.75rem;
    }
}

@media (max-width: 380px) {
    .btn-action svg {
        display: none;
    }

    .btn-action {
        gap: 0;
    }
}
