/* --- Base & Layout --- */
:root {
    --primary-color: #007bff;
    --danger-color: #dc3545;
    --success-color: #28a745;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-grey: #f8f9fa;
    --grey-border: #dee2e6;
    --text-color: #343a40;
}
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f1f3f5;
    line-height: 1.6;
    font-size: 14px;
    color: var(--text-color);
}

/* --- Login Screen Styles --- */
#login-screen {
    position: fixed; top: 0; left: 0; width: 100%; height: 100%;
    background-color: #e9ecef; display: flex; flex-direction: column;
    justify-content: center; align-items: center; z-index: 2000;
    padding: 20px; box-sizing: border-box;
}
#login-logo { max-width: 180px; margin-bottom: 30px; }
#login-form {
    background-color: #fff; padding: 30px 40px; border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1); text-align: center;
    width: 100%; max-width: 350px;
}
#login-form .form-group { margin-bottom: 20px; text-align: left; }
#login-form label {
    display: block; margin-bottom: 6px; font-weight: 500;
    font-size: 13px; color: #495057;
}
#login-form input[type="text"],
#login-form input[type="password"] {
    width: 100%; padding: 12px 15px; border: 1px solid var(--grey-border);
    border-radius: 5px; box-sizing: border-box; font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
}
#login-form input:focus {
    border-color: var(--primary-color); outline: none;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2);
}
#login-button {
    padding: 12px 25px; font-size: 16px; width: 100%; margin-top: 10px;
    background-color: var(--primary-color); color: white; border: none;
    cursor: pointer; border-radius: 5px;
}
#login-button:hover { background-color: #0056b3; }
#login-error {
    color: #dc3545; font-size: 13px; margin-top: 15px;
    min-height: 1.2em; font-weight: 500;
}

/* --- App Container --- */
#app-container { display: none; }

/* --- General Styles & Layout --- */
.container {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    margin: 0;
    padding: 25px;
}
.section {
    background: #fff; padding: 20px; border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.07); margin-bottom: 25px; overflow: auto;
}
h2 {
    text-align: center; color: #212529; margin-top: 0; margin-bottom: 30px;
    padding-bottom: 15px; border-bottom: 1px solid #eee; font-size: 1.6em; font-weight: 600;
}
h3 {
    margin-top: 30px; margin-bottom: 15px; color: #495057;
    border-bottom: 1px solid #eee; padding-bottom: 10px; font-size: 1.3em; font-weight: 600;
}
h4 { margin-top: 25px; margin-bottom: 10px; color: #6c757d; font-size: 1.1em; font-weight: 600; }
hr { border: 0; border-top: 1px solid #eee; margin: 25px 0; }
.text-center { text-align: center; }
.clearfix::after { content: ""; clear: both; display: table; }

/* --- Header --- */
.header-container { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; margin-bottom: 15px; position: relative; }
.logo { max-width: 140px; height: auto; vertical-align: middle; }
.header-actions { display: flex; align-items: center; gap: 20px; }
#notification-bell-container { position: relative; cursor: pointer; }
#notification-bell-container .fa-bell { font-size: 26px; color: #6c757d; transition: color 0.3s ease, transform 0.2s; }
#notification-bell-container:hover .fa-bell { transform: scale(1.1); }
#notification-bell-container.has-low-stock .fa-bell { color: var(--danger-color); animation: bellRing 1.5s ease-in-out infinite; }
#low-stock-count {
    position: absolute; top: -8px; right: -10px; background-color: var(--danger-color);
    color: white; border-radius: 50%; padding: 2px 6px; font-size: 11px;
    font-weight: bold; display: none; border: 1px solid white;
}
#notification-bell-container.has-low-stock #low-stock-count,
#notification-bell-container #low-stock-count:not(:empty):not([data-count="0"]) { display: inline-block; }
#low-stock-details {
    display: none; position: absolute; top: 100%; right: 0; background-color: white;
    border: 1px solid var(--grey-border); box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    border-radius: 6px; width: 320px; max-height: 400px; overflow-y: auto;
    z-index: 110; padding: 12px; font-size: 13px;
}
#low-stock-details h4 { margin-top: 0; margin-bottom: 10px; border-bottom: 1px solid #eee; padding-bottom: 8px; text-align: center; font-size: 14px; }
#low-stock-details ul { list-style: none; padding: 0; margin: 0; }
#low-stock-details li { padding: 7px 5px; border-bottom: 1px dotted #eee; display: flex; justify-content: space-between; align-items: center; transition: background-color 0.2s; }
#low-stock-details li:last-child { border-bottom: none; }
#low-stock-details li:hover { background-color: #f1f3f5; }
#low-stock-details li span:first-child { flex-grow: 1; margin-right: 10px; }
#low-stock-details li strong { color: var(--danger-color); font-size: 14px; }
@keyframes bellRing { 0%,100%{transform:rotate(0deg) scale(1)}10%,30%,50%,70%,90%{transform:rotate(-12deg) scale(1.05)}20%,40%,60%,80%{transform:rotate(12deg) scale(1.05)} }
#logout-button i.fa-sign-out-alt { margin-right: 5px; }

