/**
 * Estilos para o componente AgendaForm
 */

/* Container do formulário */
.agenda-form {
    padding: 0;
}

/* Dropdown de autocomplete */
.dropdown-autocomplete {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border: 1px solid #dee2e6;
    border-top: none;
    border-radius: 0 0 0.375rem 0.375rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-top: -1px;
}

.dropdown-autocomplete .dropdown-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

.dropdown-autocomplete .dropdown-item:hover {
    background-color: #f8f9fa;
}

.dropdown-autocomplete .dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-autocomplete .dropdown-item strong {
    color: #212529;
    font-size: 1rem;
}

.dropdown-autocomplete .dropdown-item small {
    font-size: 0.875rem;
    display: block;
    margin-top: 0.25rem;
}

/* Scroll customizado para dropdown */
.dropdown-autocomplete::-webkit-scrollbar {
    width: 6px;
}

.dropdown-autocomplete::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.dropdown-autocomplete::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 3px;
}

.dropdown-autocomplete::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Input com resultado selecionado */
.form-control.is-valid {
    border-color: #198754;
    padding-right: calc(1.5em + 0.75rem);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'%3e%3cpath fill='%23198754' d='M2.3 6.73L.6 4.53c-.4-1.04.46-1.4 1.1-.8l1.1 1.4 3.4-3.8c.6-.63 1.6-.27 1.2.7l-4 4.6c-.43.5-.8.4-1.1.1z'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right calc(0.375em + 0.1875rem) center;
    background-size: calc(0.75em + 0.375rem) calc(0.75em + 0.375rem);
}

/* Alert de seleção */
.alert {
    margin-bottom: 0;
}

.alert.py-2 {
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* Labels com asterisco */
.form-label .text-danger {
    font-weight: bold;
    margin-left: 2px;
}

/* Botões do formulário */
.agenda-form .btn {
    min-width: 120px;
}

/* Gap entre botões */
.gap-2 {
    gap: 0.5rem;
}

/* Animação para dropdown */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dropdown-autocomplete {
    animation: slideDown 0.2s ease-out;
}

/* Estilo para link de cadastro */
.agenda-form a.text-primary {
    text-decoration: none;
    font-weight: 500;
}

.agenda-form a.text-primary:hover {
    text-decoration: underline;
}

/* Spinner no dropdown */
.dropdown-autocomplete .spinner-border-sm {
    width: 1rem;
    height: 1rem;
}

/* Mensagem de erro */
.invalid-feedback {
    font-size: 0.875rem;
    margin-top: 0.25rem;
}

/* Disabled state */
.form-control:disabled,
.form-select:disabled {
    background-color: #e9ecef;
    opacity: 0.7;
    cursor: not-allowed;
}

/* Alert de disponibilidade */
.alert.alert-success {
    background-color: #d1e7dd;
    border-color: #badbcc;
    color: #0f5132;
}

.alert.alert-danger {
    background-color: #f8d7da;
    border-color: #f5c2c7;
    color: #842029;
}

.alert.alert-info {
    background-color: #cff4fc;
    border-color: #b6effb;
    color: #055160;
}

/* Botão X para limpar seleção */
.btn-outline-danger {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Responsividade */
@media (max-width: 768px) {
    .dropdown-autocomplete {
        max-height: 200px;
    }
    
    .agenda-form .btn {
        min-width: 100px;
        font-size: 0.875rem;
    }
    
    .form-label {
        font-size: 0.875rem;
    }
}

/* Focus state melhorado */
.form-control:focus,
.form-select:focus {
    border-color: #86b7fe;
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Placeholder */
.form-control::placeholder {
    color: #6c757d;
    opacity: 0.7;
}

/* Textarea */
textarea.form-control {
    resize: vertical;
    min-height: 80px;
}

/* Select appearance */
.form-select {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
}

/* Loading state */
.salvando {
    opacity: 0.7;
    pointer-events: none;
}

/* Animação do botão de salvar */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.btn .spinner-border {
    animation: pulse 1s ease-in-out infinite;
}
