/* ========================================
   SISTEMA DE AGENDAMENTO - FAST LEGALIZA
   ======================================== */

/* Modal de Agendamento */
.scheduling-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.scheduling-modal.active {
    opacity: 1;
    pointer-events: all;
}

.scheduling-modal-content {
    background: white;
    border-radius: 24px;
    max-width: 1000px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(107, 70, 193, 0.3);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.scheduling-modal.active .scheduling-modal-content {
    transform: scale(1) translateY(0);
}

/* Header do Modal */
.scheduling-header {
    background: linear-gradient(135deg, #6B46C1 0%, #805AD5 100%);
    padding: 2rem;
    border-radius: 24px 24px 0 0;
    position: relative;
    overflow: hidden;
}

.scheduling-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    filter: blur(40px);
}

.scheduling-header h2 {
    color: white;
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    position: relative;
    z-index: 1;
}

.scheduling-header p {
    color: rgba(255, 255, 255, 0.9);
    margin: 0.5rem 0 0 0;
    position: relative;
    z-index: 1;
}

.close-scheduling {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 2;
}

.close-scheduling:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.close-scheduling .material-icons {
    color: white;
    font-size: 24px;
}

/* Tabs de Navegação */
.scheduling-tabs {
    display: flex;
    gap: 1rem;
    padding: 1.5rem 2rem 0 2rem;
    border-bottom: 2px solid #f0f0f0;
}

.scheduling-tab {
    padding: 0.75rem 1.5rem;
    background: none;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    color: #718096;
    cursor: pointer;
    position: relative;
    transition: all 0.3s ease;
}

.scheduling-tab:hover {
    color: #6B46C1;
}

.scheduling-tab.active {
    color: #6B46C1;
}

.scheduling-tab.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #6B46C1;
}

/* Conteúdo das Tabs */
.scheduling-tab-content {
    display: none;
    padding: 2rem;
}

.scheduling-tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Calendário */
.calendar-container {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.calendar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.calendar-header h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.calendar-nav {
    display: flex;
    gap: 0.5rem;
}

.calendar-nav button {
    background: white;
    border: 1px solid #e2e8f0;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.calendar-nav button:hover {
    background: #6B46C1;
    border-color: #6B46C1;
    color: white;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 0.5rem;
}

.calendar-day-header {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: #718096;
    padding: 0.5rem;
    text-transform: uppercase;
}

.calendar-day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    border: 2px solid transparent;
    position: relative;
}

.calendar-day:hover:not(.disabled):not(.other-month) {
    background: #f0e7ff;
    border-color: #6B46C1;
    transform: scale(1.05);
}

.calendar-day.selected {
    background: #6B46C1;
    color: white;
    border-color: #6B46C1;
}

.calendar-day.disabled {
    background: #f7fafc;
    color: #cbd5e0;
    cursor: not-allowed;
}

.calendar-day.other-month {
    color: #cbd5e0;
}

.calendar-day.has-appointments::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 4px;
    background: #48bb78;
    border-radius: 50%;
}

/* Grade de Horários */
.time-slots-container {
    background: #f8f9fa;
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.time-slots-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.time-slots-header h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #2d3748;
    margin: 0;
}

.time-slots-legend {
    display: flex;
    gap: 1rem;
    font-size: 0.75rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-dot.available {
    background: #48bb78;
}

.legend-dot.unavailable {
    background: #cbd5e0;
}

.time-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 0.75rem;
}

.time-slot {
    padding: 0.75rem;
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    text-align: center;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.time-slot:hover:not(.unavailable) {
    background: #f0e7ff;
    border-color: #6B46C1;
    transform: translateY(-2px);
}

.time-slot.selected {
    background: #6B46C1;
    color: white;
    border-color: #6B46C1;
}

.time-slot.unavailable {
    background: #f7fafc;
    color: #cbd5e0;
    cursor: not-allowed;
    opacity: 0.6;
}

.time-slot.unavailable::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 10%;
    right: 10%;
    height: 2px;
    background: #cbd5e0;
    transform: rotate(-45deg);
}

