/* ==========================================================================
   Custom Styles - Compatible Version (No Color-Mix)
   ========================================================================== */

:root {
    --primary-color: #890306;
}

/* Color Overrides */
html[data-primary-color="default"] {
    --primary-color: #890306;
}

html[data-primary-color="green"] {
    --primary-color: #71dd37;
}

html[data-primary-color="orange"] {
    --primary-color: #ffab00;
}

html[data-primary-color="red"] {
    --primary-color: #ff3e1d;
}

html[data-primary-color="cyan"] {
    --primary-color: #03c3ec;
}

html[data-primary-color="black"] {
    --primary-color: #232333;
}

html[data-primary-color="pink"] {
    --primary-color: #ff3e96;
}

html[data-primary-color="brown"] {
    --primary-color: #795548;
}

html[data-primary-color="blue"] {
    --primary-color: #0d6efd;
}

/* === BUTTONS & SIDEBAR WILL BE DYNAMICALLY INJECTED BY NAVBAR.PHP === */
/* This ensures 100% compatibility across all browsers including older ones */

/* Buttons Base Reset (dynamic color applies on top) */
.btn-primary {
    border: none !important;
    color: #fff !important;
}

/* Footer Support */
.footer {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    z-index: 999;
    background: #fff;
    border-top: 1px solid #e8e8e8;
    padding: 10px 24px;
    display: flex;
    align-items: center;
    transition: left 0.3s ease;
}

.mini-sidebar .footer {
    left: 80px;
}

.page-wrapper {
    padding-bottom: 52px;
}

/* Theme Customizer UI */
.offcanvas.premium-customizer {
    z-index: 1060;
}

.offcanvas-backdrop.show {
    opacity: 0.5;
}

.customizer-card {
    background: #f8f9fa;
    padding: 1.25rem;
    border-radius: 0.75rem;
    margin-bottom: 1.5rem;
}

.visual-btn {
    flex: 1;
    background: #fff;
    border: 1px solid #dbe0e6;
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #5B6670;
}

.visual-btn.active {
    border-color: var(--primary-color) !important;
    color: var(--primary-color) !important;
}

.color-circle {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    padding: 3px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-block;
    margin-right: 5px;
}

.color-circle.active {
    border-color: var(--primary-color) !important;
    transform: scale(1.1);
}

.color-dot {
    width: 100%;
    height: 100%;
    border-radius: 50%;
}

/* Floating Gear Button */
.customizer-links {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1050;
    width: 48px;
    height: 48px;
    pointer-events: none;
}

.gear-icon {
    background: var(--primary-color) !important;
    color: #fff !important;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px 0 0 10px;
    font-size: 24px;
    box-shadow: -3px 0 15px rgba(0, 0, 0, 0.15);
    text-decoration: none;
    pointer-events: auto;
}

.gear-icon i {
    animation: fa-spin 2s infinite linear;
    display: inline-block;
}

@keyframes fa-spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

/* Prevent Overlays */
#global-loader {
    display: none !important;
}

.sidebar-filter {
    display: none !important;
}

/* Base properties for sidebar */
.sidebar .sidebar-menu>ul>li.active>a,
.sidebar .sidebar-menu>ul>li>a.active {
    transition: all 0.3s ease;
}

.sidebar-menu li.submenu ul li.active>a,
.sidebar-menu li.submenu ul li a.active {
    background: transparent !important;
}

body .main-wrapper .sidebar-menu li.active a img,
body .main-wrapper .sidebar-menu li a.active img {
    filter: none !important;
}

/* ==========================================================================
   Sidebar Icon Frame
   ========================================================================== */

/* Icon box frame สำหรับ menu item หลัก */
.sidebar .sidebar-menu > ul > li.submenu-open > ul > li > a > i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    font-size: 16px;
    color: #6b7280;
    transition: all 0.25s ease;
    flex-shrink: 0;
    margin-right: 2px;
}

/* Hover: icon frame */
.sidebar .sidebar-menu > ul > li.submenu-open > ul > li > a:hover > i {
    background: rgba(137, 3, 6, 0.08);
    background: rgba(var(--primary-rgb, 137, 3, 6), 0.10);
    color: var(--primary-color);
}

/* Active: icon frame */
.sidebar .sidebar-menu > ul > li.submenu-open > ul > li > a.active > i,
.sidebar .sidebar-menu > ul > li.submenu-open > ul > li > a.active.subdrop > i {
    background: var(--primary-color) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(137, 3, 6, 0.25);
}

/* SVG icons ก็ใส่กรอบเหมือนกัน */
.sidebar .sidebar-menu > ul > li.submenu-open > ul > li > a > svg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    padding: 7px;
    box-sizing: content-box;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.04);
    color: #6b7280;
    transition: all 0.25s ease;
    flex-shrink: 0;
    margin-right: 2px;
}

.sidebar .sidebar-menu > ul > li.submenu-open > ul > li > a:hover > svg {
    background: rgba(var(--primary-rgb, 137, 3, 6), 0.10);
    color: var(--primary-color);
}

.sidebar .sidebar-menu > ul > li.submenu-open > ul > li > a.active > svg,
.sidebar .sidebar-menu > ul > li.submenu-open > ul > li > a.active.subdrop > svg {
    background: var(--primary-color) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(137, 3, 6, 0.25);
}