/**
 * ============================================================
 * ROSCOE IMÓVEIS - COMPONENTE CENTRALIZADO AGENDAMENTO DE VISITA
 * Estilos: Modal Desktop Widescreen (~650px), Drawer Mobile,
 * Date Strip 14 Dias, Time Chips com Escassez e Efeito WOW.
 * ============================================================
 */

/* 1. BOTÃO DE GATILHO "AGENDAR UMA VISITA" (Substitui Enviar WhatsApp) */
.btn-agendar-visita {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 52px;
    padding: 14px 20px;
    background: linear-gradient(135deg, #820000 0%, #680000 100%);
    color: #FFFFFF !important;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(130, 0, 0, 0.35);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    outline: none;
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.btn-agendar-visita:hover,
.btn-agendar-visita:focus {
    background: linear-gradient(135deg, #5c0000 0%, #450000 100%);
    color: #FFFFFF !important;
    box-shadow: 0 6px 20px rgba(130, 0, 0, 0.5);
    transform: translateY(-1px);
    text-decoration: none;
}

.btn-agendar-visita:active {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(130, 0, 0, 0.4);
}

.btn-agendar-visita .btn-icon-cal {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    color: #EFE0AF;
}

.btn-agendar-visita .btn-icon-cal svg {
    display: block;
}

/* 2. OVERLAY GLOBAL COM DESFOQUE CINEMATOGRÁFICO */
.agendamento-backdrop {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.65);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 999998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.agendamento-backdrop.is-active {
    display: block;
    opacity: 1;
}

/* 3. MODAL CENTRALIZADO DESKTOP/TABLETS (~650px Widescreen - Zero Rolagem) */
.agendamento-popover-wrapper {
    position: relative;
    display: block;
    width: 100%;
}

.agendamento-popover {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    width: 650px;
    max-width: 94vw;
    background: #FFFFFF;
    border-radius: 14px;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
    z-index: 999999;
    padding: 0;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s cubic-bezier(0.25, 0.8, 0.25, 1),
                transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.agendamento-popover.is-open {
    display: block;
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

/* 4. DRAWER INFERIOR MOBILE (Bottom Sheet) */
.agendamento-drawer-mobile {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 92vh;
    background: #FFFFFF;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.35);
    z-index: 999999;
    padding: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.33, 1, 0.68, 1);
}

.agendamento-drawer-mobile.is-open {
    display: block;
    transform: translateY(0);
}

.agendamento-drag-handle {
    width: 44px;
    height: 5px;
    background: #D5D5D5;
    border-radius: 3px;
    margin: 10px auto 4px auto;
}

/* 5. CABEÇALHO ELEGANTE & MINI CARD DO IMÓVEL */
.agendamento-header {
    background: linear-gradient(135deg, #1A1A1A 0%, #111111 100%);
    color: #FFFFFF;
    padding: 16px 20px 14px 20px;
    border-bottom: 2px solid #820000;
}

.agendamento-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 12px;
}

.agendamento-header-title-wrap {
    flex: 1;
    padding-right: 12px;
}

.agendamento-header-title {
    margin: 0 0 3px 0;
    font-size: 17px;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.2px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.agendamento-svg-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.agendamento-svg-gold {
    color: #EFE0AF;
    stroke: #EFE0AF;
}

.agendamento-header-subtitle {
    margin: 0;
    font-size: 12px;
    color: #BBBBBB;
    line-height: 1.35;
}

.agendamento-header-close {
    background: rgba(255, 255, 255, 0.12);
    border: none;
    color: #FFFFFF;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    padding: 0;
}

.agendamento-header-close:hover {
    background: rgba(255, 255, 255, 0.25);
    color: #EFE0AF;
    transform: rotate(90deg);
}

/* MINI CARD COM FOTO DO IMÓVEL NO CABEÇALHO */
.agendamento-prop-card {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 8px 12px;
    gap: 14px;
}

.agendamento-prop-thumb {
    width: 95px;
    height: 64px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
    background: #222222;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.agendamento-prop-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.agendamento-prop-info {
    flex: 1;
    min-width: 0;
}

.agendamento-prop-title-full {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    line-height: 1.35;
    white-space: normal;
    display: block;
    margin-bottom: 4px;
}

.agendamento-prop-meta-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 11px;
}

.agendamento-prop-price {
    font-weight: 800;
    color: #EFE0AF;
    font-size: 13px;
}

.agendamento-prop-meta-row .prop-cod {
    background: #820000;
    color: #FFFFFF;
    padding: 2px 7px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 700;
    white-space: nowrap;
}

.agendamento-prop-loc {
    color: #BBBBBB;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 220px;
}

/* 6. CORPO / CONTEÚDO */
.agendamento-body {
    padding: 16px 24px 18px 24px;
    overflow-y: auto;
    max-height: calc(88vh - 120px);
    -webkit-overflow-scrolling: touch;
}

.agendamento-step-label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: #820000;
    margin: 0 0 10px 0;
    display: flex;
    align-items: center;
    gap: 6px;
}

.agendamento-step-label span.step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #820000;
    color: #FFFFFF;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
}

/* Linha divisória discreta */
.agendamento-divider {
    border-top: 1px solid #ECECEC;
    margin: 12px 0 10px 0;
}

/* 7. CARROSSEL DE DATAS (DATE STRIP 14 DIAS) */
.agendamento-date-strip-container {
    position: relative;
    margin-bottom: 6px;
}

.agendamento-date-strip {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 2px 8px 2px;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: #820000 #f1f1f1;
}

.agendamento-date-strip::-webkit-scrollbar {
    height: 4px;
}

.agendamento-date-strip::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.agendamento-date-strip::-webkit-scrollbar-thumb {
    background: #820000;
    border-radius: 4px;
}

.agendamento-date-card {
    flex: 0 0 66px;
    scroll-snap-align: start;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 8px 4px;
    background: #F7F7F7;
    border: 1.5px solid #E5E5E5;
    border-radius: 8px;
    cursor: pointer;
    user-select: none;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    text-align: center;
}

.agendamento-date-card:hover:not(.is-blocked) {
    background: #FFFFFF;
    border-color: #820000;
    box-shadow: 0 3px 8px rgba(130, 0, 0, 0.12);
    transform: translateY(-2px);
}

.agendamento-date-card.is-selected {
    background: #820000 !important;
    border-color: #820000 !important;
    color: #FFFFFF !important;
    box-shadow: 0 4px 12px rgba(130, 0, 0, 0.35);
    transform: translateY(-2px);
}

.agendamento-date-card .card-day-week {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: #777777;
    margin-bottom: 2px;
}

.agendamento-date-card.is-selected .card-day-week {
    color: #EFE0AF !important;
}

.agendamento-date-card .card-day-number {
    font-size: 17px;
    font-weight: 800;
    color: #222222;
    line-height: 1.1;
}

.agendamento-date-card.is-selected .card-day-number {
    color: #FFFFFF !important;
}

.agendamento-date-card .card-month {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    color: #999999;
    margin-top: 2px;
}

.agendamento-date-card.is-selected .card-month {
    color: rgba(255, 255, 255, 0.85) !important;
}

.agendamento-date-card.is-today .card-day-week {
    color: #820000;
    font-weight: 800;
}

/* Dia Bloqueado Manualmente */
.agendamento-date-card.is-blocked {
    opacity: 0.45;
    background: #EEEEEE;
    border-color: #DDDDDD;
    cursor: not-allowed;
}

.agendamento-date-card.is-blocked .card-day-number {
    text-decoration: line-through;
    color: #888888;
}

/* 8. PÍLULAS DE HORÁRIO (TIME CHIPS DE 08:00 A 19:00 COM ESCASSEZ) */
.agendamento-time-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 16px;
}

.agendamento-time-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    background: #F7F7F7;
    border: 1.5px solid #E5E5E5;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #333333;
    cursor: pointer;
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
}