/* --- Navigation Tabs --- */
.nav-tabs { display: flex; list-style: none; padding: 0; margin: 10px 0 25px 0; border-bottom: 1px solid var(--grey-border); flex-wrap: wrap; }
.nav-tabs li { margin-right: 5px; margin-bottom: -1px; }
.nav-tabs button { padding: 12px 18px; background: none; border: 1px solid transparent; border-bottom: none; cursor: pointer; transition: all 0.2s ease-in-out; font-size: 15px; color: #495057; border-radius: 5px 5px 0 0; margin-bottom: 0;}
.nav-tabs button.active {
    border: 1px solid var(--grey-border);
    border-bottom-color: #fff;
    background-color: #fff;
    font-weight: 600;
    color: #2a3084; /* <-- BDELNAH B LOUN VIOLET */
}
.nav-tabs button:hover:not(.active) { background-color: #e9ecef; border-color: #e9ecef; }
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.4s ease-in-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }

/* --- Buttons & Forms --- */
button, .btn { font-size: 14px; padding: 8px 15px; cursor: pointer; border: 1px solid #ced4da; border-radius: 5px; transition: all 0.2s ease-in-out; margin: 3px; vertical-align: middle; background-color: var(--light-grey); color: #495057; }
button:hover, .btn:hover { border-color: #adb5bd; background-color: #e9ecef; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-xs { padding: 3px 6px; font-size: 11px; line-height: 1.2; margin: 0 2px;}
.btn-primary { background-color: var(--primary-color); color: white; border-color: var(--primary-color); } .btn-primary:hover { background-color: #0056b3; border-color: #0056b3; }
.btn-secondary { background-color: #6c757d; color: white; border-color: #6c757d; } .btn-secondary:hover { background-color: #5a6268; border-color: #5a6268; }
.btn-success { background-color: var(--success-color); color: white; border-color: var(--success-color); } .btn-success:hover { background-color: #1e7e34; border-color: #1e7e34; }
.btn-danger { background-color: var(--danger-color); color: white; border-color: var(--danger-color); } .btn-danger:hover { background-color: #c82333; border-color: #c82333; }
.btn-warning { background-color: var(--warning-color); color: #212529; border-color: var(--warning-color); } .btn-warning:hover { background-color: #e0a800; border-color: #e0a800; }
.btn-info { background-color: var(--info-color); color: white; border-color: var(--info-color); } .btn-info:hover { background-color: #138496; border-color: #138496; }
button:disabled, .btn:disabled { opacity: 0.65; cursor: not-allowed; }

.form-group { margin-bottom: 18px; position: relative; }
.form-group label { display: block; margin-bottom: 6px; font-weight: 500; font-size: 13px; color: #495057; }
.form-group input[type="text"], .form-group input[type="tel"], .form-group input[type="number"], .form-group input[type="search"], .form-group input[type="password"], .form-group textarea, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid var(--grey-border); border-radius: 5px; box-sizing: border-box; font-size: 14px; transition: border-color 0.2s, box-shadow 0.2s; }
.form-group input:focus, .form-group textarea:focus, .form-group select:focus { border-color: var(--primary-color); outline: none; box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.2); }
.form-group textarea { resize: vertical; min-height: 70px; }
input[type="search"]::-webkit-search-cancel-button { appearance: none; height: 12px; width: 12px; background: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 10 10" fill="%23aaa"><path d="M9 1L1 9M1 1l8 8"/></svg>') center/contain no-repeat; cursor: pointer; opacity: 0.7; }
input[type="search"]::-webkit-search-cancel-button:hover { opacity: 1; }
.form-group small { font-size: 0.85em; color: #6c757d; display: block; margin-top: 3px; }
.form-group.full-width { grid-column: 1 / -1; }
.text-right { text-align: right; }

/* --- Shared Layouts --- */
.sections-row { display: flex; gap: 25px; margin-bottom: 25px; flex-wrap: wrap; }
.section-half { flex: 1; min-width: 320px; }
.section-half h3 { margin-top: 0; }

/* --- Saisie Tab --- */
.product { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; border-bottom: 1px dotted #eee; font-size: 13px; }
.product:last-child { border-bottom: none; }
.product span:nth-child(1) { flex-basis: 40px; text-align: center; font-weight: bold; }
.product span.label { flex-grow: 1; margin: 0 10px; }
.product button { flex-shrink: 0; }
.product .count { flex-basis: 30px; text-align: center; font-weight: bold; margin: 0 5px; min-width: 25px; display: inline-block; }
.code-input-container { text-align: center; margin-bottom: 20px; }
.code-input { padding: 10px 15px; font-size: 15px; border: 1px solid #ccc; border-radius: 5px; width: 200px; max-width: 80%; text-align: center; }
.totals-container { display: flex; justify-content: space-around; margin: 25px 0; text-align: center; flex-wrap: wrap; gap:10px; }
.total-box { background: #f8f9fa; padding: 12px 18px; border-radius: 6px; border: 1px solid #dee2e6; font-size: 1.1em; min-width: 100px; flex: 1; }
.total-box span { font-size: 1.5em; font-weight: bold; display: block; margin-top: 5px; }
.total-box.men span { color: #007bff; }
.total-box.women span { color: #e83e8c; }
.total-box.global span { color: #20c997; }
.details-container { display: flex; gap: 25px; margin-top: 20px; flex-wrap: wrap; }
.details-box { flex: 1; min-width: 300px; background: #fff; padding: 15px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.details-box h3 { margin-top: 0; margin-bottom: 15px; font-size: 1.1em; }
.perfume-count-box { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; font-size: 13px; border-bottom: 1px dashed #eee; }
.perfume-count-box:last-child { border-bottom: none; }
.perfume-id { font-weight: bold; flex-basis: 40px; }
.perfume-name { flex-grow: 1; margin: 0 8px; }
.perfume-quantity { font-weight: bold; min-width: 20px; text-align: right; }
.needed-item { display: flex; justify-content: space-between; align-items: center; }
.needed-item > div:first-child { flex-grow: 1; }
.needed-item small { display: block; font-size: 11px; color: #888; }
.needed-item-controls { display: flex; align-items: center; gap: 8px; margin-left: 15px; }
.needed-item-controls span { font-size: 12px; }
.label-print-qty-input { width: 65px; padding: 4px 6px; text-align: center; border: 1px solid #ccc; border-radius: 4px; font-weight: bold; font-size: 14px; }
.history-container { margin-top: 30px; }
.history-container h3 { text-align: center; }
.calendar-nav { display: flex; justify-content: space-between; align-items: center; margin-bottom: 15px; }
.calendar-title { font-weight: bold; font-size: 1.2em; }
.calendar-nav-button { background: none; border: none; font-size: 1.5em; cursor: pointer; color: var(--primary-color); padding: 0 10px; }
.calendar { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; border: 1px solid var(--grey-border); padding: 10px; border-radius: 5px; background: #fff; }
.calendar-header { font-weight: bold; text-align: center; font-size: 0.9em; color: #6c757d; padding-bottom: 5px; }
.calendar-day { text-align: center; padding: 10px 5px; border: 1px solid transparent; border-radius: 4px; cursor: pointer; transition: background-color 0.2s, border-color 0.2s; font-size: 0.95em; }
.calendar-day.empty { background-color: #f8f9fa; cursor: default; }
.calendar-day:not(.empty):hover { background-color: #e9ecef; }
.calendar-day.has-data { font-weight: bold; background-color: #e2f0ff; }
.calendar-day.selected-day { background-color: var(--primary-color); color: white; border-color: var(--primary-color); font-weight: bold; }
.calendar-day.today { border: 1px dashed var(--info-color); font-weight: bold; }
.day-details { margin-top: 20px; padding: 15px; background: #fff; border-radius: 5px; border: 1px solid var(--grey-border); min-height: 100px; }
.day-details h3 { margin-top: 0; font-size: 1.2em; }
.history-total { font-weight: bold; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px solid #eee; font-size: 1em; }
.history-item { padding: 3px 0; font-size: 0.95em; border-bottom: 1px dotted #eee; }
.history-item:last-child { border-bottom: none; }
.history-item span span { font-weight: normal; }
.clear-history { margin-left: 10px; vertical-align: middle; }

/* --- Caisse Tab --- */
.input-container { position: relative; margin-bottom: 25px; }
#perfume-search { width: 100%; max-width: 450px; padding: 10px 15px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-size: 15px; margin: 0 auto 15px auto; display: block; }
.search-results { position: absolute; left: 50%; transform: translateX(-50%); background: white; border: 1px solid #ccc; border-top: none; border-radius: 0 0 5px 5px; max-height: 250px; overflow-y: auto; width: 100%; max-width:450px; z-index: 100; box-shadow: 0 4px 8px rgba(0,0,0,0.1); display: none; }
.search-result-item { padding: 10px 15px; cursor: pointer; font-size: 14px; border-bottom: 1px solid #eee; }
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background-color: #f1f3f5; }
.search-result-item strong { color: var(--primary-color); }
.selected-items { margin-top: 20px; }
.selected-items h3 { margin-bottom: 15px; font-size: 1.3em; }
.selected-items-list { border: 1px solid #eee; border-radius: 5px; padding: 10px; margin-bottom: 20px; background: #fff; min-height: 80px; }
.selected-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 5px; border-bottom: 1px dotted #eee; font-size: 14px; }
.selected-item:last-child { border-bottom: none; }
.item-name { flex-grow: 1; margin-right: 10px; }
.item-qty { display: flex; align-items: center; }
.item-qty .qty-display { margin: 0 8px; font-weight: bold; min-width: 20px; text-align: center;}
.item-price { font-weight: bold; min-width: 80px; text-align: right; }
.item-remove { margin-left: 10px; }
.discount-container { text-align: right; margin-bottom: 15px; display: flex; justify-content: flex-end; align-items: center; gap: 8px; }
.discount-container span { font-weight: 500; }
.discount-input { width: 100px; text-align: right; padding: 6px 8px; margin-bottom: 0;}
.total-amount { text-align: right; font-size: 1.4em; font-weight: bold; margin-bottom: 20px; padding-top: 15px; border-top: 1px solid #eee; }
#total-price { color: var(--text-color); }
#discounted-price { color: var(--success-color); }
.total-amount #after-discount { font-size: 0.7em; font-weight: normal; color: #6c757d; display: block; margin-top: 3px; }
.action-buttons { text-align: center; margin-top: 20px; padding-top: 20px; border-top: 1px solid #eee; }
.action-buttons button { margin: 0 5px; }

/* --- Ventes & Retours & Blacklist --- */
.sale-item-detail { padding: 12px 10px; border-bottom: 1px solid #eee; background-color: #fff; margin-bottom: 8px; border-radius: 4px; position: relative; display: flex; justify-content: space-between; align-items: flex-start;}
.sale-item-detail > div:first-child { flex-grow: 1; margin-right: 10px;}
.sale-time { font-weight: bold; color: #6c757d; margin-right: 8px; font-size: 0.9em; }
.sale-item-detail strong { color: var(--success-color); }
.sale-actions { display: flex; gap: 5px; flex-shrink: 0; }
.sale-total-day { font-weight: bold; text-align: right; margin-top: 20px; padding-top: 15px; border-top: 1px solid #000; font-size: 1.2em; }
.stat-box { background-color: #f8f9fa; padding: 20px; border-radius: 8px; border: 1px solid #e9ecef; margin-bottom: 25px; }
.retours-totals-grid { display: flex; justify-content: space-around; gap: 15px; font-size: 0.9em; }

/* --- Stock Tab (Parfums) --- */
.stock-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 0; border-bottom: 1px dotted #eee; font-size: 14px; }
.stock-item:last-child { border-bottom: none; }
.stock-header { font-weight: 600; background: var(--light-grey); padding: 10px 5px; margin-bottom: 8px; border-bottom: 1px solid var(--grey-border); display: flex; justify-content: space-between; font-size: 13px; border-radius: 4px; }
.stock-item > span:nth-child(1), .stock-header > span:nth-child(1) { flex-basis: 50px; font-weight: 600; text-align: center; color: #6c757d; }
.stock-item > span:nth-child(2), .stock-header > span:nth-child(2) { flex-grow: 1; margin: 0 10px; }
.stock-item > span:nth-child(3), .stock-header > span:nth-child(3) { flex-basis: 60px; text-align: center; font-weight: 600; }
.stock-item .stock-actions, .stock-header > span:nth-child(4) { flex-basis: 150px; text-align: right; }
.stock-buttons button { margin: 5px; }
.some-margin-top { margin-top: 20px; }
#low-stock-list-in-tab li,
#high-stock-list-hommes li,
#high-stock-list-femmes li {
    padding: 4px 0;
    font-size: 0.95em;
    border-bottom: 1px dotted #e0e0e0; /* Zedt ster mnet9et bach nferqo bin les articles */
}
#low-stock-list-in-tab li:last-child,
#high-stock-list-hommes li:last-child,
#high-stock-list-femmes li:last-child {
    border-bottom: none; /* Kan7eydo ster men akhir we7da */
}

/* Loun dyal l-ktaba l-ghlida kayb9a kifma kan */
#low-stock-list-in-tab strong { color: var(--danger-color); }
#high-stock-list-hommes strong, #high-stock-list-femmes strong { color: var(--success-color); } /* Ndiro lih loun khder */

/* --- Autocomplete --- */
.suggestions-container {
    display: none; position: absolute; background-color: #ffffff;
    border: 1px solid var(--grey-border); border-top: none;
    border-radius: 0 0 5px 5px; max-height: 200px; overflow-y: auto;
    width: 100%; z-index: 999; box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}
.suggestion-item { padding: 10px 12px; cursor: pointer; font-size: 14px; }
.suggestion-item:hover { background-color: #f1f3f5; }

/* === Colis Tab & General Table Styles === */
#colis-form, #edit-colis-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px 22px; margin-bottom: 25px; }
#colis-form .form-group, #edit-colis-form .form-group { margin-bottom: 0; }
.form-actions-colis { display: flex; justify-content: flex-end; gap: 10px; margin-top: 10px; grid-column: 1 / -1; }
.form-actions-colis .btn { padding: 10px 18px; font-size: 14px; }
#colis-filters-container, #blacklist-filters-container, #pending-retours-filters-container, #confirmed-retours-filters-container { margin-bottom: 20px; padding: 15px; background-color: #fdfdff; border: 1px solid #eef2f7; border-radius: 6px; display: flex; gap: 15px; align-items: flex-end; flex-wrap: wrap; }
#colis-filters-container label, #blacklist-filters-container label, #pending-retours-filters-container label, #confirmed-retours-filters-container label { font-weight: 500; font-size: 13px; margin-bottom: 4px; display: block; color: #4a5568; }
#colis-filters-container input, #colis-filters-container select, #blacklist-filters-container input, #pending-retours-filters-container input, #confirmed-retours-filters-container input { padding: 9px 12px; border: 1px solid #cbd5e0; border-radius: 5px; font-size:14px; height: 40px; box-sizing: border-box; }
.colis-filter-actions { display: flex; gap: 10px; margin-left: auto; }
.colis-filter-actions .btn { padding: 9px 18px; font-size: 14px; height: 40px; box-sizing: border-box; }
#colis-stats-display {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
    margin-bottom: 25px;
}
#colis-stats-display h4 {
    margin-top: 0; margin-bottom: 15px; text-align: center;
    border-bottom: 1px solid #dee2e6; padding-bottom: 10px;
    font-size: 1.2em; color: #495057; font-weight: 500;
}
.colis-stats-custom-grid {
    display: flex;
    flex-direction: column;
    gap: 10px; /* Espace bin les 3 ster */
}

/* L-ster (Row) */
.stats-row {
    display: grid;
    gap: 12px;
}

/* Ster 1 (7 items) - Kayt-adapté l l-mobile */
.stats-row.row-7 {
    /* 7 items f l-PC, 2 f l-mobile */
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
}

/* Ster 2 (3 items) - Kayt-adapté l l-mobile */
.stats-row.row-3 {
    /* 3 items f l-PC, 1 f l-mobile */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* Ster 3 (2 items) - Kayt-adapté l l-mobile */
.stats-row.row-2 {
    /* 2 items f l-PC, 1 f l-mobile */
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* L-style dyal l-item (bqa kifma kan) */
.colis-stats-custom-grid > .stats-row > div.stat-item {
    background-color: #ffffff;
    padding: 12px 10px;
    border-radius: 6px;
    border: 1px solid #e0e7ff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 75px;
    font-size: 0.85em;
    line-height: 1.3;
    transition: transform 0.15s ease-out, box-shadow 0.15s ease-out;
}
.colis-stats-custom-grid > .stats-row > div.stat-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 3px 6px rgba(0,0,0,0.05);
}
.colis-stats-custom-grid > .stats-row > div.stat-item strong {
    font-size: 1.4em;
    display: block;
    margin-top: 4px;
    font-weight: 600;
    line-height: 1.1;
}

/* Kan-forsiw l-style l-kbir (l-background zre9) l-ster 2 o 3 */
.stats-row.row-3 > div.stat-item,
.stats-row.row-2 > div.stat-item {
    background-color: #eff6ff; 
    font-size:0.9em;
}
.stats-row.row-3 > div.stat-item strong,
.stats-row.row-2 > div.stat-item strong {
    font-size: 1.45em; 
}

/* L-icons (Kifma kano l-merra li fatet) */
.colis-stats-custom-grid .stat-item .fas {
    margin-right: 8px;
    font-size: 0.9em;
    color: #555;
    width: 15px;
    text-align: center;
}
.colis-stats-custom-grid .stat-item .fa-check-circle { color: var(--success-color); }
.colis-stats-custom-grid .stat-item .fa-times-circle { color: var(--warning-color); }
.colis-stats-custom-grid .stat-item .fa-arrow-rotate-left { color: var(--danger-color); }
.colis-stats-custom-grid .stat-item .fa-file-signature { color: var(--info-color); }

/* Hada bach n-msowbo l-design f l-PC (kaykhdem m3a l-code l-foqani) */
@media (min-width: 1200px) {
    /* Ster 1: 7 cols */
    .stats-row.row-7 { 
        grid-template-columns: repeat(7, 1fr); 
    }
    /* Ster 2: 3 cols */
    .stats-row.row-3 { 
        grid-template-columns: repeat(3, 1fr); 
    }
    /* Ster 3: 2 cols */
    .stats-row.row-2 { 
        grid-template-columns: repeat(2, 1fr); 
    }
}

.status-badge { padding: 5px 12px; border-radius: 15px; color: white; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; display: inline-block; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.status-badge.status-en-preparation { background-color: var(--primary-color); }
.status-badge.status-expedie, .status-badge.status-chez-ozonexpress { background-color: var(--warning-color); }
.status-badge.status-livre { background-color: var(--success-color); }
.status-badge.status-annule, .status-badge.status-retourne { background-color: var(--danger-color); }
.status-badge.status-enregistrer-chez-ozon { 
    background-color: var(--info-color); /* Zre9 (b7al info) */
}

.status-badge.status-inconnu { background-color: #6c757d; }
.status-badge.status-inconnu { background-color: #6c757d; }

/* Pagination Controls */
.pagination-controls { text-align: center; margin-top: 25px; padding-top: 15px; border-top: 1px solid #eee;}
.pagination-controls button { margin: 0 3px; background-color: #fff; border: 1px solid var(--grey-border); color: var(--primary-color); padding: 5px 10px; font-size: 13px;}
.pagination-controls button:hover { background-color: #f1f3f5; }
.pagination-controls button:disabled { background-color: #e9ecef; color: #adb5bd; border-color: var(--grey-border); cursor: not-allowed; }

/* --- Statistiques Tab (Générales) --- */
.stats-summary-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 15px; margin-bottom: 20px; padding: 15px;
    background-color: #f9f9f9; border-radius: 8px; border: 1px solid #eee;
}
.stats-summary-grid div {
    background-color: #fff; padding: 12px 15px; border-radius: 5px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1); font-size: 0.95em;
}
.stats-summary-grid strong {
    display: block; font-size: 1.3em; color: var(--primary-color);
    margin-top: 5px; font-weight:600;
}
.charts-container {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 25px; margin-top: 20px; align-items: start;
}
.chart-block {
    background-color: #fff; padding: 20px; border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1); display: flex; flex-direction: column;
}
.chart-block h3 { margin-top: 0; margin-bottom: 15px; text-align: center; font-size: 1.1em; color: #333; }
.chart-block canvas { max-width: 100%; height: auto; flex-grow: 1; }

/* --- Stock Matières & General Table Styles --- */
.matiere-form { border: 1px solid var(--grey-border); padding: 15px; border-radius: 6px; margin-bottom: 20px; }
.matiere-form .form-row { display: flex; gap: 15px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 10px; }
.matiere-form .form-group { margin-bottom: 10px; flex: 1; min-width: 150px;}
.matiere-form button { margin-top: 10px; }
.align-items-end .form-group button { margin-top:0; margin-bottom:0; }
.table-responsive { overflow-x: auto; }
.styled-table {
    width: 100%; border-collapse: collapse; margin: 15px 0; font-size: 0.9em;
    border-radius: 5px; overflow: hidden; box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
}
.styled-table thead tr { background-color: #2a3084; color: #ffffff; text-align: left; font-weight: bold; }
.styled-table th, .styled-table td { padding: 10px 12px; border: 1px solid var(--grey-border); }
.styled-table tbody tr { border-bottom: 1px solid #f0f0f0; }
.styled-table tbody tr:nth-of-type(even) { background-color: #f9f9f9; }
.styled-table tbody tr:last-of-type { border-bottom: 2px solid var(--primary-color); }
.styled-table tbody tr:hover { background-color: #f1f7ff; }
.styled-table button { margin: 0 2px; }
.full-width-table { width: 100%; }
.hr-margin { margin-top: 25px; margin-bottom: 25px; }
.hr-margin-large { margin-top: 35px; margin-bottom: 35px; }
.align-items-end { align-items: flex-end; }
.mr-1 { margin-right: 5px !important; }

/* --- Grossiste Tab Styles --- */
#tab-grossiste .grossiste-order-item { border: 1px solid #e0e0e0; border-radius: 6px; padding: 15px; margin-bottom: 20px; background-color: #fff; box-shadow: 0 2px 5px rgba(0,0,0,0.06); transition: box-shadow 0.2s ease-in-out; }
#tab-grossiste .grossiste-order-item:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.1); }
#tab-grossiste .grossiste-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid #eee; flex-wrap: wrap; }
#tab-grossiste .grossiste-header strong { font-size: 1.05em; font-weight: 600; color: #333; margin-right: 5px;}
#tab-grossiste .grossiste-header span:not(.grossiste-date) { font-weight: normal; font-size: 0.95em; color: #555; }
#tab-grossiste .grossiste-date { font-size: 0.85em; color: #777; text-align: right; flex-shrink: 0; margin-left: 10px; }
#tab-grossiste .grossiste-details { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 15px; font-size: 0.9em; }
#tab-grossiste .grossiste-details > div { background-color: #f8f9fa; padding: 10px; border-radius: 4px; border: 1px solid #e9ecef; text-align: center; }
#tab-grossiste .grossiste-details strong { display: block; font-size: 1.25em; margin-top: 3px; font-weight: 600; }
#tab-grossiste .grossiste-payments { grid-column: span 2; text-align: left; padding-left: 0; background-color: #fff !important; border: none !important; box-shadow: none !important;}
#tab-grossiste .grossiste-payments strong { font-size: 1em; display: inline; font-weight: bold;}
#tab-grossiste .grossiste-payments br { display: none; }
#tab-grossiste .grossiste-payments span { display: block; margin-top: 2px; font-size: 0.9em; }
#tab-grossiste .grossiste-actions { margin-top: 12px; padding-top: 12px; border-top: 1px dashed #ddd; text-align: right; }
#tab-grossiste .grossiste-actions button { margin-left: 6px; }
#tab-grossiste .grossiste-form-style { border: 1px solid #ddd; padding: 20px; border-radius: 6px; background-color: #fdfdfd; }
#grossiste-search-name { padding: 8px 12px; font-size: 14px; }
#grossiste-count-info { font-weight: bold; }
#grossiste-list-container p { padding: 20px; background-color: #f9f9f9; border: 1px dashed #eee; border-radius: 4px; text-align:center; }

/* --- Dashboard Styles --- */
#dashboard-main-area {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 25px;
    margin-top: 25px;
}
#dashboard-charts-section { display: flex; flex-direction: column; gap: 25px; }
#dashboard-sidebar-section { display: flex; flex-direction: column; gap: 25px; }
.kpi-card strong { font-size: 1.8em !important; color: var(--primary-color) !important; }
.list-block { background-color: #fff; padding: 20px; border-radius: 8px; box-shadow: 0 2px 5px rgba(0,0,0,0.1); }
.list-block h3 { margin-top: 0; margin-bottom: 15px; font-size: 1.1em; }
.list-block ul { list-style: none; padding: 0; margin: 0; }
.list-block li { padding: 8px 5px; border-bottom: 1px dotted #eee; font-size: 13px; cursor: pointer; transition: background-color 0.2s; }
.list-block li:hover { background-color: #f1f3f5; }
.list-block li small { display: block; color: #6c757d; }
.list-block ul#dashboard-colis-todo-list .colis-item { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; }
.list-block ul#dashboard-colis-todo-list .colis-item small { color: #888; font-size: 11px; margin-left: 10px; }
@media (max-width: 992px) {
    #dashboard-main-area { grid-template-columns: 1fr; }
}


/* =============================================== */
/* ==       DEBUT: CODE KHASS B MODALS         == */
/* =============================================== */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0; top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
    animation: fadeInModal 0.3s ease-out;
}
.modal-content {
    background-color: #fefefe;
    margin: 8% auto;
    padding: 25px 30px;
    border: 1px solid #bbb;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    position: relative;
    animation: slideInModal 0.3s ease-out;
}
.modal-content.large { max-width: 750px; }
.modal-content h2, .modal-content h3 {
    margin-top:0;
    margin-bottom: 25px;
    padding-bottom: 10px;
    border-bottom: 1px solid #eee;
    font-size: 1.4em;
    text-align: center;
}
.close-modal-button {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
    padding:0;
}
.close-modal-button:hover, .close-modal-button:focus {
    color: black;
    text-decoration: none;
}
.modal-buttons {
    text-align: right;
    margin-top: 30px;
    padding-top: 15px;
    border-top: 1px solid #eee;
}
.modal-buttons button { margin-left: 8px; }

@keyframes fadeInModal {
    from { background-color: rgba(0,0,0,0); }
    to { background-color: rgba(0,0,0,0.5); }
}
@keyframes slideInModal {
    from { transform: translateY(-30px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

#receive-modal-items-list input.qty-received-input {
    width: 80px;
    padding: 6px 8px;
    text-align: center;
    border: 1px solid #ccc;
    border-radius: 4px;
}
#receive-modal-items-list input.qty-received-input:focus { border-color: var(--primary-color); }
.item-status-badge {
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 11px;
    color: white;
    font-weight: bold;
}
.item-status-reçu { background-color: var(--success-color); }
.item-status-non-reçu { background-color: var(--danger-color); }
.item-status-commandé { background-color: var(--info-color); }

/* =============================================== */
/* ==       DEBUT: CODE KHASS B Tba3a         == */
/* =============================================== */

/* F l-affichage l-3adi, la zone de print katkon mkhbiya */
#print-area {
    display: none;
}

/* Melli kanzidou la classe .printing-labels l body, katwqa3 had l-khdma */
body.printing-labels #print-area {
    display: flex !important;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 2000;
    background-color: #e9ecef;
}
/* L-application kamla katkhtafi */
body.printing-labels > #app-container {
    display: none !important;
}
/* Style dyal les boutons foq l-preview */
.print-preview-controls {
    background-color: #343a40;
    color: white;
    padding: 15px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,0.5);
    flex-shrink: 0; /* Bach mayṣgharch */
}
.print-preview-controls h2 { color: white; margin: 0 0 10px 0; border: none; }
.print-preview-controls p { margin: 0 0 15px 0; font-size: 1em; }
#do-print-button { font-size: 1.1em; padding: 10px 20px; }

/* La grille fin kaykono les tickets f l-preview */
.labels-grid-container {
    flex-grow: 1; /* Katkhelli had l-blassa takhod l-espace li b9a */
    overflow-y: auto; /* Ila kano les tickets bzaf, tban scrollbar */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start; /* Bach ibda men l-foq */
    padding: 20px;
}

/* Style dyal kola étiquette (b l-3bar li bghiti) */
.label-ticket {
    border: 1px dashed #666;
    background: white;
    width: 30mm;
    height: 15mm;
    padding: 1mm;
    margin: 2mm;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-family: Arial, sans-serif;
    overflow: hidden;
    position: relative;
}
.label-name { font-size: 9pt; font-weight: bold; line-height: 1.1; text-align: center; word-break: break-word; }
.label-id { font-size: 11pt; font-weight: bold; margin-top: 0.5mm; }
.label-brand { font-size: 5pt; color: #333; position: absolute; bottom: 0.5mm; right: 1mm; }

/* --- Impression dyal Ticket Caisse --- */
#print-content {
    display: none;
}
.status-badge.status-reporte {
    background-color: #6f42c1; /* Loun banafaji (purple) */
}
.modal-buttons .close-modal-button.btn-secondary {
    width: 40px;
    height: 40px;
    padding: 0;
    font-size: 1.2em;
    line-height: 1;
}
/* --- Style pour les icônes des onglets --- */
.nav-tab-button .fas {
    margin-right: 8px;  /* Zid espace bin l-icone o l-ktaba */
    width: 1.2em;       /* Bach ikono l-icônes m alignyin mezyan */
    text-align: center;
}
/* Hada l-code jdid bach l'icône dyal l'onglet l-actif itbeddel lih l-loun */
.nav-tabs .nav-tab-button.active .fas {
    color: #6f42c1; /* Loun banafaji (VIOLET) */
}
/* ======================================================================= */
/* ==       CODE NIHA2I o SA7I7 L-TBA3A (VERSION ANTI-PAGE-BLANCHE)     == */
/* ======================================================================= */
@media print {

    /* ===== DEBUT: CODE DYAL TICKET DYAL LA CAISSE (#print-content) ===== */
    /* Hada kan-definiw lih 3bar dyal ticket 58mm 3adi */
    @page caisse-receipt {
        size: 58mm auto; /* 3bar 3adi dyal ticket caisse */
        margin: 2mm;
    }

    /* Hada howa l-code dyal tba3a dyal l-étiquettes (Saisie Sorties) */
    @page label-sticker {
        size: 30mm 15mm;
        margin: 0;
    }

    /* Kan-forciw l-alwan */
    body {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    /* Kan-khbiw kolchi f lewel */
    body > * {
        display: none !important;
    }

    /* Kan-biyyeno GHI L BLASSA LI BGHINA N-IMPRIMIW */
    /* L code hna kay-ferre9 bin l caisse o l étiquettes */
    
    #print-content, #print-content * {
        display: block !important;
        font-family: 'Courier New', Courier, monospace !important;
        font-size: 8pt !important;
        color: black !important;
        background: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
    #print-area, #print-area * {
        display: block !important;
    }

    /* ====== STYLE L TICKET CAISSE (#print-content) ====== */
    #print-content {
        page: caisse-receipt; /* Kan-applikw l 3bar dyal l caisse */
        width: 58mm;
        margin: 0 auto !important;
    }
    #print-content .logo { max-width: 30px !important; max-height: 15px !important; margin: 0 auto 1mm auto !important; }
    #print-content h2 { font-size: 9pt !important; text-align: center !important; margin-bottom: 1mm !important; border: none !important; }
    #print-content #print-items div { display: flex !important; justify-content: space-between !important; font-size: 8pt !important; line-height: 1.2 !important; }
    #print-content .print-totals { margin-top: 1mm !important; border-top: 1px dashed #000 !important; padding-top: 0.5mm !important; font-size: 8pt !important; }
    #print-content .print-totals div { display: flex !important; justify-content: space-between !important; }
    #print-content .print-totals div:last-child { font-size: 9pt !important; font-weight: bold !important; margin-top: 0.5mm !important; }
    #print-content #print-discount-container { display: flex !important; }
    #print-content p { font-size: 7pt !important; text-align: center !important; margin: 1mm 0 !important; }
    #print-content p#print-date-p { font-size: 6pt !important; }
    

    /* ====== STYLE L ÉTIQUETTES (.label-ticket) ====== */
    .print-preview-controls { display: none !important; }
    .labels-grid-container { margin: 0 !important; padding: 0 !important; display: block !important; }

    .label-ticket {
        page: label-sticker; /* Kan-applikw l 3bar dyal l étiquette */
        background-color: white !important;
        color: black !important;
        border: none !important;
        margin: 0 !important;
        padding: 1mm 1.5mm !important;
        page-break-after: always;
        display: flex !important;
        flex-direction: column !important;
        justify-content: center !important;
        align-items: center !important;
        width: 30mm;
        height: 15mm;
        box-sizing: border-box !important;
        position: relative !important; /* Mohim l VOLCHIK */
        overflow: hidden !important;
        font-family: Arial, sans-serif !important;
    }
    
    .label-name {
        font-size: 11pt !important; /* Sggher men 25pt */
        font-weight: bold !important;
        line-height: 1.1 !important;
        color: black !important;
        text-align: center !important;
        margin-bottom: 1mm !important;
        position: static !important; /* N7eydo ay position 9dima */
    }

    .label-id {
        font-size: 11pt !important; /* Sggher men 25pt */
        font-weight: bold !important;
        color: black !important;
        position: static !important;
        margin-top: 0 !important;
    }
    
    .label-brand {
        font-size: 6pt !important; /* Sghir */
        font-weight: normal !important;
        color: #333 !important;
        position: absolute !important; /* Nrdoha absolute */
        bottom: 1mm !important; 
        right: 1.5mm !important; 
        align-self: unset !important;
        margin-top: unset !important;
    }
    /* ========================================================== */
    /* ==   FIN: CODE JDID L ÉTIQUETTES (SAISIE SORTIES)       == */
    /* ========================================================== */
}

    /* ========================================================== */
    /* == DEBUT: CODE JDID L TBA3A DYAL TICKET (30mm x 15mm) == */
    /* ========================================================== */

    /* Kan-definew l 3bar dyal l ticket */
    @page ticket-page { /* Smiyya jdida bach maytkhletech m3a les étiquettes */
        size: 30mm 15mm;
        margin: 0;
    }

    /* Kan-applikw dak l 3bar 3la l blassa dyal tba3a dyal ticket */
    #print-content {
        page: ticket-page; /* Kansta3mlo smiyya li definina lfoq */
        display: flex !important;
        flex-direction: column !important;
        width: 30mm;
        height: 15mm;
        box-sizing: border-box !important;
        padding: 1mm 1.5mm !important; /* Chwiya dyal padding f jenab */
        margin: 0 !important;
        font-family: Arial, sans-serif !important;
        color: black !important;
        background-color: white !important;
        overflow: hidden !important; /* Bach maykhrjch l contenu */
        page-break-after: always; /* Bach kol ticket f werqa */
    }

    #print-content * {
        color: black !important;
        background: none !important;
        line-height: 1.1 !important; /* N9erbo stor l b3diyathom */
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Logo sghir bzzaf */
    #print-content .logo {
        max-width: 15px !important;
        max-height: 8px !important;
        margin: 0 auto 0.5mm auto !important;
        display: block !important;
    }

    /* 3onwan sghir */
    #print-content h2 {
        font-size: 7pt !important;
        text-align: center !important;
        font-weight: bold !important;
        margin-bottom: 0.5mm !important;
        border: none !important;
    }

    /* Les articles */
    #print-content #print-items {
        font-size: 6pt !important; /* Sggher l ktba dyal les articles */
        flex-grow: 1; /* Bach takhod blassa li b9at */
        overflow: hidden; /* Ila kano bzzaf, maykhrjoch */
        border-top: 1px dashed #666;
        border-bottom: 1px dashed #666;
        margin: 0.5mm 0 !important;
        padding: 0.5mm 0 !important;
    }

    #print-content #print-items div {
        display: flex !important;
        justify-content: space-between !important;
    }

    /* Les totaux f lekher */
    #print-content .print-totals {
        font-size: 6.5pt !important; /* Homa kber chwiya men les articles */
        margin-top: 0.5mm !important;
    }
    #print-content .print-totals div {
         display: flex !important;
         justify-content: space-between !important;
    }
     #print-content .print-totals strong {
        font-weight: bold !important;
     }
    /* Total final ikon ghliḍ */
    #print-content .print-totals div:last-child {
        font-weight: bold !important;
        font-size: 7pt !important; /* Kber chwiya */
        margin-top: 0.5mm !important;
    }

    /* Remise (ila kayna) */
    #print-content #print-discount-container {
        font-size: 6pt !important;
    }

    /* Merci o date */
    #print-content p {
        font-size: 5pt !important; /* Sghar bzzaf */
        text-align: center !important;
        margin-top: 0.5mm !important;
    }
    #print-content p#print-date-p { /* ID jdid l date */
         font-size: 4.5pt !important;
    }

    /* ========================================================== */
    /* ==   FIN: CODE JDID L TBA3A DYAL TICKET (30mm x 15mm)   == */
    /* ========================================================== */

}
/* ================================================== */
/* ==       STYLES POUR LE COMBOBOX PERSONNALISÉ       == */
/* ================================================== */

.combobox-container {
    position: relative;
}

.combobox-input {
    width: 100%;
    padding-right: 30px; /* Bach nkhliw blassa l flèche */
    cursor: pointer;
}

.combobox-arrow {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #888;
    pointer-events: none; /* Bach l-click idouz l l-input */
}

.combobox-options {
    display: none;  /* <-- HADA HOWA STER L-MOHIM */
    position: absolute;
    background-color: white;
    border: 1px solid var(--grey-border);
    border-radius: 5px;
    width: 100%;
    max-height: 250px;
    overflow-y: auto;
    z-index: 1001; /* Khasso ikon foq kolchi */
    margin-top: 4px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.combobox-option-item, .combobox-add-new {
    padding: 10px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
}

.combobox-option-item:last-child {
    border-bottom: none;
}

.combobox-option-item:hover {
    background-color: #f1f3f5;
}

.combobox-add-new {
    background-color: #e8f9f3;
    color: var(--success-color);
    font-weight: bold;
    text-align: center;
}
.combobox-add-new:hover {
    background-color: #d1f3e5;
}
.status-badge.status-partiellement-reçu {
    background-color: var(--info-color); /* Loun zre9 bhal dyal l-info */
}

/* ============================================= */
/* ==       STYLES POUR LE WIDGET DE CHAT (Final) == */
/* ============================================= */

/* Main widget container */
#chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 320px;
    border: 1px solid var(--grey-border);
    border-radius: 8px 8px 0 0;
    background-color: #fff;
    box-shadow: 0 -2px 15px rgba(0,0,0,0.1);
    z-index: 1050;
    font-size: 14px;
    transition: all 0.3s ease-in-out;
}

/* Chat Header */
#chat-header {
    background-color: #2a3084;
    color: white;
    padding: 12px 15px;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#chat-header:hover {
    background-color: #3c449a;
}

#chat-header-title {
    display: flex;
    align-items: center;
}

#chat-header-title .fa-comments {
    margin-right: 8px;
}

/* Back Button */
#chat-back-to-users {
    background: none;
    border: none;
    color: white;
    font-size: 1.1em;
    cursor: pointer;
}

/* Chat Body */
#chat-body {
    height: 350px;
    display: flex;
    flex-direction: column;
}

/* User List */
#chat-user-list {
    overflow-y: auto;
    flex-grow: 1;
}

.chat-user-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 10px;
    position: relative; /* Mohim bach n9ado noqta l-7emra */
}

.unread-dot {
    position: absolute;
    right: 15px; /* B3ida chwiya 3la l-jnb */
    top: 50%;
    transform: translateY(-50%);
    width: 10px;  /* L-3bar dyalha */
    height: 10px; /* L-3bar dyalha */
    background-color: var(--danger-color); /* Loun 7mer */
    border-radius: 50%; /* Bach tkon dayra */
    border: 1px solid white; /* Bach tban mzyan foq l-khel */
    box-shadow: 0 0 5px var(--danger-color);
}

.chat-user-item:hover {
    background-color: #f5f5f5;
}

/* Message Area */
#chat-message-area {
    display: none; /* Shown by JS */
    flex-direction: column;
    height: 100%;
}

/* Container for all message bubbles */
#chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 15px 10px;
    background-color: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Base style for a single message bubble */
.chat-message {
    padding: 10px 16px;
    line-height: 1.4;
    max-width: 80%;
    width: fit-content;
}

/* Sent messages (aligned right) */
.chat-message.sent {
    background-color: #007bff;
    color: white;
    border-radius: 999px 4px 4px 999px; /* Pill shape with tail */
    align-self: flex-end; /* This is the key for right alignment */
}

/* Received messages (aligned left) */
.chat-message.received {
    background-color: #e9ecef;
    color: var(--text-color);
    border-radius: 4px 999px 999px 4px; /* Pill shape with tail */
    align-self: flex-start; /* This is the key for left alignment */
}

/* Timestamp under the message */
.message-meta {
    font-size: 0.75em;
    color: #aaa;
    margin-top: 5px;
    display: block;
}

.chat-message.sent .message-meta {
    color: rgba(255, 255, 255, 0.7);
}

/* Message input form */
#chat-form {
    display: flex;
    border-top: 1px solid var(--grey-border);
}

#chat-message-input {
    flex-grow: 1;
    border: none;
    padding: 12px;
    font-size: 14px;
}

#chat-message-input:focus {
    outline: none;
}

#chat-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0 15px;
    font-size: 16px;
    cursor: pointer;
}

/* ---- Collapsed "Circle" Button State ---- */
#chat-widget.collapsed {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    right: 25px;
    bottom: 25px;
    overflow: visible;
}

#chat-widget.collapsed #chat-body {
    display: none;
}

#chat-widget.collapsed #chat-header {
    padding: 0;
    justify-content: center;
    height: 100%;
    width: 100%;
    border-radius: 50%;
}

#chat-widget.collapsed .chat-header-text,
#chat-widget.collapsed #chat-conversation-with,
#chat-widget.collapsed #chat-back-to-users {
    display: none;
}

#chat-widget.collapsed #chat-header-title .fa-comments {
    margin-right: 0;
    font-size: 26px;
}

/* Notification Badge */
#chat-notification-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background-color: var(--danger-color);
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: none;
    justify-content: center;
    align-items: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
}

/* JS will add this class to show the badge */
#chat-widget.has-new-message #chat-notification-badge {
    display: flex;
}

/* ======================================================= */
/* ==       DEBUT: STYLES RESPONSIVES (MOBILE)         == */
/* ======================================================= */
@media (max-width: 768px) {
    /* Kanqado l-widget dyal l-chat f mobile */
    #chat-widget {
        width: 100%;
        right: 0;
        bottom: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
    }

    #chat-widget #chat-header {
        border-radius: 0;
    }

    /* Melli ikoun mseddoud, kan-rje3oh l blasto l-asliya */
    #chat-widget.collapsed {
        width: 60px;
        height: 60px;
        border-radius: 50%;
        right: 20px;
        bottom: 20px;
    }
}
#chat-widget.has-new-message.collapsed #chat-header {
    animation: pulse-animation 2s infinite;
}

@keyframes pulse-animation {
    0% {
        box-shadow: 0 0 0 0 rgba(255, 82, 82, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(255, 82, 82, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 82, 82, 0);
    }
}
#chat-header {
    cursor: pointer;
}
/* Style l online/offline status */
.chat-user-item .fa-circle {
    font-size: 10px;
    color: #ccc; /* Offline by default (Rmadi) */
    transition: color 0.3s ease;
}
.chat-user-item.online .fa-circle {
    color: var(--success-color); /* Loun khder l online */
}

.is-hidden {
    display: none !important;
}
.chat-user-item {
    position: relative; /* Mohim bach n9ado noqta l-7emra */
}

.unread-dot {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    background-color: var(--danger-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 11px;
    font-weight: bold;
    border: 2px solid white;
}
.high-stock-columns-container {
    display: flex;               /* Hada howa l-mohim, kaydirhom 7da b3diyathom */
    justify-content: space-between;/* Bach i b3edhom chwiya */
    gap: 30px;                   /* Espace bin les colonnes */
    margin-top: 15px;
}

/* Style dyal kolla colonne (Hommes / Femmes) */
.high-stock-column {
    flex: 1;            /* Bach kolla colonne takhod nefs l 3bar */
    min-width: 0;     /* Mohim bach l flexbox maykherbe9ch l'affichage */
}

/* N7eydo l margin l fo9ani men les titres dyal les colonnes */
.high-stock-column h5 {
    margin-top: 0;
}

/* Hada bach irje3 l'affichage 3adi (wa7ed te7t wa7ed) f les téléphones */
@media (max-width: 768px) {
    .high-stock-columns-container {
        flex-direction: column; /* Iwelliw wa7ed te7t wa7ed */
        gap: 20px;
    }
}
.inventaire-item-wizard {
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
}

#inventaire-summary-container .styled-table {
    margin-top: 0;
}
.newly-added {
    background-color: #e8f9f3 !important; /* Loun khder bared */
    transition: background-color 0.5s ease;
}/* ===== DEBUT: STYLE JDID L RÉSUMÉ DYAL L COMMANDE D'HUILE ===== */

#new-order-summary-container h5 {
    margin-top: 0;
    text-align: center;
    margin-bottom: 10px;
    border-bottom: 1px solid #d1e7ff;
    padding-bottom: 8px;
    font-size: 1.1em;
    color: #004085;
}

#new-order-summary-container .summary-grid {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    text-align: center;
    font-size: 0.95em;
}
#new-order-summary-container .summary-grid strong {
    font-size: 1.2em;
    display: block;
}
#new-order-summary-container .summary-total {
    width: 100%;
    border-top: 1px dashed #9ec5fe;
    margin-top: 10px;
    padding-top: 10px;
    font-size: 1.1em;
    font-weight: bold;
}
#new-order-summary-container .summary-total strong {
    color: var(--success-color);
    font-size: 1.2em;
}
.product .print-select-checkbox {
    margin-right: 15px; /* Espace bin checkbox o smiya */
    transform: scale(1.3); /* Nkebbroha chwiya */
    cursor: pointer;
}

#print-selection-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 15px;
    margin-top: 15px;
}

.print-selection-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background-color: #fff;
    padding: 8px 12px;
    border-radius: 5px;
    border: 1px solid #cce5ff;
}

.print-selection-item .item-name {
    flex-grow: 1;
    font-size: 0.9em;
}

.print-selection-item .qty-input {
    width: 70px;
    padding: 6px;
    text-align: center;
    font-weight: bold;
    border: 1px solid #ccc;
    border-radius: 4px;
}
/* ===== DEBUT: STYLE JDID L'ONGLET DICTIONNAIRE (KAMEL) ===== */

#dict-filters {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap; /* Bach irje3 l ster f telephone */
}
.dict-filter-btn {
    background-color: var(--light-grey);
    border: 1px solid var(--grey-border);
    color: #555;
    font-weight: 500;
}
.dict-filter-btn:hover {
    background-color: #e2e6ea;
}
.dict-filter-btn.active {
    background-color: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

#dict-search-input-container {
    position: relative;
    max-width: 600px;
    margin: 0 auto 30px auto;
}
#dict-search-input-container .fa-search {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #999;
}
#dict-search-input {
    width: 100%;
    padding: 12px 15px 12px 40px;
    font-size: 1.1em;
    border-radius: 25px;
    border: 1px solid var(--grey-border);
}

