
/* ==========================================================
   TIS-BENIN - Metronic 7 adaptation
   ========================================================== */

html, body {
    min-height: 100%;
}

body#kt_body {
    background: #f5f6fa;
    color: #3f4254;
    font-family: Poppins, "Segoe UI", Arial, sans-serif;
    overflow-x: hidden;
}

/* Brand */
#kt_brand {
    background: #1a1a27;
    height: 65px;
    min-height: 65px;
    padding: 0 18px;
}

.brand-logo {
    display: flex;
    align-items: center;
    min-width: 0;
    color: #fff !important;
    text-decoration: none !important;
}

.brand-image {
    width: 42px;
    height: 42px;
    object-fit: contain;
    border-radius: 10px;
    background: #fff;
    padding: 2px;
}

.brand-title {
    margin-left: 10px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: .2px;
    white-space: nowrap;
}

.brand-toggle {
    color: rgba(255,255,255,.7);
    margin-left: auto;
}

.brand-toggle:hover {
    color: #fff;
}

/* Sidebar */
#kt_aside {
    background: #1e1e2d;
    box-shadow: 0 0 30px rgba(82,63,105,.05);
}

#kt_aside .aside-menu {
    padding: 0 12px;
}

#kt_aside .menu-nav {
    padding: 0;
}

#kt_aside .menu-item > .menu-link {
    min-height: 44px;
    border-radius: 6px;
    margin: 2px 0;
    color: #a2a3b7;
    font-weight: 500;
    transition: all .18s ease;
}

#kt_aside .menu-item > .menu-link:hover {
    background: #27273a;
    color: #fff;
}

#kt_aside .menu-item-active > .menu-link,
#kt_aside .menu-item-open > .menu-link {
    background: #3699ff;
    color: #fff;
}

#kt_aside .menu-item-active > .menu-link .menu-icon,
#kt_aside .menu-item-open > .menu-link .menu-icon {
    color: #fff;
}

#kt_aside .menu-icon {
    width: 38px;
    min-width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.menu-symbol {
    width: 25px;
    height: 25px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: currentColor;
    font-size: 18px;
    line-height: 1;
}

#kt_aside .menu-text {
    font-size: 13px;
}

#kt_aside .menu-section {
    padding: 18px 10px 7px;
    color: #6c7293;
}

#kt_aside .menu-section .menu-text {
    color: #6c7293;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .8px;
    font-weight: 700;
}

#kt_aside .menu-submenu {
    background: rgba(0,0,0,.12);
    border-radius: 6px;
    margin: 2px 0 5px;
}

#kt_aside .menu-subnav {
    padding: 5px 0;
}

#kt_aside .menu-subnav .menu-link {
    color: #a2a3b7;
    min-height: 38px;
    padding-left: 47px;
}

#kt_aside .menu-subnav .menu-item-active .menu-link,
#kt_aside .menu-subnav .menu-link:hover {
    color: #fff;
    background: rgba(54,153,255,.14);
}

#kt_aside .menu-subnav .menu-bullet {
    width: 24px;
    display: inline-flex;
    align-items: center;
}

#kt_aside .bullet-dot {
    width: 5px;
    height: 5px;
    background: #7e8299;
}

.logout-link {
    color: #f64e60 !important;
}

.logout-link:hover {
    background: rgba(246,78,96,.12) !important;
    color: #ff7b89 !important;
}

/* Header */
#kt_header {
    background: #fff;
    border-bottom: 1px solid #eef0f8;
    box-shadow: 0 2px 8px rgba(0,0,0,.025);
}

.header-title strong {
    font-size: 16px;
}

#kt_header .topbar {
    height: 65px;
    display: flex;
    align-items: center;
}

/* Mobile */
#kt_header_mobile {
    background: #fff;
    box-shadow: 0 2px 8px rgba(0,0,0,.05);
    padding: 0 15px;
}

.mobile-brand {
    display: flex;
    align-items: center;
    color: #181c32 !important;
    text-decoration: none !important;
    font-weight: 700;
}

