/* =========================================================
   ADMIN GLOBAL RESET
   ========================================================= */

*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    overflow-x: hidden; /* Ngăn horizontal scroll toàn trang */
}

/* =========================================================
   ADMIN - SIDEBAR
   ========================================================= */

.sidebar {
    width: 240px;
    height: 100vh;

    background: #ffffff;
    border-right: 1px solid #e5e7eb;

    position: fixed;
    top: 0;
    left: 0;

    padding: 20px;
    box-sizing: border-box;

    overflow-y: auto;

    transition: transform 0.28s ease, width 0.25s ease;

    z-index: 1000;
}

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 10px;

    color: #111827;
    font-size: 20px;
    font-weight: 700;

    margin-bottom: 30px;
}

.sidebar .logo i {
    width: 20px;
    min-width: 20px;

    text-align: center;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 12px;

    padding: 12px 14px;

    color: #4b5563;

    text-decoration: none;

    font-size: 14px;
    font-weight: 500;

    border-radius: 8px;

    transition: all 0.2s ease;
}

.sidebar nav a i {
    width: 20px;
    min-width: 20px;

    text-align: center;

    font-size: 15px;
}

.sidebar nav a:hover {
    background: #F5F5F5;
    color: #222222;
}

.sidebar nav a.active {
    background: #ECFDF5;
    color: #10B981;
}


/* =========================================================
   ADMIN MAIN LAYOUT
   ========================================================= */

main {
    margin-left: 240px;

    width: calc(100% - 240px);

    min-height: 100vh;

    box-sizing: border-box;

    background: #f8fafc;
}


/* =========================================================
   MENU TOGGLE BUTTON (hiển thị trên tablet/mobile)
   ========================================================= */

.menu-toggle {
    display: none;

    position: fixed;

    top: 14px;
    left: 14px;

    z-index: 1100;

    width: 40px;
    height: 40px;

    border: 1px solid #e5e7eb;

    border-radius: 8px;

    background: #ffffff;

    color: #111827;

    cursor: pointer;

    align-items: center;
    justify-content: center;

    box-shadow: 0 1px 4px rgba(0,0,0,0.08);

    transition: background 0.2s ease;
}

.menu-toggle:hover {
    background: #f3f4f6;
}


/* =========================================================
   SIDEBAR OVERLAY (chỉ xuất hiện khi sidebar mở trên mobile)
   ========================================================= */

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.28s ease;
}

.sidebar-overlay.active {
    display: block;
    opacity: 1;
}


/* =========================================================
   LAPTOP (992px - 1199px)
   ========================================================= */

@media (max-width: 1199px) {

    .sidebar {
        width: 210px;
        padding: 18px;
    }

    .sidebar .logo {
        font-size: 18px;
    }

    .sidebar nav a {
        padding: 11px 12px;
        font-size: 13px;
    }

    main {
        margin-left: 210px;
        width: calc(100% - 210px);
    }
}


/* =========================================================
   TABLET (768px - 991px)
   ========================================================= */

@media (max-width: 991px) {

    /* Ẩn sidebar mặc định, chuyển sang drawer */
    .sidebar {
        width: 240px;
        transform: translateX(-100%);
        box-shadow: none;
    }

    /* Khi sidebar mở */
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    }

    /* Hiện nút toggle */
    .menu-toggle {
        display: flex;
    }

    /* Main chiếm toàn bộ chiều rộng */
    main {
        margin-left: 0;
        width: 100%;
        /* Padding top để không bị che bởi menu toggle */
        padding-top: 0;
    }
}


/* =========================================================
   MOBILE (< 768px)
   ========================================================= */

@media (max-width: 767px) {

    .sidebar {
        width: 260px;
        padding: 20px 16px;
    }

    .sidebar .logo {
        font-size: 18px;
        margin-bottom: 24px;
    }

    .sidebar nav a {
        padding: 12px 14px;
        font-size: 14px;
    }

    main {
        margin-left: 0;
        width: 100%;
    }
}


/* =========================================================
   MOBILE NHỎ (< 480px)
   ========================================================= */

@media (max-width: 479px) {

    .sidebar {
        width: 80vw;
        max-width: 260px;
    }

    .menu-toggle {
        top: 12px;
        left: 12px;
        width: 38px;
        height: 38px;
    }
}


.dropdown {
    display: none;
}