/* css/components/modals.css - Styles des modales */

/* New Modal Overlay for Reservation */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(2px);
}

.modal-container {
    background: var(--bg-card);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    width: 90vw;
    max-width: 600px; /* Increased width for richer form */
    max-height: 90vh;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Switch Component */
.switch-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: 0.3s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: var(--primary);
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    margin: 0;
}

/* Form Elements in Modal */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Toast Updates */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 300px;
    max-width: 400px;
    animation: toastSlideIn 0.3s ease;
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
}

.toast-title {
    font-weight: 600;
    color: var(--text-primary);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    line-height: 1;
    padding: 0;
}

.toast-close:hover {
    color: var(--text-primary);
}

.toast-body {
    padding: 0.75rem 1rem;
    color: var(--text-secondary);
}

/* Toast Types */
.toast-success {
    border-left: 4px solid var(--success);
}

.toast-error {
    border-left: 4px solid var(--error);
}

.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast-info {
    border-left: 4px solid var(--primary);
}

/* Modal backdrop */
.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-modal);
    backdrop-filter: blur(4px);
    z-index: var(--z-modal-backdrop);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal-backdrop.show .modal {
    transform: scale(1);
    opacity: 1;
}

/* Modal container */
.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: var(--modal-max-width);
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transform: scale(0.9);
    opacity: 0;
    transition: all var(--transition-bounce);
}

/* Modal header */
.modal-header {
    padding: var(--space-xl) var(--space-xl) var(--space-lg);
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.modal-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.modal-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin: var(--space-xs) 0 0 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    background: transparent;
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-bold);
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.modal-close:hover {
    background: var(--error-light);
    color: var(--error);
}

/* Modal body */
.modal-body {
    padding: var(--space-xl);
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.modal-body.compact {
    padding: var(--space-lg);
}

.modal-body.spacious {
    padding: var(--space-xxl);
}

/* Modal footer */
.modal-footer {
    padding: var(--space-lg) var(--space-xl) var(--space-xl);
    border-top: 1px solid var(--border-light);
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
    flex-shrink: 0;
}

.modal-footer.center {
    justify-content: center;
}

.modal-footer.start {
    justify-content: flex-start;
}

.modal-footer.space-between {
    justify-content: space-between;
}

/* Modal sizes */
.modal.modal-sm {
    max-width: 400px;
}

.modal.modal-lg {
    max-width: 800px;
}

.modal.modal-xl {
    max-width: 1200px;
}

.modal.modal-fullscreen {
    max-width: 95vw;
    max-height: 95vh;
    margin: var(--space-lg);
}

/* Modal variants */
.modal.modal-primary .modal-header {
    background: var(--primary-light);
    border-bottom-color: var(--primary);
}

.modal.modal-success .modal-header {
    background: var(--success-light);
    border-bottom-color: var(--success);
}

.modal.modal-warning .modal-header {
    background: var(--warning-light);
    border-bottom-color: var(--warning);
}

.modal.modal-error .modal-header {
    background: var(--error-light);
    border-bottom-color: var(--error);
}

/* Confirmation modal */
.confirmation-modal .modal-body {
    text-align: center;
    padding: var(--space-xxl);
}

.confirmation-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-lg);
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-2xl);
}

.confirmation-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.confirmation-icon.error {
    background: var(--error-light);
    color: var(--error);
}

.confirmation-icon.success {
    background: var(--success-light);
    color: var(--success);
}

.confirmation-title {
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.confirmation-message {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
    line-height: var(--line-height-normal);
    margin-bottom: var(--space-xl);
}

/* Loading modal */
.loading-modal .modal-body {
    text-align: center;
    padding: var(--space-xxl);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto var(--space-lg);
    border: 4px solid var(--border-light);
    border-top-color: var(--primary);
    border-radius: var(--radius-round);
    animation: spin 1s linear infinite;
}

.loading-text {
    font-size: var(--font-size-base);
    color: var(--text-secondary);
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: var(--space-xl);
    right: var(--space-xl);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    max-width: 400px;
}

.toast {
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: flex-start;
    gap: var(--space-md);
    transform: translateX(100%);
    opacity: 0;
    transition: all var(--transition-bounce);
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast.hide {
    transform: translateX(100%);
    opacity: 0;
}

.toast-icon {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-round);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    flex-shrink: 0;
}

.toast.toast-success {
    border-left: 4px solid var(--success);
}

.toast.toast-success .toast-icon {
    background: var(--success-light);
    color: var(--success);
}

.toast.toast-warning {
    border-left: 4px solid var(--warning);
}

.toast.toast-warning .toast-icon {
    background: var(--warning-light);
    color: var(--warning);
}

.toast.toast-error {
    border-left: 4px solid var(--error);
}

.toast.toast-error .toast-icon {
    background: var(--error-light);
    color: var(--error);
}

.toast.toast-info {
    border-left: 4px solid var(--info);
}

.toast.toast-info .toast-icon {
    background: var(--info-light);
    color: var(--info);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.toast-message {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: var(--line-height-normal);
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
}

.toast-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-md);
    padding: var(--space-xs) var(--space-sm);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-medium);
    box-shadow: var(--shadow-md);
    z-index: var(--z-tooltip);
    white-space: nowrap;
    transform: translateY(-50%);
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    pointer-events: none;
}

