/**
 * components.css - Composants réutilisables UI
 * GAL - Groupement des Artisans de Lubumbashi
 */

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    font-family: var(--font-heading);
    font-size: var(--text-base);
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all var(--transition-base);
    border: 2px solid transparent;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.btn:hover::before {
    width: 300px;
    height: 300px;
}

.btn:focus-visible {
    outline: 3px solid var(--color-primary);
    outline-offset: 3px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Button variants */
.btn--primary {
    background: var(--color-primary);
    color: var(--color-text-light);
    box-shadow: var(--shadow-md);
}

.btn--primary:hover {
    background: var(--color-primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn--secondary {
    background: var(--color-secondary);
    color: var(--color-primary);
    border-color: var(--color-primary);
    box-shadow: var(--shadow-sm);
}

.btn--secondary:hover {
    background: var(--color-primary);
    color: var(--color-text-light);
}

.btn--ghost {
    background: transparent;
    color: var(--color-primary);
    border-color: currentColor;
}

.btn--ghost:hover {
    background: var(--color-primary);
    color: var(--color-text-light);
}

.btn--whatsapp {
    background: #25D366;
    color: var(--color-text-light);
}

.btn--whatsapp:hover {
    background: #128C7E;
}

/* Button sizes */
.btn--sm {
    padding: var(--space-2) var(--space-4);
    font-size: var(--text-sm);
}

.btn--lg {
    padding: var(--space-4) var(--space-8);
    font-size: var(--text-lg);
}

.btn--block {
    width: 100%;
}

/* ===== CARDS ===== */
.card {
    background: var(--color-bg-alt);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: all var(--transition-base);
    box-shadow: var(--shadow-md);
    height: 100%;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-xl);
}

.card__image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    transition: transform var(--transition-slow);
}

.card:hover .card__image {
    transform: scale(1.05);
}

.card__image-container {
    position: relative;
    overflow: hidden;
    background: var(--color-muted-light);
}

.card__badge {
    position: absolute;
    top: var(--space-3);
    right: var(--space-3);
}

.card__content {
    padding: var(--space-6);
    flex: 1;
    display: flex;
    flex-direction: column;
}

.card__title {
    font-size: var(--text-xl);
    font-weight: 600;
    margin-bottom: var(--space-3);
    color: var(--color-text);
    font-family: var(--font-heading);
}

.card__description {
    color: var(--color-muted);
    margin-bottom: var(--space-4);
    flex: 1;
    line-height: 1.6;
}

.card__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.card__meta {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    color: var(--color-muted);
    font-size: var(--text-sm);
}

/* ===== GRID ===== */
.grid {
    display: grid;
    gap: var(--space-6);
}

.grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

.grid--4 {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* ===== FORMS ===== */
.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: var(--space-3) var(--space-4);
    font-size: var(--text-base);
    color: var(--color-text);
    background: var(--color-bg-alt);
    border: 2px solid var(--color-muted-light);
    border-radius: 12px;
    transition: all var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}

/* ===== SPINNER ===== */
.spinner {
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

.spinner--lg {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
        box-shadow: var(--shadow-md);
    }

    .btn--primary:hover {
        background: var(--color-primary-dark);
        transform: translateY(-2px);
        box-shadow: var(--shadow-lg);
    }

    .btn--secondary {
        background: var(--color-secondary);
        color: var(--color-primary);
        border-color: var(--color-primary);
        box-shadow: var(--shadow-sm);
    }

    .btn--secondary:hover {
        background: var(--color-primary);
        color: var(--color-text-light);
    }

    .btn--ghost {
        background: transparent;
        color: var(--color-primary);
        border-color: currentColor;
    }

    .btn--ghost:hover {
        background: var(--color-primary);
        color: var(--color-text-light);
    }

    .btn--whatsapp {
        background: #25D366;
        color: var(--color-text-light);
    }

    .btn--whatsapp:hover {
        background: #128C7E;
    }

    /* Button sizes */
    .btn--sm {
        padding: var(--space-2) var(--space-4);
        font-size: var(--text-sm);
    }

    .btn--lg {
        padding: var(--space-4) var(--space-8);
        font-size: var(--text-lg);
    }

    .btn--block {
        width: 100%;
    }

    /* ===== CARDS ===== */
    .card {
        background: var(--color-bg-alt);
        border-radius: var(--radius-xl);
        overflow: hidden;
        transition: all var(--transition-base);
        box-shadow: var(--shadow-md);
        height: 100%;
        display: flex;
        flex-direction: column;
    }

    .card:hover {
        transform: translateY(-5px);
        box-shadow: var(--shadow-xl);
    }

    .card__image {
        width: 100%;
        height: 200px;
        object-fit: cover;
        transition: transform var(--transition-slow);
    }

    .card:hover .card__image {
        transform: scale(1.05);
    }

    .card__image-container {
        position: relative;
        overflow: hidden;
        background: var(--color-muted-light);
    }

    .card__badge {
        position: absolute;
        top: var(--space-3);
        right: var(--space-3);
    }

    .card__content {
        padding: var(--space-6);
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .card__title {
        font-size: var(--text-xl);
        font-weight: 600;
        margin-bottom: var(--space-3);
        color: var(--color-text);
        font-family: var(--font-heading);
    }

    .card__description {
        color: var(--color-muted);
        margin-bottom: var(--space-4);
        flex: 1;
        line-height: 1.6;
    }

    .card__footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        padding-top: var(--space-4);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    .card__meta {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        color: var(--color-muted);
        font-size: var(--text-sm);
    }

    /* ===== GRID ===== */
    .grid {
        display: grid;
        gap: var(--space-6);
    }

    .grid--2 {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .grid--3 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .grid--4 {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    /* ===== FORMS ===== */
    .form-input,
    .form-textarea,
    .form-select {
        width: 100%;
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-base);
        color: var(--color-text);
        background: var(--color-bg-alt);
        border: 2px solid var(--color-muted-light);
        border-radius: 12px;
        transition: all var(--transition-fast);
    }

    .form-input:focus,
    .form-textarea:focus,
    .form-select:focus {
        outline: none;
        border-color: var(--color-primary);
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    }

    /* ===== SPINNER ===== */
    .spinner {
        border: 3px solid rgba(0, 0, 0, 0.1);
        border-top-color: var(--color-primary);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        animation: spin 1s linear infinite;
        margin: 0 auto;
    }

    .spinner--lg {
        width: 60px;
        height: 60px;
        border-width: 4px;
    }

    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    /* ===== BUTTON BORDER-RADIUS OVERRIDE ===== */
    /* Override pour tous les boutons dans l'espace public - 12px border-radius */
    button:not(.rounded-full):not(.rounded-none),
    button.rounded-lg,
    a.rounded-lg {
        border-radius: 12px !important;
    }

    /* ===== MODAL ===== */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: var(--z-modal);
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }

    .modal--active {
        opacity: 1;
        visibility: visible;
    }

    .modal__overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        /* Fond plus sombre */
        backdrop-filter: blur(4px);
    }

    .modal__container {
        position: relative;
        background: var(--color-bg-alt);
        /* Fond blanc/clair */
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-2xl);
        width: 90%;
        max-width: 600px;
        max-height: 90vh;
        overflow-y: auto;
        z-index: 1;
        padding: var(--space-6);
        transform: translateY(20px);
        transition: transform var(--transition-base);
        border: 1px solid rgba(0, 0, 0, 0.1);
        /* Légère bordure */
    }

    .modal--active .modal__container {
        transform: translateY(0);
    }

    .modal__close {
        position: absolute;
        top: var(--space-4);
        right: var(--space-4);
        background: transparent;
        border: none;
        font-size: var(--text-xl);
        color: var(--color-muted);
        cursor: pointer;
        transition: color var(--transition-fast);
        z-index: 10;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    .card__image-container {
        position: relative;
        overflow: hidden;
        background: var(--color-muted-light);
    }

    .card__badge {
        position: absolute;
        top: var(--space-3);
        right: var(--space-3);
    }

    .card__content {
        padding: var(--space-6);
        flex: 1;
        display: flex;
        flex-direction: column;
    }

    .card__title {
        font-size: var(--text-xl);
        font-weight: 600;
        margin-bottom: var(--space-3);
        color: var(--color-text);
        font-family: var(--font-heading);
    }

    .card__description {
        color: var(--color-muted);
        margin-bottom: var(--space-4);
        flex: 1;
        line-height: 1.6;
    }

    .card__footer {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: var(--space-3);
        padding-top: var(--space-4);
        border-top: 1px solid rgba(0, 0, 0, 0.05);
    }

    .card__meta {
        display: flex;
        align-items: center;
        gap: var(--space-2);
        color: var(--color-muted);
        font-size: var(--text-sm);
    }

    /* ===== GRID ===== */
    .grid {
        display: grid;
        gap: var(--space-6);
    }

    .grid--2 {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }

    .grid--3 {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .grid--4 {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }

    /* ===== FORMS ===== */
    .form-input,
    .form-textarea,
    .form-select {
        width: 100%;
        padding: var(--space-3) var(--space-4);
        font-size: var(--text-base);
        color: var(--color-text);
        background: var(--color-bg-alt);
        border: 2px solid var(--color-muted-light);
        border-radius: 12px;
        transition: all var(--transition-fast);
    }

    .form-input:focus,
    .form-textarea:focus,
    .form-select:focus {
        outline: none;
        border-color: var(--color-primary);
        box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
    }

    /* ===== SPINNER ===== */
    .spinner {
        border: 3px solid rgba(0, 0, 0, 0.1);
        border-top-color: var(--color-primary);
        border-radius: 50%;
        width: 40px;
        height: 40px;
        animation: spin 1s linear infinite;
        margin: 0 auto;
    }

    .spinner--lg {
        width: 60px;
        height: 60px;
        border-width: 4px;
    }

    @keyframes spin {
        to {
            transform: rotate(360deg);
        }
    }

    /* ===== BUTTON BORDER-RADIUS OVERRIDE ===== */
    /* Override pour tous les boutons dans l'espace public - 12px border-radius */
    button:not(.rounded-full):not(.rounded-none),
    button.rounded-lg,
    a.rounded-lg {
        border-radius: 12px !important;
    }

    /* ===== MODAL ===== */
    .modal {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        z-index: var(--z-modal);
        display: flex;
        align-items: center;
        justify-content: center;
        opacity: 0;
        visibility: hidden;
        transition: all var(--transition-base);
    }

    .modal--active {
        opacity: 1;
        visibility: visible;
    }

    .modal__overlay {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.7);
        /* Fond plus sombre */
        backdrop-filter: blur(4px);
    }

    .modal__container {
        position: relative;
        background: var(--color-bg-alt);
        /* Fond blanc/clair */
        border-radius: var(--radius-xl);
        box-shadow: var(--shadow-2xl);
        width: 90%;
        max-width: 600px;
        max-height: 90vh;
        overflow-y: auto;
        z-index: 1;
        padding: var(--space-6);
        transform: translateY(20px);
        transition: transform var(--transition-base);
        border: 1px solid rgba(0, 0, 0, 0.1);
        /* Légère bordure */
    }

    .modal--active .modal__container {
        transform: translateY(0);
    }

    .modal__close {
        position: absolute;
        top: var(--space-4);
        right: var(--space-4);
        background: transparent;
        border: none;
        font-size: var(--text-xl);
        color: var(--color-muted);
        cursor: pointer;
        transition: color var(--transition-fast);
        z-index: 10;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
    }

    .modal__close:hover {
        color: var(--color-error);
        background: rgba(0, 0, 0, 0.05);
    }

    .modal__content {
        position: relative;
        z-index: 2;
    }

    /* ===== TOAST NOTIFICATIONS ===== */
    .toast-container {
        position: fixed;
        top: 20px;
        right: 20px;
        z-index: 9999;
        display: flex;
        flex-direction: column;
        gap: 12px;
        max-width: 400px;
    }

    .toast {
        display: flex;
        align-items: center;
        gap: 12px;
        padding: 16px 20px;
        background: white;
        border-radius: 12px;
        box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
        border-left: 4px solid;
        animation: slideInRight 0.3s ease-out;
        min-width: 300px;
        transition: all 0.3s ease;
    }

    .toast:hover {
        transform: translateX(-5px);
        box-shadow: 0 15px 50px rgba(0, 0, 0, 0.2);
    }

    /* Toast variants avec couleurs */
    .toast--success {
        border-left-color: #10b981;
        /* Vert émeraude */
        background: linear-gradient(to right, #f0fdf4, #ffffff);
    }

    .toast--success .toast__icon {
        color: #10b981;
        background: #d1fae5;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 18px;
    }

    .toast--error {
        border-left-color: #ef4444;
        background: linear-gradient(to right, #fef2f2, #ffffff);
    }

    .toast--error .toast__icon {
        color: #ef4444;
        background: #fee2e2;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 18px;
    }

    .toast--warning {
        border-left-color: #f59e0b;
        background: linear-gradient(to right, #fffbeb, #ffffff);
    }

    .toast--warning .toast__icon {
        color: #f59e0b;
        background: #fef3c7;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 18px;
    }

    .toast--info {
        border-left-color: #3b82f6;
        background: linear-gradient(to right, #eff6ff, #ffffff);
    }

    .toast--info .toast__icon {
        color: #3b82f6;
        background: #dbeafe;
        border-radius: 50%;
        width: 32px;
        height: 32px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-weight: bold;
        font-size: 18px;
    }

    .toast__message {
        flex: 1;
        color: #1f2937;
        font-weight: 500;
        font-size: 14px;
        line-height: 1.5;
    }

    .toast__close {
        background: transparent;
        border: none;
        color: #9ca3af;
        font-size: 20px;
        cursor: pointer;
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 50%;
        transition: all 0.2s;
        padding: 0;
        flex-shrink: 0;
    }

    .toast__close:hover {
        background: #f3f4f6;
        color: #374151;
    }

    @keyframes slideInRight {
        from {
            transform: translateX(100%);
            opacity: 0;
        }

        to {
            transform: translateX(0);
            opacity: 1;
        }
    }

    /* Responsive toast */
    @media (max-width: 640px) {
        .toast-container {
            left: 10px;
            right: 10px;
            top: 10px;
            max-width: none;
        }

        .toast {
            min-width: auto;
            width: 100%;
        }
    }