/* ============================================================
   My Act — Engie Export Interface
   Tokens from Figma maquette
   ============================================================ */

:root {
    --primary: #192351;
    --primary-hover: #1e2d6a;
    --text: #000000;
    --text-nav: #444444;
    --text-placeholder: #636165;
    --bg: #f8f8f8;
    --white: #ffffff;
    --border: #d9d9d9;
    --border-header: #444444;
    --border-row: #c6c6c6;
    --header-bg: #f5f5f5;
    --ok: #2e7d32;
    --ok-bg: #e8f5e9;
    --ko: #c62828;
    --ko-bg: #ffebee;
    --shadow: 0 3px 3px rgba(0,0,0,0.16);
    --radius: 4px;
    --radius-chip: 8px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
}

/* ============================================================
   Sidebar (left menu from Figma)
   ============================================================ */
.sidebar {
    width: 220px;
    background: var(--white);
    box-shadow: var(--shadow);
    flex-shrink: 0;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 50;
    display: flex;
    flex-direction: column;
}

.sidebar-logo {
    padding: 16px 20px 28px;
}

.logo-img {
    width: 160px;
    height: auto;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
}

.sidebar-link {
    padding: 12px 29px;
    color: var(--primary);
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.15s;
}

.sidebar-link:hover {
    background: #f0f0f0;
}

.sidebar-link.active {
    background: #eef1f8;
    font-weight: 600;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid var(--border);
}

.sidebar-user {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--primary);
    padding: 0 9px 8px;
    word-break: break-word;
}

.sidebar-logout {
    color: #c62828 !important;
    font-size: 13px !important;
}

/* ============================================================
   Main wrapper
   ============================================================ */
.main-wrapper {
    margin-left: 220px;
    flex: 1;
    padding: 28px 32px;
    min-height: 100vh;
}

/* ============================================================
   Filters bar (like Figma: 5 fields in a row)
   ============================================================ */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.filter-group {
    flex: 1;
    min-width: 150px;
}

.filter-field {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-placeholder);
    background: var(--white);
    outline: none;
    transition: border-color 0.15s;
}

.filter-field:focus {
    border-color: var(--primary);
    color: var(--text);
}

/* ============================================================
   Chips + actions row
   ============================================================ */
.chips-actions-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    min-height: 40px;
    gap: 16px;
}

.chips-row {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    flex: 1;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    background: var(--primary);
    color: var(--white);
    border-radius: var(--radius-chip);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
}

.chip-close {
    cursor: pointer;
    font-size: 15px;
    opacity: 0.8;
    background: none;
    border: none;
    color: inherit;
    line-height: 1;
    padding: 0;
}

.chip-close:hover { opacity: 1; }

.export-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.config-select,
.config-date {
    height: 36px;
    padding: 0 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    outline: none;
}

.config-select:focus,
.config-date:focus {
    border-color: var(--primary);
}

.ean-counter {
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
}

.btn-export {
    height: 40px;
    padding: 0 28px;
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: var(--radius);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s;
}

.btn-export:hover { background: var(--primary-hover); }
.btn-export:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================================
   Tables (matching Figma exactly)
   ============================================================ */
.table-wrapper {
    background: var(--white);
    border: 1px solid var(--border-header);
    overflow: hidden;
    max-height: 70vh;
    overflow-y: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    position: sticky;
    top: 0;
    z-index: 5;
}

.data-table th {
    background: var(--header-bg);
    border: 1px solid var(--border-header);
    padding: 14px 20px;
    text-align: left;
    font-family: 'Roboto', sans-serif;
    font-size: 16px;
    font-weight: 500;
    line-height: 19px;
    color: #000000;
    white-space: nowrap;
}

.data-table td {
    border: 1px solid var(--border-row);
    padding: 14px 20px;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 16px;
    color: #000000;
    background: var(--white);
}

.data-table tbody tr:hover td {
    background: #f4f6fb;
}

/* ============================================================
   Progress
   ============================================================ */
.progress-container {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 13px;
    color: var(--text-placeholder);
}

.progress-track {
    height: 6px;
    background: var(--header-bg);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s ease;
}

/* ============================================================
   Results
   ============================================================ */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0 12px;
    gap: 16px;
}

.results-header h3 {
    font-size: 18px;
    font-weight: 600;
}

.results-stats {
    display: flex;
    gap: 16px;
    flex: 1;
}

.stat-ok { color: var(--ok); font-weight: 600; }
.stat-ko { color: var(--ko); font-weight: 600; }

/* Status badges */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-chip);
    font-size: 12px;
    font-weight: 600;
}

.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-ko { background: var(--ko-bg); color: var(--ko); }

/* ============================================================
   Bilan
   ============================================================ */
.bilan-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.bilan-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.bilan-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 20px;
}

.stat-card {
    flex: 1;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    text-align: center;
}

.stat-card-ok { border-color: var(--ok); }
.stat-card-ko { border-color: var(--ko); }

.stat-value {
    display: block;
    font-size: 28px;
    font-weight: 700;
}

.stat-card-ok .stat-value { color: var(--ok); }
.stat-card-ko .stat-value { color: var(--ko); }

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-placeholder);
    margin-top: 4px;
    text-transform: uppercase;
}

/* ============================================================
   Loader
   ============================================================ */
.loader {
    border: 3px solid var(--border);
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    animation: spin 0.7s linear infinite;
    display: inline-block;
    vertical-align: middle;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* ============================================================
   Scrollbar
   ============================================================ */
.table-wrapper::-webkit-scrollbar { width: 8px; }
.table-wrapper::-webkit-scrollbar-track { background: var(--header-bg); }
.table-wrapper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

/* Utility */
.text-right { text-align: right; }
.font-medium { font-weight: 500; }