.mobile-brand img {
    width: 35px;
    height: 35px;
    object-fit: contain;
    margin-right: 8px;
}

.burger-icon {
    width: 32px;
    height: 32px;
    position: relative;
}

.burger-icon span,
.burger-icon span:before,
.burger-icon span:after {
    display: block;
    width: 21px;
    height: 2px;
    background: #181c32;
    border-radius: 2px;
    position: absolute;
    left: 5px;
    content: "";
}

.burger-icon span {
    top: 15px;
}

.burger-icon span:before {
    top: -7px;
    left: 0;
}

.burger-icon span:after {
    top: 7px;
    left: 0;
}

.aside-mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 1040;
}

.aside-mobile-overlay.show {
    display: block;
}

/* Main content */
#kt_wrapper {
    min-height: 100vh;
}

#kt_content {
    padding-top: 65px;
}

.tis-page-container {
    padding: 25px;
    max-width: 100%;
}

/* Legacy page compatibility */
#kt_content > .d-flex.flex-column-fluid {
    width: 100%;
}

#kt_content .content,
#kt_content .container,
#kt_content .main,
#kt_content .container-fluid {
    box-sizing: border-box;
}

#kt_content .content {
    margin-left: 0 !important;
    padding: 0 !important;
}

#kt_content .container {
    margin-left: 0 !important;
    margin-right: 0 !important;
    max-width: 100% !important;
}

#kt_content .main {
    padding: 0 !important;
}

/* Cards */
#kt_content .card,
#kt_content .panel,
#kt_content .form-card {
    background: #fff;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 0 20px rgba(76,87,125,.07);
}

#kt_content .card {
    margin-bottom: 20px;
}

#kt_content .panel {
    margin-bottom: 20px;
}

#kt_content .card,
#kt_content .panel-body,
#kt_content .form-card {
    padding: 20px;
}

#kt_content .panel-heading {
    padding: 0 0 15px;
    background: transparent;
    border: 0;
    color: #181c32;
    font-weight: 700;
}

#kt_content .panel-footer {
    background: transparent;
    border-top: 1px solid #ebedf3;
}

/* Generic page titles */
#kt_content > .d-flex.flex-column-fluid h1,
#kt_content > .d-flex.flex-column-fluid h2 {
    color: #181c32;
    font-weight: 700;
    margin: 0 0 20px;
}

#kt_content h3,
#kt_content h4 {
    color: #181c32;
    font-weight: 600;
}

/* Generic tables */
#kt_content table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 0 20px rgba(76,87,125,.05);
    margin-bottom: 20px;
}

#kt_content table th {
    background: #f3f6f9;
    color: #7e8299;
    border: 0;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .2px;
    padding: 13px 14px;
}

#kt_content table td {
    padding: 13px 14px;
    border-top: 1px solid #ebedf3;
    color: #3f4254;
}

#kt_content table tr:hover td {
    background: #f8f9fb;
}

/* Forms */
#kt_content input:not([type="checkbox"]):not([type="radio"]),
#kt_content select,
#kt_content textarea {
    min-height: 42px;
    border: 1px solid #e2e5ec;
    border-radius: 6px;
    background: #fff;
    color: #3f4254;
    padding: 8px 12px;
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

#kt_content input:focus,
#kt_content select:focus,
#kt_content textarea:focus {
    border-color: #3699ff !important;
    box-shadow: 0 0 0 3px rgba(54,153,255,.12);
}

#kt_content button,
#kt_content input[type="submit"],
#kt_content input[type="button"] {
    border-radius: 6px;
    border: 0;
    min-height: 40px;
    padding: 8px 16px;
    background: #3699ff;
    color: #fff;
    font-weight: 600;
    cursor: pointer;
}

#kt_content button:hover,
#kt_content input[type="submit"]:hover,
#kt_content input[type="button"]:hover {
    background: #187de4;
}

