/* ============================
        GLOBAL STYLES
============================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Poppins', sans-serif;
}

body {
    background-color: #f4f6f9;
    color: #111;
}

/* ============================
        TOP HEADER
============================ */
.top-header {
    background: linear-gradient(90deg, #000000, #708090);
    color: #fff;
    height: 60px;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
}

.company-name {
    font-size: 18px;
    font-weight: 600;
}

.erp-name {
    font-size: 13px;
    opacity: 0.9;
}

/* Mobile toggle */
.menu-toggle {
    display: none;
    font-size: 24px;
    cursor: pointer;
}

@media (max-width: 1280px), (hover: none), (pointer: coarse) {
    .menu-toggle {
        display: block;
    }
}

.logo-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.company-logo {
    height: 40px; /* adjust as needed */
    width: auto;
}

.company-text .company-name {
    font-size: 18px;
    font-weight: 600;
}

.company-text .erp-name {
    font-size: 13px;
    opacity: 0.9;
}

/* Responsive adjustments */
@media (max-width: 480px) {
    .company-logo {
        height: 30px;
    }

    .company-text .company-name {
        font-size: 14px;
    }

    .company-text .erp-name {
        display: none;
    }
}

/* ============================
        SIDEBAR
============================ */
.sidebar {
    width: 250px;
    background-color: #111;
    position: fixed;
    top: 60px;
    left: 0;
    bottom: 0;
    overflow-y: auto;
    transition: all 0.3s ease-in-out;
    z-index: 999;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.3);
}

/* Sidebar Toggle */
.sidebar-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    background: #000;
    color: #fff;
    cursor: pointer;
    border-bottom: 1px solid #333;
}

    .sidebar-toggle:hover {
        background: #b30000;
    }

.sidebar.collapsed .sidebar-toggle .text {
    display: none;
}

.sidebar.collapsed .sidebar-toggle {
    justify-content: center;
}

/* Menu Item */
.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 20px;
    color: #ddd;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

    .menu-item:hover {
        background: #b30000;
        color: #fff;
    }

/* Icon & Text */
.icon {
    min-width: 30px;
    text-align: center;
}

.text {
    flex: 1;
}

/* Arrow */
.arrow {
    font-size: 12px;
    transition: transform 0.3s ease;
}

.menu-item.open .arrow {
    transform: rotate(90deg);
}

.sidebar.collapsed .arrow,
.sidebar.collapsed .text {
    display: none;
}

/* Submenu */
.submenu {
    display: none;
    flex-direction: column;
    background: #111;
    padding-left: 45px;
}

.menu-item.open > .submenu {
    display: flex;
}

.submenu-item {
    display: block;
    padding: 12px 20px 12px 55px;
    color: #ccc;
    font-size: 14px;
    text-decoration: none;
}

    .submenu-item:hover {
        background: #b30000;
        color: #fff;
    }

/* Floating submenu when collapsed */
.sidebar.collapsed .menu-group.open .submenu {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 0;
    left: 70px;
    min-width: 180px;
    background: #111;
    border: 1px solid #333;
    z-index: 9999;
    padding-left: 0;
}

.sidebar.collapsed .menu-group.open {
    position: relative;
}

/* Collapsed Sidebar */
.sidebar.collapsed {
    width: 70px;
}

    .sidebar.collapsed a {
        justify-content: center;
        padding: 15px 5px;
    }

/* Regular submenu */
.menu-group .submenu {
    display: none;
    flex-direction: column;
    background: #111;
    padding-left: 15px;
}

/* Open submenu */
.menu-group.open .submenu {
    display: flex;
}

/* Arrow rotation */
.menu-group.open .arrow {
    transform: rotate(90deg);
}

/* Collapsed sidebar floating submenu */
.sidebar.collapsed .menu-group.open .submenu {
    display: flex;
    position: absolute;
    top: 0; /* will adjust via JS */
    left: 70px;
    min-width: 180px;
    background: #111;
    border: 1px solid #333;
    z-index: 9999;
    padding-left: 0;
}

/* ============================
        OVERLAY (MOBILE)
============================ */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 100%;
    background: rgba(0,0,0,0.4);
    display: none;
    z-index: 998;
}

    .overlay.show {
        display: block;
    }

/* ============================
        MAIN CONTENT
============================ */
.main-content {
    margin-left: 250px;
    padding: 90px 25px 25px 25px;
    transition: all 0.3s ease;
}

    .main-content.collapsed {
        margin-left: 70px;
    }

/* ============================
        DASHBOARD CARDS
============================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.card {
    background: #fff;
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
    transition: 0.3s ease;
}

    .card:hover {
        transform: translateY(-8px);
        box-shadow: 0 15px 30px rgba(179,0,0,0.3);
    }

.card-title {
    font-size: 15px;
    font-weight: 600;
    color: #333;
}

.card-value {
    font-size: 28px;
    margin-top: 10px;
    font-weight: 600;
    color: #b30000;
}

/* ============================
        RESPONSIVE
============================ */
@media (max-width: 992px) {
    .company-name {
        font-size: 16px;
    }
    /* sidebar width handled by the 1280px rule below — no override needed here */
}

/* Touch devices + small screens: hamburger drawer mode */
@media (max-width: 1280px), (hover: none), (pointer: coarse) {
    /* in-sidebar desktop toggle not needed here */
    .sidebar-toggle {
        display: none;
    }

    /* sidebar hidden via transform; inline <style> uses left: for the actual slide */
    .sidebar {
        transform: translateX(-260px);
        width: 260px;
    }

        .sidebar.show {
            transform: translateX(0);
        }

        /* .collapsed on mobile/tablet = still full-width hidden, not icon-strip */
        .sidebar.collapsed {
            width: 260px;
            transform: translateX(-260px);
        }

        .sidebar.collapsed.show {
            transform: translateX(0);
        }

            .sidebar.collapsed .text {
                display: inline;
            }

            .sidebar.collapsed .menu-item {
                justify-content: flex-start;
                padding: 15px 20px;
            }

    .main-content, .main-content.collapsed {
        margin-left: 0;
    }
}

@media (max-width: 480px) {
    .company-name {
        font-size: 14px;
    }

    .erp-name {
        display: none;
    }

    .card {
        padding: 18px;
    }
}

/* ============================
        ANIMATION
============================ */
.sidebar a {
    animation: fadeSlide 0.4s ease both;
}

@keyframes fadeSlide {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}




.dashboard-footer a,
.footer-text a {
    transition: 0.3s;
}

    .dashboard-footer a:hover,
    .footer-text a:hover {
        color: #ff0000;
        text-decoration: underline;
    }
