/* ============================================================
   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: 11px 24px;
    color: var(--primary);
    text-decoration: none;
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 24px;
    transition: background 0.15s;
    white-space: nowrap;
}

.sidebar-icon {
    font-size: 18px !important;
    vertical-align: -3px;
    margin-right: 10px;
    color: var(--primary);
    opacity: 0.65;
}

.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); }
.badge-dup { background: #fff3e0; color: #e65100; }

/* ============================================================
   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; }

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

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

.import-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
}

.import-desc {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: var(--text-placeholder);
    margin-bottom: 18px;
    line-height: 1.5;
}

.import-actions {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.import-upload-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.import-file-input {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    color: var(--text);
    padding: 6px 0;
}

.import-file-input::file-selector-button {
    height: 34px;
    padding: 0 16px;
    background: var(--white);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--radius);
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    margin-right: 10px;
    transition: background 0.15s;
}

.import-file-input::file-selector-button:hover {
    background: #eef1f8;
}

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

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

.import-confirmation {
    margin-top: 16px;
    padding: 16px 20px;
    background: var(--ok-bg);
    border: 1px solid var(--ok);
    border-radius: var(--radius);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--ok);
}

.import-confirmation .badge {
    margin-right: 8px;
    font-size: 14px;
    padding: 4px 12px;
}

/* ============================================================
   Dashboard
   ============================================================ */
.dash-cards {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.dash-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    text-align: center;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.dash-card-elec { border-left: 3px solid #2E74B5; }
.dash-card-gaz { border-left: 3px solid #E65100; }

.dash-card-value {
    display: block;
    font-family: 'Poppins', sans-serif;
    font-size: 32px;
    font-weight: 700;
    color: var(--primary);
}

.dash-card-label {
    display: block;
    font-family: 'Roboto', sans-serif;
    font-size: 13px;
    color: var(--text-placeholder);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.dash-sections {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.dash-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.dash-section h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 16px;
}

.dash-releve-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.dash-releve-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: var(--bg);
}

.dash-releve-item span:first-child {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: var(--primary);
}

.dash-releve-item span:last-child {
    font-family: 'Poppins', sans-serif;
    font-size: 18px;
    font-weight: 700;
    color: var(--primary);
}

/* ============================================================
   Documentation
   ============================================================ */
.docs-container {
    max-width: 900px;
}

.docs-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.docs-section h3 {
    font-family: 'Poppins', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid var(--bg);
}

.docs-section p {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.7;
    color: #333;
    margin-bottom: 12px;
}

.docs-section ul,
.docs-section ol {
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    line-height: 1.8;
    color: #333;
    margin: 8px 0 12px 20px;
}

.docs-section code {
    background: #f0f2f5;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 13px;
    color: var(--primary);
}

.docs-info-box {
    background: #eef1f8;
    border-left: 3px solid var(--primary);
    padding: 14px 18px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 14px;
    line-height: 1.8;
    margin: 12px 0;
}

.docs-note {
    background: #fff8e1;
    border-left: 3px solid #f9a825;
    padding: 10px 14px;
    border-radius: 0 var(--radius) var(--radius) 0;
    font-size: 13px;
    color: #5d4037;
    margin: 10px 0;
}

.docs-module {
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--bg);
}

.docs-module:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.docs-module h4 {
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 6px;
}

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