#dict-catalogue-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.dict-card {
    background-color: #fdfdfd;
    border: 1px solid var(--grey-border);
    border-radius: 8px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.dict-card-img {
    width: 100%;
    height: 180px;
    background-color: #eee;
    background-size: cover;
    background-position: center;
    color: #aaa;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dict-card-img-placeholder::before {
    content: "images/parfums/ID.jpg";
    font-size: 0.9em;
    font-style: italic;
    color: #999;
}

.dict-card-body {
    padding: 15px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}
.dict-card-title {
    font-size: 1.2em;
    font-weight: 600;
    color: var(--primary-color);
    margin: 0 0 5px 0;
}
.dict-card-id {
    font-size: 0.9em;
    font-weight: bold;
    color: #777;
    margin-bottom: 10px;
}
.dict-card-desc {
    font-size: 0.95em;
    line-height: 1.5;
    color: #333;
    direction: rtl;
    text-align: right;
    white-space: pre-wrap;
    flex-grow: 1;
    min-height: 60px; /* Bch ikon 3ndhom 9ed we7ed */
}
.dict-card-actions {
    padding: 0 15px 15px 15px;
    text-align: right;
}

.dict-card-rating {
    margin-bottom: 15px;
    text-align: center;
}
.star-rating .fa-star {
    font-size: 1.3em;
    color: #ccc;
    cursor: pointer;
    transition: color 0.2s;
    margin: 0 2px;
}
.star-rating .fa-star.rated,
.star-rating:hover .fa-star {
    color: #ffc107;
}
.star-rating:hover .fa-star:hover ~ .fa-star {
    color: #ccc;
}
/* =============================================== */
/* ==   DEBUT: STYLES L-MODAL DYAL "AJOUTER PACK" == */
/* =============================================== */

