/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    font-size: 15px;
    background: #f4f6f9;
    color: #2d3748;
    min-height: 100vh;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* ===== NAVBAR ===== */
.navbar {
    background: #1e3a5f;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    height: 56px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.nav-brand {
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.nav-links { display: flex; gap: 0.5rem; }

.nav-links a {
    color: rgba(255,255,255,0.8);
    padding: 0.4rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
}
.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,0.15);
    color: #fff;
    text-decoration: none;
}

/* ===== LAYOUT ===== */
.container {
    max-width: 960px;
    margin: 2rem auto;
    padding: 0 1.5rem;
}

h1 { font-size: 1.6rem; margin-bottom: 1.25rem; color: #1e3a5f; }
h2 { font-size: 1.15rem; margin-bottom: 1rem; color: #1e3a5f; }

.subtitle { color: #64748b; margin-bottom: 1.25rem; }

/* ===== CARD ===== */
.card {
    background: #fff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    margin-bottom: 1.5rem;
}

/* ===== ALERTS ===== */
.alert {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}
.alert-error   { background: #fef2f2; border: 1px solid #fca5a5; color: #b91c1c; }
.alert-success { background: #f0fdf4; border: 1px solid #86efac; color: #166534; }
.alert-warning { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; }

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 1rem;
    flex: 1;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 0.35rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.15);
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.form-actions { display: flex; gap: 0.75rem; margin-top: 0.5rem; }

/* ===== BUTTONS ===== */
.btn {
    display: inline-block;
    padding: 0.55rem 1.25rem;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: background 0.2s, opacity 0.2s;
    text-align: center;
}
.btn:hover { opacity: 0.88; text-decoration: none; }

.btn-primary  { background: #2563eb; color: #fff; }
.btn-secondary { background: #e2e8f0; color: #334155; }
.btn-danger   { background: #dc2626; color: #fff; }
.btn-full     { width: 100%; display: block; }

.btn-sm { padding: 0.3rem 0.75rem; font-size: 0.8rem; }

/* ===== TABLE ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.data-table th {
    background: #f1f5f9;
    text-align: left;
    padding: 0.6rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
    border-bottom: 2px solid #e2e8f0;
}
.data-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #f1f5f9;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

.actions { display: flex; gap: 0.5rem; }

/* ===== BOUTIQUE GRID ===== */
.boutique-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.boutique-card {
    background: #fff;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 1.25rem 1rem;
    text-align: center;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: block;
}
.boutique-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 12px rgba(37,99,235,0.12);
    text-decoration: none;
}
.boutique-name {
    font-weight: 700;
    color: #1e3a5f;
    font-size: 0.95rem;
}

/* ===== BREADCRUMB ===== */
.breadcrumb {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 1rem;
}
.breadcrumb a { color: #2563eb; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    color: #94a3b8;
    padding: 2rem 0;
    font-style: italic;
}

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}

.login-box {
    background: #fff;
    border-radius: 12px;
    padding: 2.5rem;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.login-box h1 {
    font-size: 1.3rem;
    text-align: center;
    margin-bottom: 0.25rem;
    color: #1e3a5f;
}
.login-box h2 {
    font-size: 1rem;
    text-align: center;
    color: #64748b;
    font-weight: 400;
    margin-bottom: 1.5rem;
}

/* ===== ACTION BAR ===== */
.action-bar {
    max-width: 900px;
    margin: 1rem auto;
    padding: 0 1.5rem;
}
.action-buttons {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* ===== FACTURE DOCUMENT ===== */
.facture-document {
    max-width: 900px;
    margin: 1rem auto 3rem;
    padding: 2.5rem;
    background: #fff;
    box-shadow: 0 2px 16px rgba(0,0,0,0.1);
    border-radius: 8px;
}

/* Facture Header */
.facture-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1.5rem;
    gap: 2rem;
}

.boutique-info .boutique-nom {
    font-size: 1.5rem;
    color: #1e3a5f;
    margin-bottom: 0.4rem;
}
.boutique-info p {
    font-size: 0.9rem;
    color: #475569;
    margin-bottom: 0.2rem;
}

.facture-title-block { text-align: right; }

.facture-title {
    font-size: 2.2rem;
    font-weight: 900;
    color: #1e3a5f;
    letter-spacing: 2px;
    margin-bottom: 0.25rem;
}

.facture-date {
    font-size: 0.9rem;
    color: #e53e3e;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.facture-meta { margin-left: auto; }
.facture-meta td { padding: 0.2rem 0.5rem; font-size: 0.85rem; }
.facture-meta .meta-label { color: #64748b; }
.facture-meta .meta-value { font-weight: 700; color: #1e3a5f; }

.facture-divider {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 1.5rem 0;
}

/* Facture Table */
.facture-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1.5rem;
    font-size: 0.92rem;
}

.facture-table thead tr {
    background: #1e3a5f;
    color: #fff;
}

.facture-table th {
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.facture-table tbody tr:nth-child(even) { background: #f8fafc; }
.facture-table tbody tr:hover { background: #eff6ff; }

.facture-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid #e2e8f0;
}

.col-ref   { width: 100px; }
.col-desc  { }
.col-qty   { width: 50px;  text-align: center; }
.col-pu    { width: 110px; text-align: right; }
.col-tva   { width: 110px; text-align: right; }
.col-total { width: 110px; text-align: right; font-weight: 600; }

.facture-table th.col-qty,
.facture-table th.col-pu,
.facture-table th.col-tva,
.facture-table th.col-total { text-align: right; }

/* Totals */
.facture-totals {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 2rem;
}

.totals-table { border-collapse: collapse; min-width: 300px; }
.totals-table td { padding: 0.45rem 0.75rem; font-size: 0.92rem; }
.totals-label { color: #475569; }
.totals-value { text-align: right; font-weight: 600; }

.total-ttc-row td {
    border-top: 2px solid #1e3a5f;
    padding-top: 0.65rem;
    font-size: 1.1rem;
    font-weight: 800;
}
.total-ttc-amount { color: #e53e3e; font-size: 1.3rem; }

/* Summary table (Tunisian format) */
.summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 1.5rem;
    font-size: 0.9rem;
}
.summary-table th {
    background: #1e3a5f;
    color: #fff;
    padding: 0.5rem 0.75rem;
    text-align: center;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: 1px solid #1e3a5f;
}
.summary-table td {
    padding: 0.55rem 0.75rem;
    text-align: center;
    border: 1px solid #cbd5e1;
    font-size: 0.92rem;
}
.summary-table .net-a-payer {
    font-weight: 800;
    font-size: 1rem;
    color: #1e3a5f;
}

/* Arrêté box */
.arrete-box {
    margin-top: 1rem;
    border: 1px solid #cbd5e1;
    padding: 0.65rem 1rem;
    font-size: 0.88rem;
    color: #2d3748;
    background: #f8fafc;
}