.tooltip.show {
    opacity: 1;
    visibility: visible;
}

.tooltip::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.tooltip.top {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
}

.tooltip.top::before {
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 6px 6px 0 6px;
    border-color: var(--border-light) transparent transparent transparent;
}

.tooltip.bottom {
    top: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(8px);
}

.tooltip.bottom::before {
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 6px 6px 6px;
    border-color: transparent transparent var(--border-light) transparent;
}

.tooltip.left {
    right: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(-8px);
}

.tooltip.left::before {
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 0 6px 6px;
    border-color: transparent transparent transparent var(--border-light);
}

.tooltip.right {
    left: 100%;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
}

.tooltip.right::before {
    right: 100%;
    top: 50%;
    transform: translateY(-50%);
    border-width: 6px 6px 6px 0;
    border-color: transparent var(--border-light) transparent transparent;
}

/* Popover */
.popover {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-popover);
    max-width: 300px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: all var(--transition-bounce);
}

.popover.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

.popover-header {
    padding: var(--space-md) var(--space-lg) var(--space-sm);
    border-bottom: 1px solid var(--border-light);
}

.popover-title {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--text-primary);
    margin: 0;
}

.popover-body {
    padding: var(--space-md) var(--space-lg);
}

.popover-body p {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    line-height: var(--line-height-normal);
    margin: 0;
}

/* Dropdown menu */
.dropdown-menu {
    position: absolute;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-dropdown);
    min-width: 200px;
    max-height: 300px;
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: all var(--transition-fast);
}

.dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-decoration: none;
    cursor: pointer;
    transition: background-color var(--transition-fast);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.dropdown-item:hover {
    background: var(--bg-hover);
}

.dropdown-item:focus {
    background: var(--bg-hover);
    outline: none;
}

.dropdown-item.active {
    background: var(--primary-light);
    color: var(--primary);
}

.dropdown-item.disabled {
    color: var(--text-muted);
    cursor: not-allowed;
    pointer-events: none;
}

.dropdown-divider {
    height: 1px;
    background: var(--border-light);
    margin: var(--space-xs) 0;
}

.dropdown-header {
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-xs);
    font-weight: var(--font-weight-semibold);
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Context menu */
.context-menu {
    position: fixed;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-popover);
    min-width: 180px;
    opacity: 0;
    visibility: hidden;
    transform: scale(0.9);
    transition: all var(--transition-fast);
}

.context-menu.show {
    opacity: 1;
    visibility: visible;
    transform: scale(1);
}

/* Animations */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

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

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideOutRight {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .modal {
        max-width: 95vw;
        margin: var(--space-md);
    }
    
    .modal-header,
    .modal-body,
    .modal-footer {
        padding: var(--space-lg);
    }
    
    .toast-container {
        top: var(--space-md);
        right: var(--space-md);
        left: var(--space-md);
        max-width: none;
    }
    
    .tooltip {
        display: none;
    }
}

/* Form Sections */
.form-section {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.form-section-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-section-title::before {
    content: '';
    width: 4px;
    height: 1.1rem;
    background: var(--primary);
    border-radius: 2px;
}

/* Tags System */
.tags-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.predefined-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.tag-btn {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 20px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.15s ease;
}

.tag-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
    border-color: var(--primary);
}

.tag-btn.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.custom-tag-input {
    display: flex;
    align-items: end;
    gap: 0.5rem;
}

.custom-tag-input .md-text-field {
    flex: 1;
}

.selected-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    min-height: 2rem;
}

.selected-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.8rem;
    background: var(--primary-light, #e3f2fd);
    color: var(--primary-dark, #1565c0);
    border-radius: 16px;
    font-size: 0.85rem;
    border: 1px solid var(--primary-light, #e3f2fd);
}

.remove-tag {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    transition: background-color 0.15s ease;
}

.remove-tag:hover {
    background: rgba(0, 0, 0, 0.1);
}

.remove-tag .md-icon {
    font-size: 14px;
}