/* ===========================
   PR4 - Compact File Card Styles
   Layout: Icon + Delete | File Info | Print Options (all on one line)
   =========================== */

.file-item {
    margin-bottom: 16px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Main compact card container */
.file-card-compact {
    display: flex;
    align-items: center;
    gap: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    border: 1px solid rgba(0,0,0,0.08);
    box-shadow: var(--shadow);
    transition: var(--transition);
    position: relative;
}

.file-card-compact:hover {
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

/* Loading card with progress bar */
.file-card-loading {
    background: linear-gradient(135deg, rgba(18, 96, 168, 0.05) 0%, rgba(18, 96, 168, 0.05) 100%);
    border-color: var(--primary-color);
}

.loading-content {
    display: flex;
    align-items: center;
    gap: 16px;
    width: 100%;
}

.loading-icon {
    width: 48px;
    height: 48px;
    background: rgba(18, 96, 168, 0.1);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    animation: pulse 2s ease-in-out infinite;
}

.loading-icon svg {
    width: 28px;
    height: 28px;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

.loading-info {
    flex: 1;
    min-width: 0;
}

.loading-file-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.loading-file-size {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 8px 0;
    font-weight: 500;
}

.loading-status {
    font-size: 13px;
    color: var(--primary-color);
    margin: 0 0 8px 0;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.08);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
    margin-bottom: 4px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-color) 100%);
    border-radius: 4px;
    transition: width 0.3s ease-out;
    box-shadow: 0 0 10px rgba(18, 96, 168, 0.5);
}

.loading-percentage {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary-color);
    margin: 0;
    text-align: right;
}

/* Bouton supprimer flottant en haut à droite */
.remove-btn-floating {
    position: absolute;
    top: -10px;
    right: -10px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid white;
    background: var(--error-color, #CC2936);
    color: white;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(204, 41, 54, 0.3);
}

.remove-btn-floating:hover {
    background: #a3212b;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(204, 41, 54, 0.5);
}

.remove-btn-floating svg {
    width: 20px;
    height: 20px;
}

/* LEFT SECTION: Thumbnail + Action Buttons */
.file-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.file-thumbnail {
    width: 80px;
    height: 100px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    background: #f3f4f6;
    border: 1px solid rgba(0,0,0,0.08);
    transition: var(--transition);
}

.file-thumbnail:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
    border-color: var(--primary-color);
}

.file-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Landscape document thumbnail - portrait A4 frame with red border + overflow */
.file-thumbnail.landscape {
    position: relative;
    overflow: visible;
    background: transparent;
    border-color: transparent;
}