/* Style l l-layout dyal l-modal (2 colonnes) */
.create-pack-layout {
    display: flex;
    gap: 20px;
    margin-top: 15px;
    height: 400px; /* 3tina 3bar l-l-modal */
}
.perfume-selection-container {
    flex: 2; /* L-colonne dyal l-ikhtiyar kbira */
    display: flex;
    flex-direction: column;
    border: 1px solid #ccc;
    border-radius: 5px;
}
.perfume-selected-container {
    flex: 1; /* L-colonne dyal dakchi li t-khtar sghira */
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 5px;
    display: flex;
    flex-direction: column;
}
.perfume-selected-container h5 {
    margin: 0;
    padding: 12px 15px;
    background-color: #e9ecef;
    border-bottom: 1px solid #dee2e6;
}

/* Style l l-barre de recherche west l-modal */
#pack-perfume-search {
    width: 100%;
    padding: 10px 15px;
    border: none;
    border-bottom: 1px solid #ccc;
    box-sizing: border-box;
}

/* Style l la liste dyal les parfums */
#pack-perfume-selection-grid {
    overflow-y: auto;
    flex-grow: 1;
}
.pack-perfume-item {
    padding: 8px 12px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.pack-perfume-item:hover {
    background-color: #e7f5ff;
}
.pack-perfume-item.selected {
    background-color: #f0f0f0;
    color: #888;
    text-decoration: line-through;
    cursor: not-allowed;
}
.pack-perfume-item small {
    color: #888;
}

/* Style l la liste dyal les parfums li t-khtaro */
#pack-selected-perfumes {
    overflow-y: auto;
    flex-grow: 1;
    padding: 10px;
}
#pack-selected-perfumes p {
    text-align: center;
    color: #888;
    margin-top: 20px;
}
.pack-selected-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: white;
    padding: 8px 10px;
    border-radius: 4px;
    margin-bottom: 5px;
    font-size: 0.9em;
}
.pack-selected-item button {
    padding: 2px 6px;
    font-size: 10px;
}

