/**
 * Componentes Reutilizáveis - Agendly
 * Estilos para componentes JavaScript
 */

/* ============================================
   MODAL
   ============================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: var(--agendly-z-modal);
    overflow: auto;
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--agendly-bg-overlay);
    z-index: var(--agendly-z-modal-backdrop);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal-backdrop.show {
    opacity: 1;
}

.modal-dialog {
    position: relative;
    width: 90%;
    max-width: 500px;
    margin: auto;
    z-index: var(--agendly-z-modal);
    animation: scaleIn 0.3s ease;
}

.modal-content {
    background: var(--agendly-white);
    border-radius: var(--agendly-radius-lg);
    box-shadow: var(--agendly-shadow-xl);
    overflow: hidden;
}

.modal-header {
    padding: var(--agendly-spacing-lg);
    border-bottom: 1px solid var(--agendly-gray-200);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    margin: 0;
    font-size: var(--agendly-font-xl);
    font-weight: var(--agendly-font-bold);
    color: var(--agendly-text-primary);
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--agendly-gray-600);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--agendly-radius-sm);
    transition: all var(--agendly-transition-base);
}

.modal-close:hover {
    background: var(--agendly-gray-200);
    color: var(--agendly-text-primary);
}

.modal-body {
    padding: var(--agendly-spacing-lg);
}

.modal-footer {
    padding: var(--agendly-spacing-lg);
    border-top: 1px solid var(--agendly-gray-200);
    display: flex;
    gap: var(--agendly-spacing-sm);
    justify-content: flex-end;
}

/* ============================================
   TOAST / NOTIFICATION
   ============================================ */

.toast {
    position: fixed;
    z-index: var(--agendly-z-tooltip);
    min-width: 300px;
    max-width: 500px;
    padding: var(--agendly-spacing-md);
    background: var(--agendly-white);
    border-radius: var(--agendly-radius-md);
    box-shadow: var(--agendly-shadow-lg);
    opacity: 0;
    transform: translateY(-20px);
    transition: all var(--agendly-transition-base);
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-top-right {
    top: var(--agendly-spacing-lg);
    right: var(--agendly-spacing-lg);
}

.toast-top-left {
    top: var(--agendly-spacing-lg);
    left: var(--agendly-spacing-lg);
}

.toast-bottom-right {
    bottom: var(--agendly-spacing-lg);
    right: var(--agendly-spacing-lg);
}

.toast-bottom-left {
    bottom: var(--agendly-spacing-lg);
    left: var(--agendly-spacing-lg);
}

.toast-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--agendly-spacing-md);
}

.toast-message {
    flex: 1;
    color: var(--agendly-text-primary);
}

.toast-primary {
    border-left: 4px solid var(--agendly-primary);
}

.toast-danger {
    border-left: 4px solid var(--agendly-danger);
}

.toast-warning {
    border-left: 4px solid var(--agendly-warning);
}

.toast-close {
    background: none;
    border: none;
    font-size: 1.25rem;
    color: var(--agendly-gray-600);
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--agendly-radius-sm);
    transition: all var(--agendly-transition-base);
}

.toast-close:hover {
    background: var(--agendly-gray-200);
    color: var(--agendly-text-primary);
}

/* ============================================
   DROPDOWN
   ============================================ */

.dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-toggle {
    display: flex;
    align-items: center;
    gap: var(--agendly-spacing-xs);
    padding: var(--agendly-spacing-sm) var(--agendly-spacing-md);
    background: var(--agendly-white);
    border: 2px solid var(--agendly-gray-300);
    border-radius: var(--agendly-radius-md);
    color: var(--agendly-text-primary);
    cursor: pointer;
    transition: all var(--agendly-transition-base);
}

.dropdown-toggle:hover {
    border-color: var(--agendly-primary);
    color: var(--agendly-primary);
}

