/**
 * app.css - Styles personnalisés pour l'application État des Lieux
 * Complète Bootstrap 5 avec des styles spécifiques mobile-first
 */

/* ============================================================================
   Variables
   ============================================================================ */
:root {
    --edl-primary: #2563eb;
    --edl-success: #16a34a;
    --edl-warning: #d97706;
    --edl-danger: #dc2626;
    --edl-border-radius: 0.75rem;
}

/* ============================================================================
   Général
   ============================================================================ */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

/* ============================================================================
   Cartes d'état des lieux
   ============================================================================ */
.edl-card {
    border-radius: var(--edl-border-radius);
    border: 1px solid #e5e7eb;
    transition: box-shadow 0.2s ease;
}

.edl-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Badges de statut */
.badge-brouillon { background-color: #9ca3af; }
.badge-en_cours { background-color: var(--edl-warning); }
.badge-signe_locataire { background-color: #2563eb; }
.badge-finalise { background-color: var(--edl-success); }

/* ============================================================================
   Formulaire pièces / éléments
   ============================================================================ */
.room-section {
    border: 2px solid #e5e7eb;
    border-radius: var(--edl-border-radius);
    padding: 1.25rem;
    margin-bottom: 1rem;
    background: white;
}

.room-section .room-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e5e7eb;
}

.room-section .room-header h5 {
    margin: 0;
    font-weight: 600;
}

.item-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.item-row .item-name {
    flex: 1;
    min-width: 120px;
}

.item-row .item-condition {
    flex: 0 0 160px;
}

@media (max-width: 576px) {
    .item-row {
        flex-direction: column;
        align-items: stretch;
    }
    .item-row .item-condition {
        flex: 1;
    }
}

/* ============================================================================
   Condition badges (dans les formulaires)
   ============================================================================ */
.condition-neuf { color: #059669; font-weight: 600; }
.condition-bon { color: #16a34a; }
.condition-usage_normal { color: #d97706; }
.condition-degrade { color: #ea580c; }
.condition-casse { color: #dc2626; font-weight: 600; }

/* ============================================================================
   Upload photos
   ============================================================================ */
.photo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.photo-card {
    position: relative;
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid #e5e7eb;
    aspect-ratio: 1;
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-card .photo-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(220, 38, 38, 0.9);
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
}

.photo-card .photo-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 0.75rem;
}

/* Zone d'upload drag & drop */
.upload-zone {
    border: 2px dashed #9ca3af;
    border-radius: var(--edl-border-radius);
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background-color 0.2s;
}

.upload-zone:hover,
.upload-zone.drag-over {
    border-color: var(--edl-primary);
    background-color: #eff6ff;
}

.upload-zone i {
    font-size: 2.5rem;
    color: #9ca3af;
}

/* ============================================================================
   Signature
   ============================================================================ */
.signature-wrapper {
    border: 2px solid #d1d5db;
    border-radius: var(--edl-border-radius);
    background: white;
    max-width: 600px;
    margin: 0 auto;
}

.signature-wrapper canvas {
    width: 100%;
    height: 200px;
    display: block;
}

/* ============================================================================
   Tenant view (ajouts du locataire)
   ============================================================================ */
.tenant-added {
    border-left: 3px solid var(--edl-warning);
    background-color: #fffbeb;
    padding-left: 0.75rem;
}

/* ============================================================================
   PDF preview
   ============================================================================ */
.pdf-header {
    text-align: center;
    margin-bottom: 2rem;
}

.pdf-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.25rem;
}

/* ============================================================================
   Mobile optimisation
   ============================================================================ */
@media (max-width: 768px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }

    .photo-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }

    .signature-wrapper canvas {
        height: 150px;
    }
}
