﻿/* Agendamento Médico - Frontend CSS */

:root {
    /* Cores Principais */
    --am-primary-color: #2c2c2c;
    --am-secondary-color: #f44336;
    --am-accent-color: #007cba;
    
    /* Cores do Calendário */
    --am-calendar-bg: #ffffff;
    --am-calendar-border: #e0e0e0;
    --am-day-available: #2c2c2c;
    --am-day-unavailable: #e9ecef;
    --am-day-selected: #007cba;
    --am-day-hover: #1a1a1a;
    
    /* Cores dos Horários */
    --am-time-available: #2c2c2c;
    --am-time-selected: #007cba;
    --am-time-hover: #1a1a1a;
    --am-time-unavailable: #f8d7da;
    
    /* Cores dos Botões */
    --am-btn-primary: #2c2c2c;
    --am-btn-secondary: #6c757d;
    --am-btn-success: #1a1a1a;
    --am-btn-warning: #ffc107;
    --am-btn-danger: #dc3545;
    
    /* Cores do Texto */
    --am-text-dark: #333;
    --am-text-light: #666;
    --am-text-muted: #999;
    --am-text-white: #ffffff;
    
    /* Cores de Fundo */
    --am-bg-light: #f8f9fa;
    --am-bg-white: #ffffff;
    --am-bg-success: #e8e8e8;
    --am-bg-warning: #fff3cd;
    --am-bg-danger: #f8d7da;
    
    /* Cores de Borda */
    --am-border-light: #e0e0e0;
    --am-border-primary: #2c2c2c;
    --am-border-success: #1a1a1a;
    --am-border-warning: #ffc107;
    --am-border-danger: #dc3545;
    
    /* Configurações Gerais */
    --am-shadow: 0 2px 10px rgba(0,0,0,0.1);
    --am-radius: 8px;
    --am-transition: all 0.2s ease;
}

/* Reset básico para o container */
.am-booking-container * {
    box-sizing: border-box;
}

/* Container principal */
.am-booking-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    position: relative;
}

/* Header da clínica */
.am-clinic-header {
    text-align: center;
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--am-border-light);
}

.am-clinic-logo {
    max-height: 60px;
    margin-bottom: 10px;
}

.am-clinic-name {
    margin: 0;
    color: var(--am-text-dark);
    font-size: 24px;
    font-weight: 600;
}

/* Header do agendamento */
.am-booking-header {
    text-align: center;
    margin-bottom: 30px;
}

.am-booking-header h1 {
    margin: 0;
    color: var(--am-text-dark);
    font-size: 28px;
    font-weight: 600;
}

/* Indicador de passos */
.am-step-indicator {
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
    position: relative;
}

.am-step-indicator::before {
    content: '';
    position: absolute;
    top: 25px;
    left: 50%;
    transform: translateX(-50%);
    width: 60%;
    height: 2px;
    background: var(--am-border-light);
    z-index: 1;
}

.am-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    z-index: 2;
    flex: 1;
    max-width: 150px;
}

.am-step-number {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--am-border-light);
    color: var(--am-text-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    margin-bottom: 8px;
    transition: var(--am-transition);
}

.am-step-text {
    font-size: 14px;
    color: var(--am-text-light);
    text-align: center;
}

.am-step.am-step-active .am-step-number,
.am-step.am-step-completed .am-step-number {
    background: var(--am-primary-color);
    color: white;
}

.am-step.am-step-active .am-step-text,
.am-step.am-step-completed .am-step-text {
    color: var(--am-text-dark);
    font-weight: 600;
}

/* Conteúdo dos passos */
.am-step-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.am-step-content.active {
    display: block;
}

.am-step-content h3 {
    margin-bottom: 20px;
    color: var(--am-text-dark);
    font-size: 20px;
    font-weight: 600;
    text-align: center;
}

/* Container do calendário */
.am-step-1 {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* Animações */
/* Correções para seleção de datas e horários */
.am-day-available.am-selected {
    background: #1976d2 !important;
    color: white !important;
    font-weight: 600;
    border-color: #1976d2 !important;
}

.am-time-slot.am-selected {
            background: #2c2c2c !important;
        color: white !important;
        border-color: #2c2c2c !important;
}

.am-times-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
    margin: 20px 0;
}