.agendamento-time-chip:hover:not(.is-occupied):not(.is-past-slot) {
    background: #FFFFFF;
    border-color: #820000;
    color: #820000;
    transform: translateY(-1px);
}

.agendamento-time-chip.is-selected {
    background: #111111 !important;
    border-color: #111111 !important;
    color: #EFE0AF !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

/* Horários Passados (Hoje < GMT-3 + 2h) - Totalmente Ocultados */
.agendamento-time-chip.is-past-slot {
    display: none !important;
}

/* Horários Ocupados / Reservados (Gatilho de Escassez e Prova Social) */
.agendamento-time-chip.is-occupied {
    background: #F3F4F6 !important;
    border: 1px dashed #CBD5E1 !important;
    color: #94A3B8 !important;
    cursor: not-allowed !important;
    opacity: 0.72;
    text-decoration: line-through;
    position: relative;
    pointer-events: none;
    padding-right: 10px;
}

.agendamento-time-chip.is-occupied::after {
    content: "Ocupado";
    font-size: 9px;
    font-weight: 700;
    color: #94A3B8;
    margin-left: 5px;
    text-decoration: none;
    display: inline-block;
    letter-spacing: 0.2px;
}

.agendamento-custom-time-wrap {
    display: none;
    width: 100%;
    margin-top: 6px;
    margin-bottom: 12px;
}

.agendamento-custom-time-wrap.is-visible {
    display: block;
}

.agendamento-custom-time-input {
    width: 130px;
    padding: 6px 10px;
    border: 1.5px solid #820000;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

/* 9. CAMPOS DE CONTATO EM 2 COLUNAS */
.agendamento-inputs-group {
    margin-bottom: 14px;
}

.agendamento-row-2col {
    display: flex;
    gap: 12px;
    margin-bottom: 10px;
}

.agendamento-col-50 {
    flex: 1;
    min-width: 0;
}

.agendamento-field {
    margin-bottom: 10px;
}

.agendamento-input {
    width: 100%;
    height: 42px;
    padding: 8px 14px;
    background: #F8F9FA;
    border: 1px solid #DCDCDC;
    border-radius: 6px;
    font-size: 13px;
    color: #333333;
    outline: none;
    transition: all 0.2s ease;
}

.agendamento-input:focus {
    background: #FFFFFF;
    border-color: #820000;
    box-shadow: 0 0 0 3px rgba(130, 0, 0, 0.12);
}

.agendamento-input::placeholder {
    color: #999999;
}

/* 10. BOTÃO DE CONFIRMAR AGENDAMENTO */
.btn-agendamento-submit {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 48px;
    background: linear-gradient(135deg, #820000 0%, #680000 100%);
    color: #FFFFFF !important;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(130, 0, 0, 0.35);
    transition: all 0.3s ease;
}

.btn-agendamento-submit:hover {
    background: linear-gradient(135deg, #5c0000 0%, #450000 100%);
    box-shadow: 0 6px 18px rgba(130, 0, 0, 0.45);
    transform: translateY(-1px);
}

.btn-agendamento-submit:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.agendamento-lgpd-note {
    margin: 8px 0 0 0;
    font-size: 10px;
    color: #888888;
    text-align: center;
    line-height: 1.3;
}

/* 11. TELA DE SUCESSO (WOW EFFECT COM SVG) */
.agendamento-success-screen {
    display: none;
    padding: 24px 20px;
    text-align: center;
    animation: agendamentoFadeIn 0.4s ease;
}

.agendamento-success-screen.is-active {
    display: block;
}

@keyframes agendamentoFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.agendamento-success-icon-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.agendamento-svg-success {
    animation: agendamentoPopIcon 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes agendamentoPopIcon {
    0% { transform: scale(0); opacity: 0; }
    80% { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.agendamento-success-title {
    font-size: 18px;
    font-weight: 700;
    color: #111111;
    margin: 0 0 8px 0;
}

.agendamento-success-msg {
    font-size: 13px;
    color: #555555;
    line-height: 1.5;
    margin-bottom: 16px;
}

.agendamento-success-summary {
    background: #F8F9FA;
    border: 1px dashed #CCCCCC;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 18px;
    font-size: 13px;
    color: #333333;
    text-align: left;
}

.agendamento-success-summary p {
    margin: 4px 0;
}

/* BLOCO DE ADICIONAR À AGENDA PESSOAL */
.agendamento-calendar-block {
    margin-bottom: 16px;
    padding: 12px 14px;
    background: #F8F9FA;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    text-align: left;
}

.agendamento-calendar-title {
    display: flex;
    align-items: center;
    font-size: 11px;
    font-weight: 700;
    color: #444444;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.agendamento-calendar-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.btn-cal-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: 1px solid transparent;
    line-height: 1.2;
    flex: 1;
    min-width: 130px;
    box-sizing: border-box;
}

.btn-cal-action svg {
    margin-right: 6px;
    flex-shrink: 0;
}

/* 1. Botão Apple Calendar (Destaque Dark / Apple Premium) */
.btn-cal-apple {
    background: #111111;
    color: #FFFFFF !important;
    border-color: #111111;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-cal-apple:hover {
    background: #252525;
    color: #FFFFFF !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* 2. Botão Google Agenda (Branco / Borda com ícone colorido) */
.btn-cal-google {
    background: #FFFFFF;
    color: #3C4043 !important;
    border-color: #DADCE0;
    box-shadow: 0 1px 3px rgba(60, 64, 67, 0.12);
}

.btn-cal-google:hover {
    background: #F8F9FA;
    border-color: #4285F4;
    color: #1A73E8 !important;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(66, 133, 244, 0.2);
}

/* 3. Botão Outlook / Windows */
.btn-cal-outlook {
    background: #FFFFFF;
    color: #0078D4 !important;
    border-color: #0078D4;
}

.btn-cal-outlook:hover {
    background: #0078D4;
    color: #FFFFFF !important;
    transform: translateY(-1px);
}

/* 4. Botão Genérico .ICS */
.btn-cal-ics {
    background: #FFFFFF;
    color: #555555 !important;
    border-color: #CCCCCC;
}

.btn-cal-ics:hover {
    background: #EEEEEE;
    color: #111111 !important;
}

/* Feedback de compromisso adicionado */
.btn-cal-action.is-added {
    background: #E8F5E9 !important;
    color: #2E7D32 !important;
    border-color: #81C784 !important;
}

.btn-agendamento-whats-confirm {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 13px 18px;
    background: #0b9d03;
    color: #FFFFFF !important;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 12px rgba(11, 157, 3, 0.3);
    transition: all 0.25s ease;
    margin-bottom: 8px;
}

.btn-agendamento-whats-confirm:hover {
    background: #087f02;
    color: #FFFFFF !important;
    text-decoration: none;
    transform: translateY(-1px);
}

.btn-agendamento-close-final {
    background: transparent;
    border: none;
    color: #777777;
    font-size: 12px;
    cursor: pointer;
    text-decoration: underline;
    margin-top: 6px;
}

.btn-agendamento-close-final:hover {
    color: #111111;
}

/* 12. RESPONSIVIDADE ADICIONAL */
@media (max-width: 540px) {
    .agendamento-row-2col {
        flex-direction: column;
        gap: 0;
    }
    .agendamento-col-50 {
        margin-bottom: 8px;
    }
    .agendamento-prop-thumb {
        width: 80px;
        height: 56px;
    }
    .agendamento-prop-loc {
        display: none;
    }
}

@media (max-width: 768px) {
    .agendamento-popover {
        display: none !important;
    }
}
