/**
 * 🔒 OCCULTATION PDF - Styles
 * ===========================
 * 
 * Interface pour l'occultation sécurisée de PDF
 * - Canvas interactif avec overlay
 * - Toolbar responsive
 * - Zones d'occultation visuelles
 * - Mode sombre compatible
 */

/* ========== LAYOUT PRINCIPAL ========== */
.fv-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ========== UPLOAD ZONE ========== */
.fv-upload-zone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-3xl);
    border: 3px dashed var(--border);
    border-radius: var(--radius-lg);
    background: var(--bg-secondary);
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 300px;
}

.fv-upload-zone:hover {
    border-color: var(--primary);
    background: var(--bg-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.fv-upload-zone--dragover {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: scale(1.02);
}

.fv-upload-zone__icon {
    font-size: 64px;
    color: var(--primary);
    margin-bottom: var(--space-md);
}

.fv-upload-zone__title {
    font-size: var(--font-xl);
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
    font-weight: 600;
}

.fv-upload-zone__text {
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
    text-align: center;
}

.fv-upload-zone__input {
    display: none;
}

/* ========== TOOLBAR ========== */
.fv-toolbar {
    display: grid;
    grid-template-columns: auto auto 1fr auto;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-xs) var(--space-md);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-md);
    position: sticky;
    top: 0;
    z-index: 100;
    transition: box-shadow 0.3s ease;
}

.fv-toolbar--scrolled {
    box-shadow: var(--shadow-lg);
}