.am-time-slot {
    padding: 12px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    background: white;
}

.am-time-slot:hover {
    border-color: var(--am-time-hover);
    background: var(--am-time-hover);
    color: var(--am-text-white) !important;
}

.am-time-slot.am-time-available {
    border-color: var(--am-time-available);
    color: var(--am-time-available);
}

.am-no-times {
    text-align: center;
    padding: 40px 20px;
    background: #f8f9fa;
    border-radius: 8px;
    color: #666;
    font-style: italic;
}

/* Melhora visibilidade dos botões */
.am-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.am-btn-primary:disabled {
    background: #ccc !important;
    border-color: #ccc !important;
}

/* Melhora os passos ativos */
.am-step-content {
    min-height: 400px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Calendário - Versão compacta e delicada */
.am-calendar {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    max-width: 350px;
    margin: 0 auto;
    position: relative;
}

.am-calendar.am-loading {
    pointer-events: none;
    opacity: 0.7;
}

.am-calendar.am-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    border: 2px solid #ddd;
    border-top-color: #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    z-index: 10;
}

.am-calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.am-calendar-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.am-prev-month,
.am-next-month {
    background: none;
    border: none;
    padding: 6px 8px;
    cursor: pointer;
    border-radius: 4px;
    font-size: 14px;
    color: #666;
    transition: all 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.am-prev-month:hover,
.am-next-month:hover {
    background: #e9ecef;
    color: #333;
}

.am-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    background: #f8f9fa;
}

.am-weekday {
    padding: 8px 4px;
    text-align: center;
    font-weight: 600;
    font-size: 11px;
    color: #666;
    text-transform: uppercase;
}

.am-days {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 1px;
    background: #f1f3f4;
}

.am-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
    background: white;
    min-height: 32px;
    font-size: 13px;
}

.am-day:hover {
    background: #f0f0f0;
}

.am-day-number {
    font-weight: 500;
}

.am-day-past {
    color: #ccc;
    cursor: default;
    background: #f8f9fa !important;
    opacity: 0.5;
    pointer-events: none;
}

.am-day-past:hover {
    background: #f8f9fa !important;
}

.am-day-available {
    color: var(--am-text-dark);
    font-weight: 600;
    position: relative;
    background: var(--am-day-available);
    color: var(--am-text-white);
}

.am-day-available:hover {
    background: var(--am-day-hover);
    color: var(--am-text-white);
}

.am-day-selected {
    background: var(--am-day-selected);
    color: var(--am-text-white);
    font-weight: 600;
}

.am-day-unavailable {
    background: var(--am-day-unavailable) !important;
    color: var(--am-text-muted) !important;
    cursor: default !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
}

.am-day-unavailable:hover {
    background: #6c757d !important;
    color: #ffffff !important;
}

.am-day-full {
    background: #6c757d !important;
    color: #ffffff !important;
    cursor: default !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
}

.am-day-full:hover {
    background: #6c757d !important;
    color: #ffffff !important;
}

.am-day-no-schedule {
    background: #e9ecef !important;
    color: #6c757d !important;
    cursor: default !important;
    opacity: 0.8 !important;
    pointer-events: none !important;
}

.am-day-no-schedule:hover {
    background: #e9ecef !important;
    color: #6c757d !important;
}

.am-day-blocked {
    background: #6c757d !important;
    color: #ffffff !important;
    cursor: default !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
    text-decoration: line-through;
}

.am-day-blocked:hover {
    background: #6c757d !important;
    color: #ffffff !important;
}

.am-day-today {
    background: #fff3e0;
    border: 1px solid #ff9800;
    color: #e65100;
    font-weight: 600;
}

/* Indicador de disponibilidade */
.am-day-available::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #2c2c2c;
}

/* Legenda do calendário */
.am-calendar-legend {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: var(--am-radius);
    font-size: 12px;
}

