/* ============================================
   Forminator Webcam Upload - Styles
   ============================================ */

/* Bouton déclencheur injecté dans le formulaire */
.fwc-trigger-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 18px;
    background-color: #2271b1;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.2s ease;
}
.fwc-trigger-btn:hover {
    background-color: #135e96;
}
.fwc-trigger-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
}

/* Preview miniature sous le champ upload */
.fwc-preview-thumb {
    margin-top: 12px;
    display: none;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}
.fwc-preview-thumb.active {
    display: flex;
}
.fwc-preview-thumb img {
    max-width: 180px;
    border-radius: 6px;
    border: 2px solid #2271b1;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.fwc-preview-label {
    font-size: 12px;
    color: #555;
}
.fwc-preview-remove {
    font-size: 12px;
    color: #cc1818;
    cursor: pointer;
    text-decoration: underline;
    background: none;
    border: none;
    padding: 0;
}

/* ============================================
   Modale / Overlay
   ============================================ */
.fwc-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
.fwc-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.fwc-modal {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    padding: 24px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.35);
    position: relative;
    transform: scale(0.95);
    transition: transform 0.25s ease;
}
.fwc-overlay.active .fwc-modal {
    transform: scale(1);
}

.fwc-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.fwc-modal-title {
    font-size: 17px;
    font-weight: 600;
    color: #1d2327;
    margin: 0;
}
.fwc-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #777;
    font-size: 22px;
    line-height: 1;
    padding: 4px;
    transition: color 0.2s;
}
.fwc-close-btn:hover { color: #cc1818; }

/* Zone vidéo / canvas */
.fwc-video-wrap {
    position: relative;
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    aspect-ratio: 4/3;
}
.fwc-video,
.fwc-canvas {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}
.fwc-canvas {
    display: none;
    position: absolute;
    inset: 0;
}

/* Sélecteur de caméra (mobile : avant / arrière) */
.fwc-camera-select-wrap {
    margin-top: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.fwc-camera-select-wrap label {
    font-size: 13px;
    color: #555;
    white-space: nowrap;
}
.fwc-camera-select {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
}

/* Boutons d'action */
.fwc-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
    flex-wrap: wrap;
}
.fwc-btn {
    flex: 1;
    padding: 11px 16px;
    border: none;
    border-radius: 7px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    min-width: 120px;
}
.fwc-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}
.fwc-btn-capture {
    background: #2271b1;
    color: #fff;
}
.fwc-btn-capture:hover:not(:disabled) { background: #135e96; }

.fwc-btn-retake {
    background: #f0f0f0;
    color: #333;
    display: none;
}
.fwc-btn-retake:hover:not(:disabled) { background: #ddd; }

.fwc-btn-use {
    background: #1a8a34;
    color: #fff;
    display: none;
}
.fwc-btn-use:hover:not(:disabled) { background: #136828; }

/* Message d'erreur */
.fwc-error-msg {
    display: none;
    margin-top: 12px;
    padding: 10px 14px;
    background: #fdecea;
    border-left: 4px solid #cc1818;
    border-radius: 4px;
    font-size: 13px;
    color: #7a0000;
}
.fwc-error-msg.visible { display: block; }

/* Message succès */
.fwc-success-msg {
    display: none;
    margin-top: 12px;
    padding: 10px 14px;
    background: #eafaf1;
    border-left: 4px solid #1a8a34;
    border-radius: 4px;
    font-size: 13px;
    color: #0a4720;
}
.fwc-success-msg.visible { display: block; }

/* Loader spinner */
.fwc-loader {
    display: none;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255,255,255,0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: fwc-spin 0.7s linear infinite;
    margin: 0 auto;
}
.fwc-loader.visible { display: inline-block; }
@keyframes fwc-spin {
    to { transform: rotate(360deg); }
}

/* Responsive mobile */
@media (max-width: 480px) {
    .fwc-modal { padding: 16px; }
    .fwc-btn { padding: 10px 10px; font-size: 13px; }
}
