
/* =========================================
   STOCKFLOW - DESIGN GLOBAL
========================================= */

:root {
    --navy: #17243b;
    --navy-light: #22334f;
    --primary: #20b6a7;
    --primary-dark: #159688;
    --background: #f5f7fb;
    --white: #ffffff;
    --text: #263449;
    --muted: #8793a6;
    --border: #e8edf3;
    --danger: #e45b68;
    --success: #169b78;
    --shadow: 0 5px 25px rgba(26, 42, 68, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: "Segoe UI", Arial, sans-serif;
    background: var(--background);
    color: var(--text);
    font-size: 14px;
}

button,
input,
textarea {
    font: inherit;
}

/* =========================================
   STRUCTURE
========================================= */

.dashboard {
    display: flex;
    min-height: 100vh;
}

/* =========================================
   SIDEBAR
========================================= */

.sidebar {
    width: 255px;
    background: var(--navy);
    color: white;
    padding: 30px 20px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 5px;
    margin-bottom: 55px;
}

.brand-icon {
    width: 43px;
    height: 43px;
    border-radius: 12px;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 23px;
    font-weight: 800;
    color: white;
}

.brand h2 {
    font-size: 20px;
    letter-spacing: 0.3px;
}

.brand span {
    font-size: 10px;
    color: #aab6c8;
}

.sidebar-label {
    font-size: 10px;
    font-weight: 700;
    color: #8492a8;
    letter-spacing: 1.3px;
    padding: 0 10px;
    margin-bottom: 15px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 13px;
    color: #b7c2d3;
    text-decoration: none;
    padding: 13px 14px;
    border-radius: 9px;
    transition: 0.25s;
    font-weight: 500;
}

.nav-icon {
    font-size: 20px;
    width: 22px;
    text-align: center;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(32, 182, 167, 0.16);
    color: #ffffff;
}

.nav-link.active {
    border-left: 3px solid var(--primary);
}

.sidebar-bottom {
    margin-top: auto;
}

.sidebar-help {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: var(--navy-light);
    padding: 14px;
    border-radius: 10px;
    margin-bottom: 22px;
}

.help-icon {
    width: 25px;
    height: 25px;
    background: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.sidebar-help strong {
    font-size: 12px;
}

.sidebar-help p {
    font-size: 11px;
    color: #aab6c8;
    margin-top: 5px;
    line-height: 1.5;
}

.sidebar-version {
    font-size: 10px;
    text-align: center;
    color: #8492a8;
}

/* =========================================
   CONTENU PRINCIPAL
========================================= */

.main-content {
    flex: 1;
    min-width: 0;
    padding: 35px 45px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    margin-bottom: 32px;
}

.breadcrumb {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 9px;
}

.topbar h1 {
    font-size: 27px;
    color: var(--navy);
    margin-bottom: 6px;
}

.page-subtitle {
    color: var(--muted);
    font-size: 13px;
}

.profile {
    display: flex;
    align-items: center;
    gap: 11px;
}

.profile-avatar {
    width: 43px;
    height: 43px;
    border-radius: 50%;
    background: #dff5f1;
    color: var(--primary-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 17px;
    font-weight: 700;
}

.profile strong,
.profile span {
    display: block;
}

.profile strong {
    font-size: 12px;
}

.profile span {
    color: var(--muted);
    font-size: 11px;
    margin-top: 4px;
}

/* =========================================
   STATISTIQUES
========================================= */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    margin-bottom: 27px;
}

.stat-card {
    background: var(--white);
    padding: 22px;
    border-radius: 13px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.stat-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 19px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
}

.stat-icon.purple {
    background: #f0eaff;
    color: #8560d8;
}

.stat-icon.blue {
    background: #e6f1ff;
    color: #4385d8;
}

.stat-icon.green {
    background: #e1f7ef;
    color: #159b78;
}

.stat-label {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.8px;
}

.stat-card h2 {
    font-size: 27px;
    color: var(--navy);
    margin-bottom: 6px;
}

.stat-card h2 small {
    font-size: 13px;
}

.stat-card p {
    color: var(--muted);
    font-size: 12px;
}

/* =========================================
   CARTES DE CONTENU
========================================= */

.content-card {
    background: var(--white);
    padding: 27px;
    border-radius: 13px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    margin-bottom: 25px;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

.section-eyebrow {
    font-size: 10px;
    color: var(--primary-dark);
    font-weight: 700;
    letter-spacing: 1.2px;
}

.section-heading h2 {
    color: var(--navy);
    font-size: 19px;
    margin: 7px 0;
}

.section-heading p {
    color: var(--muted);
    font-size: 12px;
}

.heading-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    background: #e5f7f4;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 25px;
}

.product-count {
    background: #e5f7f4;
    color: var(--primary-dark);
    padding: 8px 13px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
}

/* =========================================
   FORMULAIRES
========================================= */

.product-form {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 19px;
}

.form-group label {
    display: block;
    margin-bottom: 9px;
    font-size: 12px;
    font-weight: 650;
    color: var(--text);
}

.form-group label span {
    color: var(--danger);
}

.form-group input,
.form-group textarea {
    width: 100%;
    border: 1px solid var(--border);
    background: #fbfcfe;
    border-radius: 8px;
    padding: 12px 14px;
    color: var(--text);
    outline: none;
    transition: 0.2s;
}

.form-group input {
    height: 45px;
}

.form-group textarea {
    resize: vertical;
    min-height: 110px;
}

.form-group input:focus,
.form-group textarea:focus {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 0 0 3px rgba(32, 182, 167, 0.11);
}

.form-group input::placeholder {
    color: #aab4c2;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 11px;
    margin-top: 5px;
}

.btn-primary,
.btn-secondary {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 7px;
    padding: 12px 19px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 650;
    text-decoration: none;
    cursor: pointer;
    transition: 0.2s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    border: 1px solid var(--primary);
}

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    transform: translateY(-1px);
}

.btn-secondary {
    background: white;
    border: 1px solid var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: #f2f5f8;
}

/* =========================================
   TABLEAU DES PRODUITS
========================================= */

.products-section {
    padding-bottom: 15px;
}

.table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.products-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    white-space: nowrap;
}