/* Style l l-affichage dyal contenu d pack f Dictionnaire */
.dict-pack-contents {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed var(--grey-border);
}
.dict-pack-contents strong {
    font-size: 0.9em;
    color: #333;
}
.dict-pack-contents ul {
    margin: 5px 0 0 0;
    padding-left: 20px;
    font-size: 0.9em;
}
.dict-pack-contents li {
    color: #555;
}
.dict-pack-contents {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed var(--grey-border);
}
.dict-pack-contents strong {
    font-size: 0.9em;
    color: #333;
    margin-bottom: 5px;
    display: block;
}

/* Hadi hiya l-blassa fin kaynin les mini-cartes */
.dict-pack-items-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 250px; /* Bach maykonch twil bzaf */
    overflow-y: auto;
    padding: 5px;
}
.dict-pack-item-detail {
    background: #f8f9fa;
    border-radius: 4px;
    padding: 8px 10px;
    border: 1px solid #eee;
}
.dict-pack-item-detail strong {
    font-size: 0.9em;
    color: var(--primary-color);
    margin-bottom: 0;
}
.dict-pack-item-detail p {
    font-size: 0.85em;
    color: #555;
    margin: 5px 0 0 0;
    line-height: 1.4;
    direction: rtl; /* Bch description tban mzyan */
    text-align: right;
}