/* Existing grid/cards */
#kt_content .cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 20px;
    margin-bottom: 20px;
}

#kt_content .cards .card {
    margin: 0;
}

/* Alerts/toasts */
#kt_content .alert,
#kt_content .toast {
    border-radius: 6px;
}

/* Mobile tables: horizontal scroll instead of breaking layout */
@media (max-width: 991.98px) {
    #kt_aside {
        transform: translateX(-100%);
        transition: transform .25s ease;
        z-index: 1050;
    }

    body.aside-mobile-open #kt_aside {
        transform: translateX(0);
    }

    #kt_wrapper {
        margin-left: 0 !important;
        width: 100%;
    }

    #kt_header {
        display: none;
    }

    #kt_content {
        padding-top: 60px;
    }

    .tis-page-container {
        padding: 15px;
    }

    #kt_content table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    #kt_content .cards {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    #kt_content form {
        width: 100%;
    }

    #kt_content form input,
    #kt_content form select,
    #kt_content form textarea,
    #kt_content form button {
        max-width: 100%;
        margin: 4px 0;
    }
}

@media (max-width: 575.98px) {
    .tis-page-container {
        padding: 12px;
    }

    #kt_content > .d-flex.flex-column-fluid h1,
    #kt_content > .d-flex.flex-column-fluid h2 {
        font-size: 20px;
    }

    #kt_content .card,
    #kt_content .panel,
    #kt_content .form-card {
        padding: 15px;
        border-radius: 8px;
    }

    #kt_content table th,
    #kt_content table td {
        padding: 10px;
        font-size: 12px;
    }

    .mobile-brand span {
        font-size: 14px;
    }
}

/* Desktop sidebar minimize */
@media (min-width: 992px) {
    body.aside-minimized #kt_aside {
        width: 75px;
    }

    body.aside-minimized #kt_aside .brand-title,
    body.aside-minimized #kt_aside .menu-text,
    body.aside-minimized #kt_aside .menu-arrow,
    body.aside-minimized #kt_aside .menu-label,
    body.aside-minimized #kt_aside .menu-section {
        display: none !important;
    }

    body.aside-minimized #kt_aside .menu-link {
        justify-content: center;
        padding-left: 0;
        padding-right: 0;
    }

    body.aside-minimized #kt_aside .menu-icon {
        width: 100%;
    }

    body.aside-minimized #kt_wrapper {
        margin-left: 75px;
    }
}

/* Keep legacy page backgrounds from overriding the app shell */
#kt_content [style*="background:#f1f5f9"],
#kt_content [style*="background: #f1f5f9"] {
    background: transparent !important;
}

/* ==========================================================
   TIS-BENIN - Menus propres et sous-menus fiables
   ========================================================== */

/* Suppression des pictogrammes placés avant les noms des menus. */
#kt_aside .menu-icon,
#kt_aside .menu-symbol,
#kt_aside .menu-section > .menu-icon {
    display: none !important;
}

#kt_aside .menu-link {
    padding-left: 16px !important;
}

#kt_aside .menu-subnav .menu-link {
    padding-left: 24px !important;
}

#kt_aside .menu-subnav .menu-bullet {
    display: none !important;
}

/* Metronic peut cacher les sous-menus selon son moteur de menu.
   Notre JS pilote désormais l'état menu-item-open. */
#kt_aside .menu-item-submenu > .menu-submenu {
    display: none !important;
    visibility: hidden;
    opacity: 0;
    height: 0;
    overflow: hidden;
}

#kt_aside .menu-item-submenu.menu-item-open > .menu-submenu {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
}

#kt_aside .menu-item-submenu.menu-item-open > .menu-link .menu-arrow {
    transform: rotate(90deg);
}

@media (max-width: 991.98px) {
    #kt_aside .menu-item-submenu > .menu-submenu,
    #kt_aside .menu-item-submenu.menu-item-open > .menu-submenu {
        position: static !important;
        width: auto !important;
        max-width: none !important;
    }
}