/* Overflow zone - landscape content bleeds beyond portrait frame */
.file-thumbnail.landscape img {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: auto;
    height: 70%;
    max-width: none;
    object-fit: contain;
    opacity: 0.5;
    border-radius: 3px;
    filter: grayscale(0.4) brightness(0.85);
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

/* Portrait A4 frame - RED border to signal wrong orientation */
.file-thumbnail.landscape::before {
    content: '';
    position: absolute;
    inset: 0;
    background: white;
    border-radius: 6px;
    border: 2px solid var(--error-color, #CC2936);
    z-index: 1;
    box-shadow: 0 0 0 3px rgba(204, 41, 54, 0.12);
    background-image: var(--thumb-url);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}

/* Red rotation indicator badge */
.file-thumbnail.landscape::after {
    content: '\21BB';
    position: absolute;
    bottom: -6px;
    right: -6px;
    width: 18px;
    height: 18px;
    background: var(--error-color, #CC2936);
    color: white;
    border-radius: 50%;
    font-size: 11px;
    line-height: 18px;
    text-align: center;
    z-index: 3;
    border: 1.5px solid white;
    box-shadow: 0 1px 4px rgba(204, 41, 54, 0.4);
}

.file-thumbnail.landscape:hover {
    transform: scale(1.05);
    border-color: transparent;
}

.file-thumbnail.landscape:hover img {
    filter: grayscale(0) brightness(0.9);
    opacity: 0.7;
}

.file-thumbnail svg {
    width: 40px;
    height: 40px;
}

/* Action button Drive */
.action-btn-compact {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.action-btn-compact svg {
    width: 16px;
    height: 16px;
}

.drive-btn-compact {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.drive-btn-compact:hover {
    background: #10b981;
    color: white;
    transform: scale(1.05);
}

/* CENTER SECTION: File Info */
.file-center {
    flex: 1;
    min-width: 0;
}

.file-name-compact {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.3;
}

.file-details-compact {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* RIGHT SECTION: Print Options */
.file-right {
    display: flex;
    align-items: center;
    gap: 24px;
    flex-shrink: 0;
}

.option-compact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.option-compact .option-label-text,
.option-compact > label:first-child {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.option-label-text {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* Number Input for Copies */
.number-input-compact {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(18, 96, 168, 0.08);
    padding: 4px;
    border-radius: 8px;
}

.number-btn-compact {
    width: 28px;
    height: 28px;
    border: none;
    background: white;
    color: var(--primary-color);
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    border-radius: 6px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-btn-compact:hover {
    background: var(--primary-color);
    color: white;
}

.number-input-compact input {
    width: 40px;
    height: 28px;
    text-align: center;
    border: none;
    background: white;
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    border-radius: 6px;
}

.number-input-compact input::-webkit-inner-spin-button,
.number-input-compact input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* Format Select Dropdown */
.format-select-compact {
    height: 28px;
    padding: 0 8px;
    border: 1px solid rgba(18, 96, 168, 0.3);
    border-radius: 8px;
    background: rgba(18, 96, 168, 0.08);
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    font-family: 'Calibri', Arial, sans-serif;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%231260A8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 22px;
}

.format-select-compact:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(18, 96, 168, 0.15);
}

/* Toggle Switch for Duplex and Color */
.toggle-switch-compact {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 22px;
}

.toggle-switch-compact input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider-compact {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #e5e7eb;
    border-radius: 11px;
    transition: var(--transition);
}

.toggle-slider-compact:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    border-radius: 50%;
    transition: var(--transition);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.toggle-switch-compact input:checked + .toggle-slider-compact {
    background-color: var(--primary-color);
}

.toggle-switch-compact input:checked + .toggle-slider-compact:before {
    transform: translateX(18px);
}

/* Responsive - Stack vertically on mobile */
@media (max-width: 768px) {
    .file-item {
        margin-bottom: 12px;
    }

    .file-card-compact {
        display: grid;
        grid-template-columns: 62px 1fr;
        grid-template-rows: auto auto;
        gap: 10px 14px;
        padding: 16px;
        align-items: start;
        border-radius: 16px;
    }

    /* Miniature - colonne 1 */
    .file-left {
        grid-column: 1;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        gap: 0;
        align-items: flex-start;
    }

    .file-thumbnail {
        width: 62px;
        height: 78px;
        margin: 0;
        flex-shrink: 0;
        border-radius: 10px;
    }

    /* Zone de droite avec titre + details */
    .file-center {
        grid-column: 2;
        grid-row: 1;
        display: flex;
        flex-direction: column;
        gap: 2px;
        min-width: 0;
        justify-content: center;
    }

    .file-center .drive-btn-compact {
        width: 36px;
        height: 36px;
        border-radius: 8px;
        align-self: flex-start;
        margin-top: 4px;
    }

    .file-name-compact {
        font-size: 16px;
        font-weight: 600;
        margin: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.3;
    }

    .file-details-compact {
        font-size: 13px;
        margin: 0;
        color: var(--text-secondary);
    }

    /* Options d'impression - toute la largeur */
    .file-right {
        grid-column: 1 / -1;
        grid-row: 2;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        width: 100%;
        padding-top: 12px;
        border-top: 1px solid rgba(0,0,0,0.05);
    }

    .option-compact {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        background: rgba(0, 0, 0, 0.025);
        padding: 10px 12px;
        border-radius: 10px;
    }

    /* COPIES prend toute la largeur */
    .option-compact:first-child {
        grid-column: 1 / -1;
    }

    .option-label-text {
        font-size: 12px;
        text-align: left;
        font-weight: 700;
        letter-spacing: 0.8px;
    }

    .number-input-compact {
        margin: 0;
    }

    .number-btn-compact {
        width: 32px;
        height: 32px;
        font-size: 18px;
        border-radius: 8px;
    }

    .number-input-compact input {
        width: 36px;
        height: 32px;
        font-size: 16px;
        border-radius: 6px;
    }

    .toggle-switch-compact {
        margin: 0;
    }

    .remove-btn-floating {
        width: 36px;
        height: 36px;
        top: -8px;
        right: -8px;
    }

    .remove-btn-floating svg {
        width: 18px;
        height: 18px;
    }
}