.am-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
}

.am-legend-color {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid #ddd;
}

.am-legend-available {
    background: #2c2c2c;
}

.am-legend-full {
    background: #6c757d;
    border-color: #6c757d;
}

.am-legend-blocked {
    background: #6c757d;
    border-color: #6c757d;
}

.am-legend-unavailable {
    background: #6c757d;
    border-color: #6c757d;
}

.am-legend-past {
    background: #fafafa;
    border-color: #999;
}

/* Seleção de horários */
.am-selected-date-display {
    margin-bottom: 20px;
    padding: 15px;
    background: var(--am-bg-light);
    border-radius: var(--am-radius);
    text-align: center;
}

.am-times-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.am-time-slot {
    padding: 15px;
    border: 2px solid var(--am-border-light);
    border-radius: var(--am-radius);
    text-align: center;
    cursor: pointer;
    transition: var(--am-transition);
    font-weight: 500;
}

.am-time-slot:hover {
    border-color: var(--am-time-hover);
    background: var(--am-time-hover);
    color: var(--am-text-white) !important;
}

.am-time-slot.am-time-available {
    border-color: var(--am-time-available);
    color: white;
    background: var(--am-time-available);
}

.am-time-slot.am-time-available:hover,
.am-time-slot.am-time-selected {
    background: var(--am-time-selected);
    color: var(--am-text-white) !important;
    border-color: var(--am-time-selected);
}

.am-time-slot.am-time-unavailable {
    background: #f8d7da;
    color: #721c24;
    cursor: not-allowed;
    opacity: 0.6;
}

/* Horários ocupados (agendados) */
.am-time-slot.am-time-booked {
    background: #6c757d !important;
    color: #ffffff !important;
    cursor: not-allowed !important;
    opacity: 0.7 !important;
    pointer-events: none !important;
}

.am-time-slot.am-time-booked:before {
    content: "🚫 ";
    font-size: 12px;
}

/* Horários que já passaram */
.am-time-slot.am-time-passed {
    background: #e9ecef !important;
    color: #adb5bd !important;
    cursor: not-allowed !important;
    opacity: 0.5 !important;
    pointer-events: none !important;
}

.am-no-times {
    text-align: center;
    color: var(--am-text-light);
    padding: 40px 20px;
    background: var(--am-bg-light);
    border-radius: var(--am-radius);
}

.am-loading-times {
    text-align: center;
    padding: 40px 20px;
    color: var(--am-text-light);
}

/* Formulário */
.am-booking-summary {
    background: #f5f5f5;
    padding: 15px;
    border-radius: var(--am-radius);
    margin-bottom: 20px;
    text-align: center;
    border: 2px solid #333333;
}

.am-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.am-form-group-full {
    grid-column: 1 / -1;
}

.am-form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: var(--am-text-dark);
}

.am-form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--am-border-light);
    border-radius: 6px;
    font-size: 16px;
    transition: var(--am-transition);
}

.am-form-group input:focus {
    outline: none;
    border-color: var(--am-primary-color);
}

/* Botões - Estilo mais delicado */
.am-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
    min-width: 100px;
}

/* Estilos específicos para botões de tipo button e submit conforme solicitado */
[type=button], [type=submit], button {
    background-color: transparent !important;
    border: 1px solid !important;
    border-radius: 3px !important;
    color: black !important;
}

/* Botões primários */
.am-btn-primary {
    background: var(--am-btn-primary);
    color: var(--am-text-white);
    border: 1px solid var(--am-btn-primary);
}

