/**
 * sc-style.css
 * 
 * Styles pour le plugin Service Cons Documents
 */

/* ─────────────────────────────────────────────────────────────────────────── */
/* Variables de couleur (adaptables selon le thème WooCommerce) */
/* ─────────────────────────────────────────────────────────────────────────── */

:root {
    --sc-primary: #534AB7;
    --sc-success: #1D9E75;
    --sc-danger: #DC3232;
    --sc-warning: #FAA83A;
    --sc-info: #2271B1;
    --sc-light: #F9F9F9;
    --sc-border: #DCDCDE;
    --sc-text: #23282D;
    --sc-text-muted: #646970;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Section documents au checkout */
/* ─────────────────────────────────────────────────────────────────────────── */

.sc-documents-section {
    margin: 24px 0;
}

.sc-documents-section h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--sc-text);
    margin: 0 0 16px;
    display: flex;
    align-items: center;
}

.sc-documents-section h3 span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    background: var(--sc-primary);
    color: #fff;
    border-radius: 50%;
    margin-right: 8px;
    font-size: 14px;
}

.sc-documents-section > p {
    font-size: 13px;
    color: var(--sc-text-muted);
    margin-bottom: 16px;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Liste des documents */
/* ─────────────────────────────────────────────────────────────────────────── */

.sc-documents-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sc-document-field {
    border: 1px solid var(--sc-border);
    border-radius: 4px;
    padding: 14px;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.sc-document-field:focus-within {
    border-color: var(--sc-primary);
    box-shadow: 0 0 0 3px rgba(83, 74, 183, 0.1);
}

.sc-document-field.sc-document-required {
    border-left: 3px solid var(--sc-danger);
}

.sc-document-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 10px;
    gap: 10px;
}

.sc-document-title {
    flex: 1;
}

.sc-document-title strong {
    display: block;
    margin-bottom: 4px;
    color: var(--sc-text);
    font-size: 14px;
}

.sc-document-services {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 6px;
}

.sc-service-badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(83, 74, 183, 0.1);
    color: #3C3489;
    font-weight: 500;
    white-space: nowrap;
}

.sc-level-badge {
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.sc-level-badge.sc-level-required {
    background: #FCEBEB;
    color: #791F1F;
}

.sc-level-badge.sc-level-optional {
    background: #FAEEDA;
    color: #633806;
}

.sc-level-badge.sc-level-recommended {
    background: #E1F5EE;
    color: #085041;
}

.sc-document-description {
    font-size: 12px;
    color: var(--sc-text-muted) !important;
    margin: 8px 0 0 !important;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Zone d'upload */
/* ─────────────────────────────────────────────────────────────────────────── */

.sc-upload-zone {
    margin-top: 10px;
}

.sc-file-input {
    display: none;
}

.sc-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 120px;
    border: 2px dashed var(--sc-border);
    border-radius: 4px;
    background: var(--sc-light);
    cursor: pointer;
    transition: all 0.2s ease;
    color: var(--sc-text-muted);
    text-align: center;
    padding: 20px;
    box-sizing: border-box;
}

.sc-upload-label:hover {
    border-color: var(--sc-info);
    background: #F0F6FC;
    color: var(--sc-info);
}

.sc-upload-label svg {
    width: 24px;
    height: 24px;
    margin-bottom: 8px;
    stroke-width: 1.5;
}

.sc-upload-label div {
    font-size: 13px;
    font-weight: 500;
}

.sc-upload-label div strong {
    font-weight: 600;
}

.sc-file-size-hint {
    font-size: 11px;
    color: #A0A0A0;
    margin-top: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Aperçu du fichier */
/* ─────────────────────────────────────────────────────────────────────────── */

.sc-file-preview {
    margin-top: 8px;
}

.sc-file-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #E1F5EE;
    border: 1px solid #1D9E75;
    border-radius: 4px;
    font-size: 12px;
    color: #085041;
}

.sc-file-item strong {
    flex: 1;
    word-break: break-word;
    font-weight: 600;
}

.sc-file-item span:last-of-type {
    flex-shrink: 0;
    opacity: 0.8;
}

.sc-file-remove {
    background: none;
    border: none;
    color: #1D9E75;
    cursor: pointer;
    font-size: 20px;
    padding: 0 4px;
    flex-shrink: 0;
    transition: color 0.2s;
}

.sc-file-remove:hover {
    color: #085041;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Message sécurité */
/* ─────────────────────────────────────────────────────────────────────────── */

.sc-documents-section > div:last-child {
    margin-top: 12px;
    padding: 10px 12px;
    background: #F0F6FC;
    border-left: 3px solid var(--sc-info);
    border-radius: 0 4px 4px 0;
    font-size: 12px;
    color: var(--sc-info);
}

.sc-documents-section > div:last-child::before {
    /* ✅ background-image plutôt que content: url() : ce dernier ignore
       width/height en dehors d'un contexte flex/grid sur certains
       navigateurs, ce qui fait déborder l'icône à sa taille native. */
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    background-image: url("images/icons-cadenas.png");
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    vertical-align: middle;
    margin-right: 4px;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Responsive — Mobile */
/* ─────────────────────────────────────────────────────────────────────────── */

@media (max-width: 768px) {
    .sc-document-header {
        flex-direction: column;
    }

    .sc-level-badge {
        align-self: flex-start;
    }

    .sc-upload-label {
        min-height: 100px;
        padding: 16px;
    }

    .sc-file-item {
        flex-wrap: wrap;
    }

    .sc-file-item strong {
        flex-basis: 100%;
        margin-bottom: 4px;
    }

    .sc-service-badge {
        font-size: 10px;
    }
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* Accessibilité — Focus visible */
/* ─────────────────────────────────────────────────────────────────────────── */

.sc-upload-label:focus-visible {
    outline: 2px solid var(--sc-primary);
    outline-offset: 2px;
}

.sc-file-remove:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────── */
/* État désactivé (champ obligatoire avec fichier) */
/* ─────────────────────────────────────────────────────────────────────────── */

.sc-upload-zone:has(.sc-file-item) .sc-upload-label {
    display: none;
}
