/**
 * DC Beauty - Styles pour le système de modales
 * @version 1.0.0
 */

/* ========================================
   CONTENEURS
   ======================================== */

#dc-modal-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    z-index: 9999;
    pointer-events: none;
}

#dc-toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

/* ========================================
   MODAL PRINCIPALE
   ======================================== */

.dc-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: all;
}

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

.dc-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.dc-modal-dialog {
    position: relative;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    transform: scale(0.9);
    transition: transform 0.3s ease;
    overflow: hidden;
    animation: modalSlideIn 0.3s ease;
}

.dc-modal.show .dc-modal-dialog {
    transform: scale(1);
}

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

/* ========================================
   MODAL HEADER
   ======================================== */

.dc-modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dc-modal-title {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
    color: #333;
}

.dc-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.dc-modal-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* ========================================
   MODAL BODY
   ======================================== */

.dc-modal-body {
    padding: 20px;
    max-height: 60vh;
    overflow-y: auto;
}

.dc-modal-body.text-center {
    text-align: center;
}

.dc-modal-message {
    margin: 0;
    color: #666;
    line-height: 1.6;
    font-size: 1rem;
}

.dc-modal-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.dc-modal-icon svg {
    width: 32px;
    height: 32px;
}

.dc-modal-icon-success {
    background: #e8f5e9;
    color: #4caf50;
}

.dc-modal-icon-error {
    background: #ffebee;
    color: #f44336;
}

.dc-modal-icon-warning {
    background: #fff3e0;
    color: #ff9800;
}

.dc-modal-icon-info {
    background: #e3f2fd;
    color: #2196f3;
}

.dc-modal-icon-question {
    background: #f3e5f5;
    color: #9c27b0;
}

/* ========================================
   MODAL FOOTER
   ======================================== */

.dc-modal-footer {
    padding: 15px 20px;
    border-top: 1px solid #e5e5e5;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.dc-modal-footer .btn {
    padding: 8px 20px;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 80px;
}

.dc-modal-footer .btn-primary {
    background: #333;
    color: white;
}

.dc-modal-footer .btn-primary:hover {
    background: #000;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.dc-modal-footer .btn-secondary {
    background: #f5f5f5;
    color: #666;
}

.dc-modal-footer .btn-secondary:hover {
    background: #e0e0e0;
    color: #333;
}

/* ========================================
   MODAL INPUT
   ======================================== */

.dc-modal-input-group {
    margin-top: 15px;
}

.dc-modal-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.dc-modal-input:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 3px rgba(51, 51, 51, 0.1);
}

.dc-modal-input.error {
    border-color: #f44336;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ========================================
   MODAL LOADING
   ======================================== */

.dc-modal-loading .dc-modal-dialog {
    max-width: 300px;
}

.dc-modal-loading .dc-modal-body {
    padding: 30px;
}

.dc-spinner {
    margin-bottom: 15px;
}

.spinner-border {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    vertical-align: text-bottom;
    border: 0.25em solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: spinner-border 0.75s linear infinite;
}

@keyframes spinner-border {
    to { transform: rotate(360deg); }
}

.text-primary {
    color: #333 !important;
}

/* ========================================
   TOASTS
   ======================================== */

.dc-toast {
    position: relative;
    min-width: 300px;
    max-width: 500px;
    padding: 16px;
    margin-bottom: 10px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateX(400px);
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: all;
}

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

.dc-toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.dc-toast-content {
    flex: 1;
}

.dc-toast-message {
    margin: 0;
    color: #333;
    font-size: 0.95rem;
    line-height: 1.4;
}

.dc-toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    font-size: 1.25rem;
    line-height: 1;
    color: #999;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.dc-toast-close:hover {
    background: #f5f5f5;
    color: #333;
}

/* Types de toasts */
.dc-toast-success {
    border-left: 4px solid #4caf50;
}

.dc-toast-success .dc-toast-icon {
    color: #4caf50;
}

.dc-toast-error {
    border-left: 4px solid #f44336;
}

.dc-toast-error .dc-toast-icon {
    color: #f44336;
}

.dc-toast-warning {
    border-left: 4px solid #ff9800;
}

.dc-toast-warning .dc-toast-icon {
    color: #ff9800;
}

.dc-toast-info {
    border-left: 4px solid #2196f3;
}

.dc-toast-info .dc-toast-icon {
    color: #2196f3;
}

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

@media (max-width: 576px) {
    .dc-modal-dialog {
        width: 95%;
        max-width: none;
        margin: 10px;
    }
    
    #dc-toast-container {
        left: 10px;
        right: 10px;
        top: 10px;
    }
    
    .dc-toast {
        min-width: auto;
        max-width: none;
        transform: translateY(-100px);
    }
    
    .dc-toast.show {
        transform: translateY(0);
    }
    
    .dc-modal-footer {
        flex-direction: column-reverse;
        gap: 8px;
    }
    
    .dc-modal-footer .btn {
        width: 100%;
    }
}

/* ========================================
   DARK MODE (optionnel)
   ======================================== */

@media (prefers-color-scheme: dark) {
    .dc-modal-dialog {
        background: #1e1e1e;
    }
    
    .dc-modal-header {
        border-bottom-color: #333;
    }
    
    .dc-modal-title {
        color: #fff;
    }
    
    .dc-modal-message {
        color: #ccc;
    }
    
    .dc-modal-footer {
        border-top-color: #333;
    }
    
    .dc-modal-close {
        color: #ccc;
    }
    
    .dc-modal-close:hover {
        background: #333;
        color: #fff;
    }
    
    .dc-modal-input {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .dc-modal-input:focus {
        border-color: #666;
    }
    
    .dc-toast {
        background: #2a2a2a;
    }
    
    .dc-toast-message {
        color: #fff;
    }
    
    .dc-toast-close {
        color: #ccc;
    }
    
    .dc-toast-close:hover {
        background: #444;
        color: #fff;
    }
}

/* ========================================
   COMPATIBILITÉ BOOTSTRAP
   ======================================== */

/* Si Bootstrap est présent, on s'assure que nos modales ont la priorité */
.dc-modal,
.dc-modal * {
    box-sizing: border-box;
}

.dc-modal .btn {
    display: inline-block;
    text-align: center;
    vertical-align: middle;
    user-select: none;
    line-height: 1.5;
}

/* Fix pour les scrollbars */
body.dc-modal-open {
    overflow: hidden;
    padding-right: 0 !important;
}