/* L-code dyal nejmat sghar */
.star-rating-mini {
    font-size: 0.8em;
    color: #ccc;
    margin-top: 2px;
}
.star-rating-mini .fas.fa-star {
    color: #ffc107;
}

/* Nsghro l-boutons dyal l-actions chwiya */
.dict-card-actions {
    display: flex;
    justify-content: flex-end;
    gap: 5px;
    flex-wrap: wrap; /* Ila kano bzaf */
}
.dict-card-actions .btn {
    font-size: 11px;
    padding: 4px 8px;
}
.toggle-btn-group {
    display: flex; /* Bach ijiw we7ed 7da we7ed */
    border-radius: 5px;
    overflow: hidden; /* Bach i-forcer l-border-radius 3la l-boutons */
    border: 1px solid #ced4da;
    width: fit-content; /* L-3bar 3la 9ed l-boutons */
}

.toggle-btn {
    background-color: var(--light-grey);
    color: #495057;
    border: none;
    padding: 10px 15px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
}

/* Ster bin l-boutons */
.toggle-btn:not(:last-child) {
    border-right: 1px solid #ced4da;
}

/* Hada howa l-style dyal l-bouton li m-cliké 3lih (l-actif) */
.toggle-btn[data-active="true"] {
    background-color: var(--primary-color);
    color: white;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.2);
}

