/* ============================================================
   COMPONENTS — Empty state, Filters bar, Confirm modal, Buttons
   ============================================================ */

/* ============================================================
   1. EMPTY STATE
   ============================================================ */
.empty-state-card {
    text-align: center;
    padding: 3rem 1.5rem;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.8);
    border-radius: 24px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.02);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 2.25rem;
    margin: 0 auto 1.25rem;
}

.empty-state-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main, #1e293b);
}

.empty-state-message {
    margin: 0 0 1.25rem;
    color: var(--text-secondary, #64748b);
    font-size: 0.95rem;
    line-height: 1.5;
}

@media (max-width: 640px) {
    .empty-state-card {
        padding: 2rem 1rem;
        border-radius: 18px;
    }
    .empty-state-icon {
        width: 64px;
        height: 64px;
        font-size: 1.75rem;
        margin-bottom: 0.85rem;
    }
    .empty-state-title { font-size: 1.05rem; }
    .empty-state-message { font-size: 0.88rem; }
}

/* ============================================================
   2. FILTERS BAR (partial filters_bar.php)
   ============================================================ */
.filters-bar {
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
}

.filters-bar .filters-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    align-items: end;
}

.filters-bar .filter-field {
    display: flex;
    flex-direction: column;
}

.filters-bar .filter-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.4rem;
}

.filters-bar .filter-input {
    width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1.5px solid rgba(203, 213, 225, 0.7);
    border-radius: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-main, #0f172a);
    background: rgba(255, 255, 255, 0.85);
    transition: border-color 0.18s, box-shadow 0.18s;
}

.filters-bar .filter-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.filters-bar .filter-input-wrap {
    position: relative;
}

.filters-bar .filter-input-icon {
    position: absolute;
    left: 0.7rem;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    pointer-events: none;
}

.filters-bar .filter-input.with-icon {
    padding-left: 2.25rem;
}

