/* Reset & base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: #1a1a2e;
    color: #fff;
    padding: 0 2rem;
    display: flex;
    align-items: center;
    height: 56px;
    gap: 2rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.nav-brand { font-size: 1.1rem; font-weight: 700; white-space: nowrap; }
.nav-links { display: flex; gap: .5rem; }
.nav-links a {
    color: rgba(255,255,255,.7);
    text-decoration: none;
    padding: .5rem 1rem;
    border-radius: 6px;
    font-size: .9rem;
    transition: all .2s;
}
.nav-links a:hover, .nav-links a.active {
    color: #fff;
    background: rgba(255,255,255,.12);
}

/* Language switcher dropdown */
.lang-switcher { margin-left: auto; position: relative; }
.lang-dropdown { position: relative; }
.lang-dropdown-btn {
    display: flex;
    align-items: center;
    gap: .4rem;
    background: rgba(255,255,255,.1);
    border: 1px solid rgba(255,255,255,.2);
    color: #fff;
    padding: .35rem .7rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: .85rem;
    transition: all .2s;
}
.lang-dropdown-btn:hover { background: rgba(255,255,255,.2); }
.lang-flag { font-size: 1.1rem; line-height: 1; }
.lang-name { font-weight: 500; }
.lang-arrow { font-size: .65rem; opacity: .7; }
.lang-dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    right: 0;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.15);
    min-width: 160px;
    z-index: 300;
    overflow: hidden;
}
.lang-dropdown-menu.open { display: block; }
.lang-option {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .6rem 1rem;
    text-decoration: none;
    color: #333;
    font-size: .9rem;
    transition: background .15s;
}
.lang-option:hover { background: #f0f2f5; }
.lang-option.active { background: #e8f0fe; font-weight: 600; color: #4361ee; }

/* Container */
.container { max-width: 1400px; margin: 0 auto; padding: 1.5rem; flex: 1; width: 100%; }

/* Cards */
.card {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}
.card h2 {
    font-size: 1.15rem;
    margin-bottom: 1rem;
    padding-bottom: .5rem;
    border-bottom: 2px solid #e8e8e8;
    color: #1a1a2e;
}

/* Scan station */
.station { border-left: 4px solid #4361ee; }

/* Stock current badge */
.stock-current {
    margin-top: .75rem;
    padding: .6rem 1rem;
    background: #e3f2fd;
    border-radius: 6px;
    font-size: .95rem;
    color: #1565c0;
}

/* Action tabs */
.action-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 1.25rem;
    border-radius: 8px;
    overflow: hidden;
    border: 2px solid #e0e0e0;
}
.action-tab {
    flex: 1;
    padding: .7rem .5rem;
    border: none;
    background: #f5f5f5;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    color: #666;
    transition: all .2s;
}
.action-tab:not(:last-child) { border-right: 2px solid #e0e0e0; }
.action-tab:hover { background: #e8e8e8; }
.action-tab.active[data-action="inventaire"] { background: #4361ee; color: #fff; }
.action-tab.active[data-action="entree"] { background: #4caf50; color: #fff; }
.action-tab.active[data-action="sortie"] { background: #ef5350; color: #fff; }

/* Action panels */
.action-panel { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.action-desc {
    font-size: .85rem;
    color: #888;
    margin-bottom: 1rem;
}

/* Rolls section */
.rolls-section {
    margin: 1rem 0;
}
.rolls-section > label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: #666;
    margin-bottom: .3rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.roll-input-row {
    display: flex;
    gap: .5rem;
    margin-bottom: .75rem;
}
.roll-input-row input {
    flex: 1;
    padding: .6rem .8rem;
    border: 2px solid #4361ee;
    border-radius: 6px;
    font-size: 1rem;
    background: #fafbff;
}
.roll-input-row input:focus { outline: none; border-color: #3a56d4; }
.rolls-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .85rem;
    margin-bottom: .5rem;
}
.rolls-table th {
    background: #f5f5f5;
    padding: .4rem .6rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    font-size: .75rem;
    text-transform: uppercase;
}
.rolls-table td {
    padding: .35rem .6rem;
    border-bottom: 1px solid #f0f0f0;
}
.rolls-table tfoot td {
    border-top: 2px solid #e0e0e0;
    border-bottom: none;
    padding-top: .5rem;
}

/* Form fields */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    color: #666;
    margin-bottom: .3rem;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.form-group input, .form-group select {
    width: 100%;
    padding: .6rem .8rem;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    font-size: .95rem;
    transition: border-color .2s;
}
.form-group input:focus, .form-group select:focus {
    outline: none;
    border-color: #4361ee;
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Product info display */
.product-info {
    background: #f8f9ff;
    border-radius: 8px;
    padding: 1rem;
    margin: 1rem 0;
    display: none;
}
.product-info.visible { display: block; }
.product-info .info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .5rem;
}
.product-info .info-item {
    font-size: .85rem;
}
.product-info .info-item span { font-weight: 600; color: #1a1a2e; }
.product-info .info-label { color: #888; font-size: .75rem; text-transform: uppercase; }

/* Stock display */
.stock-result {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: 8px;
    background: #e8f5e9;
    border: 2px solid #4caf50;
}
.stock-result.visible { display: block; }
.stock-result .stock-number {
    font-size: 2rem;
    font-weight: 800;
    color: #2e7d32;
    text-align: center;
}
.stock-result .stock-label {
    text-align: center;
    color: #666;
    font-size: .85rem;
    margin-top: .25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    padding: .6rem 1.2rem;
    border: none;
    border-radius: 6px;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.btn-primary { background: #4361ee; color: #fff; }
.btn-primary:hover { background: #3a56d4; }
.btn-success { background: #4caf50; color: #fff; }
.btn-success:hover { background: #43a047; }
.btn-danger { background: #ef5350; color: #fff; }
.btn-danger:hover { background: #e53935; }
.btn-secondary { background: #e0e0e0; color: #333; }
.btn-secondary:hover { background: #d0d0d0; }
.btn-sm { padding: .35rem .7rem; font-size: .8rem; }

.btn-group { display: flex; gap: .5rem; margin-top: 1rem; }

/* Table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
    background: #f5f5f5;
    padding: .6rem .8rem;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e0e0e0;
    white-space: nowrap;
    position: sticky;
    top: 0;
}
tbody td {
    padding: .5rem .8rem;
    border-bottom: 1px solid #f0f0f0;
}
tbody tr:hover { background: #f8f9ff; }

/* Stock badges */
.stock-badge {
    display: inline-block;
    padding: .15rem .5rem;
    border-radius: 4px;
    font-weight: 600;
    font-size: .8rem;
}
.stock-ok { background: #e8f5e9; color: #2e7d32; }
.stock-low { background: #fff3e0; color: #e65100; }
.stock-zero { background: #ffebee; color: #c62828; }

/* Filters */
.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    align-items: flex-end;
}
.filters .form-group { margin-bottom: 0; flex: 1; min-width: 180px; }
.filters .form-group.search-group { flex: 2; min-width: 250px; }

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: .3rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}
.pagination a, .pagination span {
    padding: .4rem .8rem;
    border-radius: 4px;
    text-decoration: none;
    font-size: .85rem;
    color: #333;
    border: 1px solid #ddd;
}
.pagination a:hover { background: #e8e8e8; }
.pagination .active { background: #4361ee; color: #fff; border-color: #4361ee; }
.pagination .disabled { color: #ccc; pointer-events: none; }

/* Alert messages */
.alert {
    padding: .8rem 1rem;
    border-radius: 6px;
    margin-bottom: 1rem;
    font-size: .9rem;
}
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }
.alert-error { background: #ffebee; color: #c62828; border: 1px solid #ffcdd2; }
.alert-info { background: #e3f2fd; color: #1565c0; border: 1px solid #bbdefb; }

/* Footer */
.footer {
    text-align: center;
    padding: 1rem;
    color: #999;
    font-size: .8rem;
    margin-top: auto;
}

/* Barcode input highlight */
input.barcode-input {
    font-size: 1.1rem;
    font-family: 'Courier New', monospace;
    letter-spacing: 2px;
    border-color: #4361ee;
    background: #fafbff;
}

/* Modal */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    z-index: 200;
    align-items: center;
    justify-content: center;
}
.modal-overlay.visible { display: flex; }
.modal {
    background: #fff;
    border-radius: 12px;
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    max-height: 80vh;
    overflow-y: auto;
}
.modal h3 { margin-bottom: 1rem; }

/* Import */
.import-progress {
    background: #e0e0e0;
    border-radius: 8px;
    overflow: hidden;
    height: 24px;
    margin: 1rem 0;
}
.import-progress .bar {
    height: 100%;
    background: #4361ee;
    transition: width .3s;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: .75rem;
    font-weight: 600;
}

/* Stats cards */
.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.stat-card {
    background: #fff;
    border-radius: 10px;
    padding: 1.2rem;
    box-shadow: 0 1px 4px rgba(0,0,0,.08);
    text-align: center;
}
.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 800;
    color: #4361ee;
}
.stat-card .stat-label {
    font-size: .8rem;
    color: #888;
    text-transform: uppercase;
    margin-top: .3rem;
}

/* Stats grid */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: 1fr; } }