/* L-style mnin t-hoveri 3la bouton li ma m-clikich 3lih */
.toggle-btn:not([data-active="true"]):hover {
    background-color: #e9ecef;
}
.quick-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px; /* L-espace bin l-boutons */
    margin-top: 8px; /* Yb3ed 3la l-input l-foqani */
    margin-bottom: 15px; /* Yb3ed 3la dakchi li te7to */
}

.quick-btn {
    background-color: #f1f3f5; /* Loun b7al l-khalfia */
    border: 1px solid #ced4da; /* L-contour */
    border-radius: 20px; /* Bach yjiw dayrin (pill shape) */
    padding: 5px 12px;
    font-size: 13px;
    font-weight: 500;
    color: #495057;
    cursor: pointer;
    transition: all 0.2s ease;
}

.quick-btn:hover {
    background-color: #e9ecef; /* Loun melli t-hoveri */
    border-color: #adb5bd;
}
.sillage-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 15px;
    font-size: 11px;
    font-weight: bold;
    color: white;
    margin-top: 5px;
    text-transform: uppercase;
}
.sillage-tag.khfif { background-color: #007bff; }
.sillage-tag.moyen { background-color: #28a745; }
.sillage-tag.9aseh { background-color: #dc3545; }
.sillage-tag.unknown { background-color: #6c757d; }

/* === 2. L-LABEL (L-Boutons f l-Modal dyal Edit) === */
.sillage-radio-group { display: flex; gap: 10px; flex-wrap: wrap; }
.sillage-radio-group input[type="radio"] { display: none; }
.sillage-radio-group .sillage-label { padding: 8px 15px; border: 2px solid #ddd; border-radius: 20px; cursor: pointer; transition: all 0.2s ease; font-size: 13px; }
.sillage-label.sillage-khfif { border-color: #007bff; }
.sillage-label.sillage-moyen { border-color: #28a745; }
.sillage-label.sillage-9aseh { border-color: #dc3545; }
.sillage-radio-group input[type="radio"]:checked + .sillage-label { color: white; }
.sillage-radio-group input[type="radio"]:checked + .sillage-label.sillage-khfif { background-color: #007bff; }
.sillage-radio-group input[type="radio"]:checked + .sillage-label.sillage-moyen { background-color: #28a745; }
.sillage-radio-group input[type="radio"]:checked + .sillage-label.sillage-9aseh { background-color: #dc3545; }
.sillage-tag[class*="9aseh"] {
    background-color: #dc3545 !important;  /* Loun 7mer (Danger) */
    color: #ffffff !important;             /* Lktaba byda */
}
#colis-filters-container {
    align-items: flex-end; 
}

/* L-blassa dyal l-bouton "Scan Expédition" */
.colis-scanner-action {
    margin-left: 15px; /* Yb3ed 3la l-actions l-khrin */
    padding-bottom: 0px; /* BGHITIH YJI TALI 3LA L-BOUTONS L-KHRIN (0px) */
}
.colis-scanner-action label {
    font-weight: 500;
    font-size: 13px;
    margin-bottom: 4px;
    display: block;
    color: #4a5568;
    text-align: center;
}
.colis-scanner-action .btn {
    width: 100%;
    min-width: 60px;
    height: 40px; /* B7al l-boutons l-khrin */
    font-size: 1.2em; /* Nkebbro l-camera chwiya */
}
.status-badge.status-annule, .status-badge.status-retourne { background-color: var(--danger-color); }
.status-badge.status-chez-ozonexpress { background-color: var(--warning-color); }

/* === ZID HADI HNA === */
.status-badge.status-enregistrer-chez-ozon { 
    background-color: var(--info-color); /* Zre9 (b7al info) */
}

.status-badge.status-inconnu { background-color: #6c757d; }
.dict-section-title {
    width: 100%;
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    color: #2a3084; /* Nefs loun l-header */
    font-size: 1.4em;
    font-weight: bold;
    clear: both;
}

/* L-Grid sghira li ghatkun ta7t kol titre */
.dict-section-title {
    width: 100%;
    margin: 30px 0 15px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #e9ecef;
    color: #2a3084;
    font-size: 1.4em;
    font-weight: bold;
    clear: both;
}

/* HADA HOWA L-MODIFICATION L-MOHIMMA */
.dict-sub-grid {
    display: grid;
    /* auto-fill: Hada howa li kaykhlli les cartes sghar wakha tkon ghir we7da */
    /* 220px: Sgherna l-3bar chwiya bach yban compact */
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); 
    gap: 15px;
    margin-bottom: 40px;
}