/* Formulário de Agendamento */
.appointment-form {
    display: grid;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #2d3748;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.875rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #6B46C1;
    box-shadow: 0 0 0 3px rgba(107, 70, 193, 0.1);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Resumo do Agendamento */
.appointment-summary {
    background: linear-gradient(135deg, #f0e7ff 0%, #e9d8fd 100%);
    border-radius: 16px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.appointment-summary h4 {
    font-size: 1rem;
    font-weight: 700;
    color: #6B46C1;
    margin: 0 0 1rem 0;
}

.summary-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.summary-item .material-icons {
    color: #6B46C1;
    font-size: 20px;
}

.summary-item-content {
    flex: 1;
}

.summary-item-label {
    font-size: 0.75rem;
    color: #805AD5;
    font-weight: 600;
    text-transform: uppercase;
}

.summary-item-value {
    font-size: 0.875rem;
    color: #2d3748;
    font-weight: 600;
}

/* Histórico de Agendamentos */
.history-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.appointment-card {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    padding: 1.5rem;
    transition: all 0.3s ease;
}

.appointment-card:hover {
    border-color: #6B46C1;
    box-shadow: 0 4px 12px rgba(107, 70, 193, 0.1);
}

.appointment-card-header {
    display: flex;
    justify-content: space-between;
    align-items: start;
    margin-bottom: 1rem;
}

.appointment-status {
    padding: 0.375rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.appointment-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.appointment-status.confirmed {
    background: #d1fae5;
    color: #065f46;
}

.appointment-status.completed {
    background: #e0e7ff;
    color: #3730a3;
}

.appointment-status.cancelled {
    background: #fee2e2;
    color: #991b1b;
}

.appointment-card-body {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.appointment-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.appointment-info .material-icons {
    color: #6B46C1;
    font-size: 20px;
}

.appointment-info-content {
    flex: 1;
}

.appointment-info-label {
    font-size: 0.75rem;
    color: #718096;
    font-weight: 500;
}

.appointment-info-value {
    font-size: 0.875rem;
    color: #2d3748;
    font-weight: 600;
}

/* Botões */
.btn-primary {
    background: #6B46C1;
    color: white;
    padding: 0.875rem 2rem;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary:hover {
    background: #805AD5;
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(107, 70, 193, 0.3);
}

.btn-secondary {
    background: white;
    color: #6B46C1;
    padding: 0.875rem 2rem;
    border: 2px solid #6B46C1;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: #f0e7ff;
}

.btn-group {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    top: 2rem;
    right: 2rem;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.toast {
    background: white;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 1rem;
    min-width: 300px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(400px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    border-left: 4px solid #48bb78;
}

.toast.error {
    border-left: 4px solid #f56565;
}

.toast.info {
    border-left: 4px solid #4299e1;
}

.toast-icon {
    font-size: 24px;
}

.toast.success .toast-icon {
    color: #48bb78;
}

.toast.error .toast-icon {
    color: #f56565;
}

.toast.info .toast-icon {
    color: #4299e1;
}

.toast-content {
    flex: 1;
}

.toast-title {
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.25rem;
}

.toast-message {
    font-size: 0.75rem;
    color: #718096;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
}

.empty-state .material-icons {
    font-size: 64px;
    color: #cbd5e0;
    margin-bottom: 1rem;
}

.empty-state h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.5rem;
}

.empty-state p {
    color: #718096;
    font-size: 0.875rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .scheduling-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .scheduling-header {
        border-radius: 0;
    }

    .calendar-grid {
        gap: 0.25rem;
    }

    .time-slots-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .appointment-card-body {
        grid-template-columns: 1fr;
    }

    .btn-group {
        flex-direction: column;
    }

    .btn-primary,
    .btn-secondary {
        width: 100%;
    }

    .toast-container {
        left: 1rem;
        right: 1rem;
    }

    .toast {
        min-width: auto;
    }
}

/* Loading State */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Scrollbar Customizado */
.scheduling-modal-content::-webkit-scrollbar {
    width: 8px;
}

.scheduling-modal-content::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.scheduling-modal-content::-webkit-scrollbar-thumb {
    background: #6B46C1;
    border-radius: 4px;
}

.scheduling-modal-content::-webkit-scrollbar-thumb:hover {
    background: #805AD5;
}
