/* VoFact — Mode Bâtiment (BTP)
   Styles isolés pour la section bordereaux BTP.
   Ne touche AUCUNE classe existante de styles.css.
   Toutes les classes sont préfixées btp-* pour éviter toute collision. */

/* Conteneurs de page (réutilise .page existant — display:none par défaut). */
#page-btp-list .btp-toolbar,
#page-btp-form .btp-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

/* Liste des bordereaux */
.btp-list-empty {
    text-align: center;
    padding: 60px 20px;
    color: #94a3b8;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px dashed #cbd5e1;
}
.btp-list-empty h3 { color: #475569; margin: 0 0 8px; }
.btp-list-empty p { margin: 0; font-size: 14px; }

.btp-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: box-shadow 0.15s;
}
.btp-card:hover { box-shadow: 0 2px 12px rgba(99, 102, 241, 0.08); }
.btp-card__num {
    font-weight: 700;
    color: #6366f1;
    font-size: 14px;
    min-width: 140px;
}
.btp-card__client {
    flex: 1;
    color: #1e293b;
    font-weight: 500;
}
.btp-card__amount {
    font-weight: 700;
    color: #0f172a;
    font-size: 16px;
}
.btp-card__status {
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}
.btp-status-draft { background: #f1f5f9; color: #64748b; }
.btp-status-final, .btp-status-sent { background: #dbeafe; color: #1e40af; }
.btp-status-paid { background: #dcfce7; color: #166534; }
.btp-status-cancelled { background: #fee2e2; color: #991b1b; }
.btp-status-accepted { background: #ecfccb; color: #3f6212; }

.btp-card__actions { display: flex; gap: 6px; }
.btp-card__actions button {
    background: none;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 6px 10px;
    cursor: pointer;
    font-size: 13px;
    color: #475569;
    transition: all 0.15s;
}
.btp-card__actions button:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    color: #1e293b;
}
.btp-card__actions .btn-danger:hover {
    background: #fee2e2;
    border-color: #fecaca;
    color: #991b1b;
}

/* Formulaire bordereau */
.btp-form {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    border: 1px solid #e2e8f0;
    margin-bottom: 20px;
}
.btp-form h3 {
    margin: 0 0 16px;
    color: #0f172a;
    font-size: 18px;
    font-weight: 700;
}
.btp-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 14px 18px;
    margin-bottom: 18px;
}
@media (max-width: 640px) {
    .btp-grid { grid-template-columns: 1fr; }
}
.btp-field { display: flex; flex-direction: column; gap: 4px; }
.btp-field label {
    font-size: 12px;
    text-transform: uppercase;
    font-weight: 700;
    color: #64748b;
    letter-spacing: 0.02em;
}
.btp-field input,
.btp-field select,
.btp-field textarea {
    padding: 10px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.btp-field input:focus,
.btp-field select:focus,
.btp-field textarea:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}
.btp-field-full { grid-column: 1 / -1; }
.btp-field input[type="checkbox"] {
    width: auto;
    align-self: flex-start;
    margin-top: 4px;
}
.btp-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: #1e293b;
    cursor: pointer;
}

/* Lignes du bordereau */
.btp-items-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 12px;
}
.btp-items-table th {
    background: #f1f5f9;
    text-transform: uppercase;
    font-size: 11px;
    color: #475569;
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid #cbd5e1;
}
.btp-items-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: top;
}
.btp-items-table input,
.btp-items-table select {
    padding: 6px 8px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    width: 100%;
    box-sizing: border-box;
}
.btp-items-table .btp-line-total {
    font-weight: 600;
    color: #0f172a;
    text-align: right;
    white-space: nowrap;
}
.btp-items-table .btp-remove-line {
    background: none;
    border: 1px solid #fecaca;
    color: #991b1b;
    padding: 6px 8px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
}
.btp-items-table .btp-remove-line:hover { background: #fee2e2; }

.btp-add-line {
    background: #f1f5f9;
    border: 1px dashed #cbd5e1;
    color: #475569;
    padding: 10px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    width: 100%;
    margin-bottom: 16px;
    transition: all 0.15s;
}
.btp-add-line:hover {
    background: #e2e8f0;
    color: #1e293b;
    border-style: solid;
}

/* Bloc totaux */
.btp-totals {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 14px 18px;
    margin-top: 12px;
}
.btp-totals-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 14px;
}
.btp-totals-row.major {
    border-top: 1px solid #cbd5e1;
    padding-top: 10px;
    margin-top: 6px;
    font-weight: 700;
}
.btp-totals-row.net {
    border-top: 2px solid #6366f1;
    padding-top: 12px;
    margin-top: 8px;
    font-weight: 800;
    font-size: 18px;
    color: #0f172a;
}

/* Boutons */
.btp-btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.btp-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btp-btn-primary:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btp-btn-secondary {
    background: #fff;
    color: #475569;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.btp-btn-secondary:hover { background: #f1f5f9; color: #1e293b; }

/* Modal d'activation */
.btp-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}
.btp-modal-overlay.active { display: flex; }
.btp-modal {
    background: #fff;
    border-radius: 16px;
    padding: 28px;
    max-width: 520px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
}
.btp-modal h3 {
    font-size: 20px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 8px;
}
.btp-modal-sub {
    color: #64748b;
    font-size: 14px;
    margin-bottom: 16px;
}
.btp-modal-features {
    background: #f8fafc;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 16px;
}
.btp-modal-features ul {
    margin: 0;
    padding-left: 20px;
    font-size: 13px;
    color: #475569;
    line-height: 1.7;
}
.btp-modal-warning {
    background: #fffbeb;
    border-left: 3px solid #f59e0b;
    padding: 10px 14px;
    font-size: 13px;
    color: #78350f;
    margin-bottom: 18px;
    border-radius: 6px;
}
.btp-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* Section paramètres BTP */
.btp-settings-block {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}
.btp-settings-block h4 {
    margin: 0 0 12px;
    color: #0f172a;
    font-size: 16px;
    font-weight: 700;
}
.btp-info {
    background: #eef2ff;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 13px;
    color: #3730a3;
    margin-bottom: 14px;
}

/* Spinner */
.btp-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid #e2e8f0;
    border-top-color: #6366f1;
    border-radius: 50%;
    animation: btp-spin 0.7s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}
@keyframes btp-spin {
    to { transform: rotate(360deg); }
}