.fv-toolbar__group {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.fv-toolbar__group:first-child {
    justify-content: flex-start;
}

.fv-toolbar__group:nth-child(2) {
    justify-content: flex-start;
}

.fv-toolbar__group:nth-child(3) {
    justify-content: flex-end;
    margin-left: auto;
}

.fv-toolbar__group:last-child {
    justify-content: flex-end;
    gap: var(--space-xs);
}

/* Styles spécifiques pour les boutons dans la toolbar */
.fv-toolbar__group .fv-btn {
    padding: 6px 10px;
    font-size: var(--font-xs);
    line-height: 1;
}

.fv-toolbar__group .fv-btn i {
    font-size: 16px;
}

/* Rendre les textes des boutons masquables sur petits écrans */
@media (max-width: 1200px) {
    .fv-toolbar__group .fv-btn span {
        display: none;
    }
    
    .fv-toolbar__group .fv-btn {
        padding: var(--space-xs);
        min-width: 40px;
        justify-content: center;
    }
}

.fv-toolbar__page-info {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    white-space: nowrap;
}

.fv-toolbar__page-input {
    width: 50px;
    padding: var(--space-xs);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    text-align: center;
    font-size: var(--font-xs);
    font-weight: 600;
}

.fv-toolbar__zoom-info {
    font-size: var(--font-xs);
    font-weight: 600;
    color: var(--text-primary);
    min-width: 50px;
    text-align: center;
    padding: var(--space-xs) var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

/* ========== STATISTIQUES ========== */
.fv-stats {
    display: flex;
    gap: var(--space-lg);
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
}

.fv-stat-item {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    color: var(--text-secondary);
    font-size: var(--font-sm);
}

.fv-stat-item i {
    color: var(--primary);
}

.fv-stat-item strong {
    color: var(--text-primary);
    font-size: var(--font-md);
}

/* ========== CANVAS CONTAINER ========== */
.fv-canvas-container {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-md);
    margin-bottom: var(--space-lg);
    overflow: visible;
    height: auto;
    min-height: 500px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.fv-canvas-container:hover {
    cursor: default; /* Curseur par défaut, sauf en mode dessin */
}

.fv-canvas {
    display: block;
    max-width: 100%;
    box-shadow: var(--shadow-lg);
    background: white;
}

.fv-redaction-overlay {
    position: absolute;
    top: 0;
    left: 0;
    pointer-events: none; /* activé via modificateur ci-dessous */
    z-index: 10;
}

.fv-redaction-overlay--interactive {
    pointer-events: all;
    cursor: crosshair;
}

/* ========== ZONES D'OCCULTATION ========== */
.fv-redaction-zone {
    position: absolute;
    background: #000000; /* Noir total pour conformité */
    border: none;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    pointer-events: all;
    user-select: none;
    -webkit-user-select: none;
    border-radius: 8px; /* Tous les coins arrondis */
}

.fv-redaction-zone:hover { box-shadow: 0 0 0 2px rgba(0,0,0,0.2) inset; }

.fv-redaction-zone__delete {
    position: absolute;
    top: -12px;
    right: -12px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #111111;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    z-index: 1001;
}

.fv-redaction-zone__delete:hover { background: #000000; transform: scale(1.05); }

.fv-redaction-zone__text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 12px; /* taille par défaut */
    font-weight: bold;
    pointer-events: none;
    text-shadow: none; /* Conformité: pas d'effets visibles excessifs */
    white-space: normal; /* autoriser le retour à la ligne */
    word-break: break-word; /* découpe si besoin */
    max-width: calc(100% - 8px); /* marge intérieure horizontale minimale */
    padding: 2px; /* marges minimales pour ne jamais coller les bords */
    line-height: 1.2;
    text-align: center; /* centrage du texte */
    text-transform: uppercase;
}

/* Tailles adaptatives via modificateurs - basées sur la zone */
.fv-redaction-zone--xs .fv-redaction-zone__text { font-size: 9px; }
.fv-redaction-zone--sm .fv-redaction-zone__text { font-size: 12px; }
.fv-redaction-zone--md .fv-redaction-zone__text { font-size: 16px; }
.fv-redaction-zone--lg .fv-redaction-zone__text { font-size: 20px; }
.fv-redaction-zone--xl .fv-redaction-zone__text { font-size: 24px; }

/* Rectangle temporaire en mode dessin */
.fv-redaction-temp {
    position: absolute;
    background: #000000;
    opacity: 1;
    pointer-events: none;
    z-index: 1000;
    border-radius: 8px; /* Tous les coins arrondis */
}

/* ========== LISTE DES OCCULTATIONS ========== */
.fv-redactions-list {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
}

.fv-redactions-list__title {
    font-size: var(--font-lg);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.fv-redactions-list__title i {
    color: var(--primary);
}

.fv-redactions-list__items {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.fv-redactions-list__empty {
    text-align: center;
    color: var(--text-secondary);
    font-style: italic;
    padding: var(--space-lg);
}

/* ========== PAGE GROUP ========== */
.fv-redactions-page-group {
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
}

.fv-redactions-page-group__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-sm);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.fv-redactions-page-group__header h4 {
    font-size: var(--font-md);
    color: var(--text-primary);
    margin: 0;
}

.fv-redactions-page-group__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

/* ========== REDACTION ITEM ========== */
.fv-redaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    transition: all 0.2s ease;
}

.fv-redaction-item:hover {
    background: var(--primary-light);
    transform: translateX(4px);
}

.fv-redaction-item__info {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
}

.fv-redaction-item__number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    font-size: var(--font-xs);
    font-weight: bold;
}

.fv-redaction-item__details {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.fv-redaction-item__coords,
.fv-redaction-item__size {
    font-size: var(--font-xs);
    color: var(--text-secondary);
}

.fv-redaction-item__actions {
    display: flex;
    gap: var(--space-xs);
}

/* ========== BOUTONS ========== */
.fv-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: var(--space-sm) var(--space-md);
    border: none;
    border-radius: var(--radius-md);
    font-size: var(--font-sm);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    line-height: 1;
}

.fv-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.fv-btn:active:not(:disabled) {
    transform: scale(0.98);
}

.fv-btn i {
    font-size: 20px;
    line-height: 1;
}

.fv-btn--primary {
    background: var(--primary);
    color: white;
}

.fv-btn--primary:hover:not(:disabled) {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.fv-btn--secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.fv-btn--secondary:hover:not(:disabled) {
    background: var(--bg-primary);
    border-color: var(--primary);
    color: var(--primary);
}

.fv-btn--success {
    background: #4caf50;
    color: white;
}

.fv-btn--success:hover:not(:disabled) {
    background: #45a049;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.fv-btn--danger {
    background: #f44336;
    color: white;
}

.fv-btn--danger:hover:not(:disabled) {
    background: #d32f2f;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.fv-btn--sm {
    padding: var(--space-xs);
    font-size: var(--font-xs);
}

.fv-btn--sm i {
    font-size: 18px;
}

/* ========== ALERTS ========== */
.fv-alert {
    display: flex;
    gap: var(--space-md);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-lg);
    border-left: 4px solid;
}

.fv-alert i {
    font-size: 24px;
    flex-shrink: 0;
}

.fv-alert--warning {
    background: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.fv-alert--warning i {
    color: #ffc107;
}

.fv-alert__content {
    flex: 1;
}

.fv-alert__title {
    font-size: var(--font-md);
    font-weight: 600;
    margin-bottom: var(--space-sm);
}

.fv-alert__list {
    margin: 0;
    padding-left: var(--space-md);
}

.fv-alert__list li {
    margin-bottom: var(--space-xs);
}

.fv-alert__list li:last-child {
    margin-bottom: 0;
}

/* ========== CARD ========== */
.fv-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.fv-card--info {
    background: var(--primary-light);
    border-color: var(--primary);
}

.fv-card__title {
    font-size: var(--font-lg);
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.fv-card__title i {
    color: var(--primary);
}

/* ========== INSTRUCTIONS ========== */
.fv-instructions-list {
    list-style: none;
    counter-reset: instructions;
    padding: 0;
    margin: 0;
}

.fv-instructions-list__item {
    counter-increment: instructions;
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    position: relative;
    padding-left: calc(var(--space-lg) + 32px);
}

.fv-instructions-list__item::before {
    content: counter(instructions);
    position: absolute;
    left: var(--space-md);
    top: var(--space-md);
    width: 32px;
    height: 32px;
    background: var(--primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: var(--font-md);
}

.fv-instructions-list__item strong {
    color: var(--primary);
}

/* ========== COMPARISON ========== */
.fv-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-md);
}

.fv-comparison__item {
    padding: var(--space-md);
    border-radius: var(--radius-md);
    border: 2px solid;
}

.fv-comparison__item--bad {
    background: #ffebee;
    border-color: #f44336;
}

.fv-comparison__item--good {
    background: #e8f5e9;
    border-color: #4caf50;
}

.fv-comparison__item h4 {
    margin-bottom: var(--space-sm);
    font-size: var(--font-md);
}

.fv-comparison__item ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.fv-comparison__item li {
    padding: var(--space-xs) 0;
    padding-left: var(--space-md);
    position: relative;
}

.fv-comparison__item li::before {
    content: "•";
    position: absolute;
    left: 0;
    font-weight: bold;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 768px) {
    .fv-toolbar {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto auto auto;
        gap: var(--space-xs);
        padding: var(--space-sm);
    }

    .fv-toolbar__group {
        justify-content: center !important;
    }

    .fv-stats {
        flex-direction: column;
    }

    .fv-canvas-container {
        padding: var(--space-sm);
        min-height: 400px;
    }

    .fv-comparison {
        grid-template-columns: 1fr;
    }
}

/* ========== ANIMATIONS ========== */
@keyframes fv-highlight {
    0% {
        background: var(--bg-secondary);
    }
    50% {
        background: var(--primary-light);
    }
    100% {
        background: var(--bg-secondary);
    }
}

/* ========== DARK MODE ========== */
[data-theme="dark"] .fv-canvas {
    background: #2d2d2d;
}

[data-theme="dark"] .fv-redaction-zone {
    border-color: #ff6b6b;
}

[data-theme="dark"] .fv-alert--warning {
    background: #664d03;
    color: #ffecb5;
}

[data-theme="dark"] .fv-toolbar {
    background: var(--bg-primary);
    border-color: var(--border);
}

[data-theme="dark"] .fv-toolbar--scrolled {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}

