/**
 * Catalyst Framework CSS
 * Styles for toasts, modals, and UI components
 */

/* ===== TOAST NOTIFICATIONS ===== */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    pointer-events: none;
}

.catalyst-toast {
    margin-bottom: 10px;
    min-width: 320px;
    max-width: 420px;
    pointer-events: auto;
    opacity: 0;
    transform: translateX(100%);
    animation: catalyst-toast-slide-in 0.3s ease-out forwards;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    border: 1px solid;
    background: white !important;
}

.catalyst-toast.removing {
    animation: catalyst-toast-slide-out 0.3s ease-in forwards;
}

/* Couleurs Bootstrap pour les toasts */
.catalyst-toast.bg-success {
    background: #d1edff !important;
    border-color: #b3d7ff;
    color: #155724 !important;
}

.catalyst-toast.bg-danger {
    background: #f8d7da !important;
    border-color: #f1aeb5;
    color: #721c24 !important;
}

.catalyst-toast.bg-warning {
    background: #fff3cd !important;
    border-color: #ffeaa7;
    color: #856404 !important;
}

.catalyst-toast.bg-info {
    background: #d1ecf1 !important;
    border-color: #bee5eb;
    color: #0c5460 !important;
}

/* Structure du toast */
.catalyst-toast .d-flex {
    align-items: flex-start;
    gap: 8px;
    padding: 0;
}

.catalyst-toast-icon {
    padding: 12px 0 12px 16px;
    font-size: 20px;
    line-height: 1;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}

.catalyst-toast .toast-body {
    padding: 12px 8px 12px 0;
    font-weight: 500;
    font-size: 14px;
    flex: 1;
    line-height: 1.4;
}

.catalyst-toast-close {
    background: none;
    border: none;
    color: inherit;
    font-size: 18px;
    font-weight: bold;
    padding: 8px 16px 8px 8px;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    flex-shrink: 0;
    line-height: 1;
    margin-left: auto;
}

.catalyst-toast-close:hover {
    opacity: 1;
}

/* Toast animations - identiques */
@keyframes catalyst-toast-slide-in {
    from {
        opacity: 0;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes catalyst-toast-slide-out {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(100%);
    }
}

/* ===== MODAL DIALOGS ===== */

.catalyst-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    animation: catalyst-modal-fade-in 0.2s ease-out forwards;
}

.catalyst-modal.removing {
    animation: catalyst-modal-fade-out 0.2s ease-in forwards;
}

.catalyst-modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow: hidden;
    transform: scale(0.9);
    animation: catalyst-modal-scale-in 0.2s ease-out forwards;
}

.catalyst-modal.removing .catalyst-modal-content {
    animation: catalyst-modal-scale-out 0.2s ease-in forwards;
}

.catalyst-modal-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid #e9ecef;
    background: #f8f9fa;
}

.catalyst-modal-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #212529;
}

.catalyst-modal-body {
    padding: 20px 24px;
    color: #495057;
    line-height: 1.5;
}

.catalyst-modal-footer {
    padding: 16px 24px 20px;
    border-top: 1px solid #e9ecef;
    background: #f8f9fa;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* Modal animations */
@keyframes catalyst-modal-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes catalyst-modal-fade-out {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes catalyst-modal-scale-in {
    from { transform: scale(0.9); }
    to { transform: scale(1); }
}

@keyframes catalyst-modal-scale-out {
    from { transform: scale(1); }
    to { transform: scale(0.9); }
}

/* ===== CHOICE DIALOG ===== */

.catalyst-choice-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 16px;
}

.catalyst-choice-option {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    background: white;
    color: #495057;
    text-align: left;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.catalyst-choice-option:hover {
    background: #f8f9fa;
    border-color: #007bff;
    color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.15);
}

.catalyst-choice-option.danger {
    border-color: #dc3545;
    color: #dc3545;
}

.catalyst-choice-option.danger:hover {
    background: #f8d7da;
    border-color: #dc3545;
    color: #721c24;
}

/* ===== PROMPT INPUT ===== */

.catalyst-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ced4da;
    border-radius: 6px;
    font-size: 14px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    margin-top: 12px;
}

.catalyst-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
    .toast-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }
    
    .catalyst-toast {
        min-width: auto;
        max-width: none;
        transform: translateY(-100%);
        animation: catalyst-toast-slide-down 0.3s ease-out forwards;
    }
    
    .catalyst-toast.removing {
        animation: catalyst-toast-slide-up 0.3s ease-in forwards;
    }
    
    .catalyst-modal-content {
        margin: 20px;
        width: calc(100% - 40px);
    }
    
    .catalyst-modal-header,
    .catalyst-modal-body,
    .catalyst-modal-footer {
        padding-left: 20px;
        padding-right: 20px;
    }
}

@keyframes catalyst-toast-slide-down {
    from {
        opacity: 0;
        transform: translateY(-100%);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes catalyst-toast-slide-up {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-100%);
    }
}

/* ===== DARK MODE SUPPORT ===== */

@media (prefers-color-scheme: dark) {
    .catalyst-modal-content {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .catalyst-modal-header,
    .catalyst-modal-footer {
        background: #1a202c;
        border-color: #4a5568;
    }
    
    .catalyst-modal-title {
        color: #e2e8f0;
    }
    
    .catalyst-choice-option {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .catalyst-choice-option:hover {
        background: #4a5568;
        border-color: #63b3ed;
        color: #63b3ed;
    }
    
    .catalyst-input {
        background: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .catalyst-input:focus {
        border-color: #63b3ed;
        box-shadow: 0 0 0 2px rgba(99, 179, 237, 0.25);
    }
}

/* ===== ACCESSIBILITY ===== */

.catalyst-toast:focus,
.catalyst-modal:focus,
.catalyst-choice-option:focus,
.catalyst-input:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    .catalyst-toast,
    .catalyst-modal,
    .catalyst-modal-content,
    .catalyst-choice-option {
        animation: none !important;
        transition: none !important;
    }
    
    .catalyst-toast {
        opacity: 1;
        transform: none;
    }
    
    .catalyst-modal-content {
        transform: none;
    }
}