.am-btn-primary:hover:not(:disabled) {
    background: var(--am-day-hover);
    border-color: var(--am-day-hover);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

/* Botões secundários */
.am-btn-secondary {
    background: var(--am-btn-secondary);
    color: var(--am-text-white);
    border: 1px solid var(--am-btn-secondary);
}

.am-btn-secondary:hover {
    background: var(--am-text-muted);
    border-color: var(--am-text-muted);
}

.am-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Centralizar setas nos botões de navegação */
.am-step-navigation {
    display: flex;
    justify-content: space-between;
    margin-top: 30px;
}

.am-step-navigation button {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.am-step-navigation button::before,
.am-step-navigation button::after {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
}

/* Mensagem de sucesso */
.am-success-message {
    text-align: center;
    padding: 40px 20px;
}

.am-success-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.am-success-message h3 {
    color: var(--am-primary-color);
    margin-bottom: 15px;
}

.am-success-message p {
    color: var(--am-text-light);
    margin-bottom: 10px;
}

/* Loading */
.am-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.am-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--am-primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

.am-loading p {
    color: white;
    font-size: 16px;
}

/* Responsivo */
@media (max-width: 768px) {
    .am-booking-container {
        margin: 10px;
        padding: 15px;
    }
    
    .am-form-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* Steps responsivos para tablet */
    .am-step-indicator {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
        margin-bottom: 30px;
    }
    
    .am-step-indicator::before {
        width: 80%;
    }
    
    .am-step {
        min-width: 120px;
    }
    
    .am-step-text {
        font-size: 12px;
        text-align: center;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    
    .am-times-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .am-step-navigation {
        flex-direction: column;
        gap: 10px;
    }
    
    .am-booking-header h1 {
        font-size: 24px;
    }
    
    .am-clinic-name {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .am-booking-container {
        padding: 10px;
        margin: 5px;
    }
    
    /* Steps para mobile - layout horizontal compacto */
    .am-step-indicator {
        flex-direction: row;
        justify-content: center;
        align-items: center;
        margin-bottom: 25px;
        padding: 0 20px;
        gap: 0;
    }
    
    .am-step-indicator::before {
        top: 17px;
        width: 50%;
        height: 1px;
        background: var(--am-border-light);
    }
    
    .am-step {
        flex-direction: column;
        align-items: center;
        max-width: none;
        min-width: 70px;
        flex: 0 0 auto;
        margin: 0 15px;
    }
    
    .am-step-number {
        width: 35px;
        height: 35px;
        font-size: 16px;
        font-weight: 600;
        margin-bottom: 8px;
        line-height: 35px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .am-step-text {
        font-size: 11px;
        line-height: 1.3;
        text-align: center;
        max-width: 70px;
        font-weight: 500;
    }
    
    .am-day {
        font-size: 14px;
        padding: 8px 4px;
    }
    
    .am-weekday {
        padding: 8px 2px;
        font-size: 11px;
    }
    
    .am-times-grid {
        grid-template-columns: 1fr;
        gap: 8px;
    }
    
    .am-time-slot {
        padding: 12px 8px;
        font-size: 14px;
    }
    
    .am-form-group label {
        font-size: 14px;
        margin-bottom: 5px;
    }
    
    .am-form-control {
        padding: 12px;
        font-size: 14px;
    }
    
    .am-btn {
        padding: 12px 20px;
        font-size: 14px;
        min-height: 44px; /* Touch-friendly */
    }
    
    .am-step-text {
        font-size: 12px;
    }
}

/* Melhorias de acessibilidade */
.am-booking-container :focus {
    outline: 2px solid var(--am-primary-color);
    outline-offset: 2px;
}

.am-day:focus,
.am-time-slot:focus {
    outline: 2px solid var(--am-primary-color);
    outline-offset: -2px;
}

/* Print styles */
@media print {
    .am-booking-container {
        box-shadow: none;
    }
}

/* Celulares muito pequenos */
@media (max-width: 480px) {
    .am-step-indicator {
        padding: 0 10px;
        margin-bottom: 20px;
    }
    
    .am-step {
        margin: 0 8px;
        min-width: 60px;
    }
    
    .am-step-number {
        width: 30px;
        height: 30px;
        font-size: 14px;
        line-height: 30px;
    }
    
    .am-step-text {
        font-size: 10px;
        max-width: 60px;
    }
    
    .am-step-indicator::before {
        width: 45%;
        top: 15px;
    }
}

/* Print styles - corrigido */
@media print {
    .am-booking-container {
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    .am-btn,
    .am-step-navigation {
        display: none;
    }
}