.dropdown.open .dropdown-toggle {
    border-color: var(--agendly-primary);
    color: var(--agendly-primary);
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 200px;
    margin-top: var(--agendly-spacing-xs);
    background: var(--agendly-white);
    border: 1px solid var(--agendly-gray-200);
    border-radius: var(--agendly-radius-md);
    box-shadow: var(--agendly-shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--agendly-transition-base);
    z-index: var(--agendly-z-dropdown);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: block;
    width: 100%;
    padding: var(--agendly-spacing-sm) var(--agendly-spacing-md);
    color: var(--agendly-text-primary);
    text-decoration: none;
    transition: all var(--agendly-transition-base);
    border: none;
    background: none;
    text-align: left;
    cursor: pointer;
}

.dropdown-item:hover {
    background: var(--agendly-bg-secondary);
    color: var(--agendly-primary);
}

.dropdown-item:first-child {
    border-top-left-radius: var(--agendly-radius-md);
    border-top-right-radius: var(--agendly-radius-md);
}

.dropdown-item:last-child {
    border-bottom-left-radius: var(--agendly-radius-md);
    border-bottom-right-radius: var(--agendly-radius-md);
}

.dropdown-divider {
    height: 1px;
    margin: var(--agendly-spacing-xs) 0;
    background: var(--agendly-gray-200);
}

/* ============================================
   TOOLTIP
   ============================================ */

.tooltip {
    position: absolute;
    padding: var(--agendly-spacing-xs) var(--agendly-spacing-sm);
    background: var(--agendly-gray-900);
    color: var(--agendly-white);
    font-size: var(--agendly-font-sm);
    border-radius: var(--agendly-radius-sm);
    white-space: nowrap;
    z-index: var(--agendly-z-tooltip);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--agendly-transition-base);
}

.tooltip.show {
    opacity: 1;
}

.tooltip::after {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border: 5px solid transparent;
}

.tooltip-top::after {
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-top-color: var(--agendly-gray-900);
}

.tooltip-bottom::after {
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    border-bottom-color: var(--agendly-gray-900);
}

.tooltip-left::after {
    right: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-left-color: var(--agendly-gray-900);
}

.tooltip-right::after {
    left: -10px;
    top: 50%;
    transform: translateY(-50%);
    border-right-color: var(--agendly-gray-900);
}

/* ============================================
   LOADING SPINNER
   ============================================ */

.spinner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1000;
}

.spinner-border {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--agendly-gray-200);
    border-top-color: var(--agendly-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner-sm .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 2px;
}

.spinner-lg .spinner-border {
    width: 4rem;
    height: 4rem;
    border-width: 5px;
}

.spinner-primary .spinner-border {
    border-top-color: var(--agendly-primary);
}

.spinner-danger .spinner-border {
    border-top-color: var(--agendly-danger);
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   FORM VALIDATION
   ============================================ */

.form-control.is-valid {
    border-color: var(--agendly-primary);
}

.form-control.is-invalid {
    border-color: var(--agendly-danger);
}

.valid-feedback,
.invalid-feedback {
    display: block;
    margin-top: var(--agendly-spacing-xs);
    font-size: var(--agendly-font-sm);
}

.valid-feedback {
    color: var(--agendly-primary);
}

.invalid-feedback {
    color: var(--agendly-danger);
}

/* ============================================
   SKELETON LOADER
   ============================================ */

.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
    border-radius: var(--agendly-radius-sm);
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: var(--agendly-spacing-sm);
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: var(--agendly-spacing-md);
}

.skeleton-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
}

/* ============================================
   PROGRESS BAR
   ============================================ */

.progress {
    width: 100%;
    height: 8px;
    background: var(--agendly-gray-200);
    border-radius: var(--agendly-radius-full);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--agendly-gradient);
    border-radius: var(--agendly-radius-full);
    transition: width var(--agendly-transition-base);
}

.progress-sm {
    height: 4px;
}

.progress-lg {
    height: 12px;
}

/* ============================================
   RESPONSIVIDADE
   ============================================ */

@media (max-width: 768px) {
    .modal-dialog {
        width: 95%;
        margin: var(--agendly-spacing-md);
    }
    
    .toast {
        min-width: auto;
        width: calc(100% - 2rem);
        left: var(--agendly-spacing-md) !important;
        right: var(--agendly-spacing-md) !important;
    }
    
    .dropdown-menu {
        min-width: 100%;
    }
}