.filters-bar .filter-actions {
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.filters-bar .filter-actions .btn {
    height: 100%;
}

@media (max-width: 640px) {
    .filters-bar {
        padding: 1rem;
    }
    .filters-bar .filters-form {
        grid-template-columns: 1fr;
        gap: 0.75rem;
    }
    .filters-bar .filter-actions {
        flex-direction: row;
    }
    .filters-bar .filter-actions .btn {
        flex: 1;
    }
}

/* ============================================================
   3. CONFIRM MODAL
   ============================================================ */
.confirm-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.confirm-modal.is-open {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.confirm-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.confirm-modal-dialog {
    position: relative;
    background: white;
    border-radius: 24px;
    padding: 2rem 1.75rem 1.5rem;
    max-width: 460px;
    width: 100%;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.4);
    text-align: center;
    animation: modalSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.confirm-modal-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    margin: 0 auto 1rem;
}

.confirm-modal-title {
    margin: 0 0 0.5rem;
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-main, #0f172a);
    line-height: 1.3;
}

.confirm-modal-message {
    margin: 0 0 1.5rem;
    color: var(--text-secondary, #64748b);
    font-size: 0.95rem;
    line-height: 1.5;
}

.confirm-modal-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 1.25rem;
}

.confirm-modal-actions .btn {
    flex: 1;
    justify-content: center;
}

@media (max-width: 640px) {
    .confirm-modal {
        padding: 0.5rem;
    }
    .confirm-modal-dialog {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 20px;
    }
    .confirm-modal-icon {
        width: 52px;
        height: 52px;
        font-size: 1.5rem;
    }
    .confirm-modal-title { font-size: 1.1rem; }
    .confirm-modal-message { font-size: 0.88rem; }
    .confirm-modal-actions {
        flex-direction: column-reverse;
    }
}

/* ============================================================
   4. BUTTONS — système unifié .btn + modifiers
   ============================================================
   Coexiste avec les variantes existantes (.btn-premium, etc.)
   pour ne rien casser. Préférer .btn pour le nouveau code.
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    padding: 0.7rem 1.25rem;
    border: none;
    border-radius: 12px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    user-select: none;
    transition:
        transform 0.18s ease,
        background 0.18s ease,
        box-shadow 0.18s ease,
        color 0.18s ease,
        border-color 0.18s ease;
    white-space: nowrap;
}

.btn:active:not(:disabled) {
    transform: scale(0.97);
}

.btn:disabled,
.btn[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

.btn ion-icon {
    font-size: 1.1em;
    flex-shrink: 0;
}

/* Variantes */
.btn-primary {
    background: var(--primary, #10141a);
    color: white;
}
.btn-primary:hover {
    background: #1e293b;
    box-shadow: 0 6px 16px -4px rgba(16, 20, 26, 0.35);
}

.btn-secondary {
    background: #f1f5f9;
    color: var(--text-main, #1e293b);
}
.btn-secondary:hover {
    background: #e2e8f0;
}

.btn-success {
    background: #10b981;
    color: white;
}
.btn-success:hover {
    background: #059669;
    box-shadow: 0 6px 16px -4px rgba(16, 185, 129, 0.35);
}

.btn-danger {
    background: #ef4444;
    color: white;
}
.btn-danger:hover {
    background: #dc2626;
    box-shadow: 0 6px 16px -4px rgba(239, 68, 68, 0.35);
}

.btn-warning {
    background: #f59e0b;
    color: white;
}
.btn-warning:hover {
    background: #d97706;
}

.btn-ghost {
    background: transparent;
    color: var(--text-main, #1e293b);
    border: 1.5px solid var(--border-color, #e2e8f0);
}
.btn-ghost:hover {
    background: var(--bg-light, #f8fafc);
    border-color: var(--text-secondary, #64748b);
}

/* Tailles */
.btn-sm {
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    border-radius: 9px;
}

.btn-lg {
    padding: 0.95rem 1.75rem;
    font-size: 1rem;
    border-radius: 14px;
}

.btn-block {
    width: 100%;
}

/* État loading (utilisé par main.js) */
.btn.is-loading {
    pointer-events: none;
    opacity: 0.85;
    position: relative;
    color: transparent !important;
}

.btn.is-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: btn-spin 0.7s linear infinite;
    color: white;
}

@keyframes btn-spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   5. PHOTO UPLOAD — boutons Caméra / Galerie + preview
   ============================================================ */
.photo-upload-group {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}

.photo-btn {
    flex: 1 1 calc(50% - 0.3rem);
    min-width: 140px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 2px dashed transparent;
    line-height: 1.2;
}

.photo-btn ion-icon {
    font-size: 1.25rem;
    flex-shrink: 0;
}

.photo-btn-camera {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 12px -3px rgba(59, 130, 246, 0.4);
}

.photo-btn-camera:hover {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px -3px rgba(59, 130, 246, 0.5);
}

.photo-btn-gallery {
    background: white;
    color: #475569;
    border: 2px dashed #cbd5e1;
}

.photo-btn-gallery:hover {
    background: #f8fafc;
    border-color: #94a3b8;
    color: #1e293b;
}

.photo-btn:active {
    transform: scale(0.97);
}

.photo-preview {
    width: 100%;
    margin-top: 0.85rem;
    padding: 0.85rem;
    background: rgba(248, 250, 252, 0.85);
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.photo-preview img {
    width: 64px;
    height: 64px;
    object-fit: cover;
    border-radius: 10px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

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

.photo-preview .preview-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: #0f172a;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.photo-preview .preview-size {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 0.15rem;
}

.photo-preview .preview-clear {
    background: none;
    border: none;
    cursor: pointer;
    color: #ef4444;
    font-size: 1.5rem;
    padding: 0.3rem;
    flex-shrink: 0;
}

.photo-preview .preview-clear:hover {
    color: #dc2626;
}

@media (max-width: 480px) {
    .photo-btn {
        flex: 1 1 100%;
        padding: 0.95rem 1rem;
        font-size: 0.9rem;
    }
}