.products-table th {
    background: #f7f9fc;
    color: #7d8ba0;
    padding: 15px 13px;
    font-size: 10px;
    letter-spacing: 0.6px;
    font-weight: 700;
    border-bottom: 1px solid var(--border);
}

.products-table td {
    padding: 16px 13px;
    border-bottom: 1px solid #eef1f5;
    font-size: 12px;
}

.products-table tbody tr {
    transition: 0.2s;
}

.products-table tbody tr:hover {
    background: #f9fcfd;
}

.id-cell {
    color: var(--muted);
    font-weight: 600;
}

.product-name {
    display: flex;
    align-items: center;
    gap: 10px;
}

.product-name strong {
    color: var(--navy);
}

.product-avatar {
    width: 34px;
    height: 34px;
    background: #e5f7f4;
    color: var(--primary-dark);
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
}

.description-cell {
    color: var(--muted);
    max-width: 190px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.price-cell {
    color: var(--navy);
    font-weight: 700;
}

.quantity-badge {
    background: #eaf7f1;
    color: #159b78;
    border-radius: 6px;
    padding: 6px 10px;
    font-weight: 700;
}

.action-buttons {
    display: flex;
    align-items: center;
    gap: 7px;
}

.action-buttons form {
    margin: 0;
}

.btn-edit,
.btn-delete {
    padding: 8px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 650;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: 0.2s;
}

.btn-edit {
    background: #e8f2ff;
    color: #3477c6;
}

.btn-edit:hover {
    background: #d7e8ff;
}

.btn-delete {
    background: #fff0f0;
    color: var(--danger);
}

.btn-delete:hover {
    background: #ffdddd;
}

.empty-state {
    text-align: center;
    color: var(--muted);
    padding: 35px !important;
}

/* =========================================
   MESSAGES
========================================= */

.alert {
    padding: 13px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 13px;
    font-weight: 600;
}

.success-alert {
    background: #e9f8f1;
    color: #14835f;
    border: 1px solid #cceede;
}

.error-alert {
    background: #fff0f0;
    color: #cc414b;
    border: 1px solid #f7d4d6;
}

/* =========================================
   FOOTER
========================================= */

.footer {
    display: flex;
    justify-content: space-between;
    gap: 15px;
    padding: 15px 3px;
    color: var(--muted);
    font-size: 11px;
}

/* =========================================
   PAGE MODIFICATION
========================================= */

.form-page {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 35px 15px;
}

.form-page-container {
    width: 100%;
    max-width: 650px;
}

.back-link {
    display: inline-block;
    color: var(--primary-dark);
    text-decoration: none;
    font-size: 13px;
    font-weight: 650;
    margin-bottom: 20px;
}

.back-link:hover {
    text-decoration: underline;
}

.edit-card {
    background: white;
    border: 1px solid var(--border);
    border-radius: 15px;
    padding: 35px;
    box-shadow: var(--shadow);
}

.edit-header {
    text-align: center;
    margin-bottom: 30px;
}

.edit-icon {
    width: 53px;
    height: 53px;
    margin: 0 auto 16px;
    background: #e5f7f4;
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 13px;
    font-size: 26px;
}

.edit-header h1 {
    font-size: 24px;
    color: var(--navy);
    margin: 9px 0;
}

.edit-header p {
    font-size: 12px;
    color: var(--muted);
}

/* =========================================
   RESPONSIVE
========================================= */

@media (max-width: 1100px) {
    .main-content {
        padding: 30px 25px;
    }

    .sidebar {
        width: 220px;
    }
}

@media (max-width: 850px) {
    .sidebar {
        width: 190px;
        padding: 25px 13px;
    }

    .main-content {
        padding: 25px 18px;
    }

    .stats-grid {
        gap: 12px;
    }

    .stat-card {
        padding: 17px;
    }
}

@media (max-width: 650px) {
    .dashboard {
        display: block;
    }

    .sidebar {
        width: 100%;
        padding: 16px;
    }

    .brand {
        margin-bottom: 20px;
    }

    .sidebar-label,
    .sidebar-bottom {
        display: none;
    }

    .sidebar-nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .nav-link {
        flex: 1;
        min-width: 135px;
        font-size: 12px;
    }

    .main-content {
        padding: 22px 14px;
    }

    .topbar {
        align-items: flex-start;
    }

    .topbar h1 {
        font-size: 22px;
    }

    .profile {
        display: none;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .content-card {
        padding: 19px 14px;
    }

    .section-heading {
        align-items: flex-start;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .form-actions {
        flex-direction: column-reverse;
    }

    .form-actions button,
    .form-actions a {
        width: 100%;
    }

    .footer {
        flex-direction: column;
        text-align: center;
    }

    .edit-card {
        padding: 24px 18px;
    }
}
