/* assets/css/style.css */

:root {
    --sidebar-width: 260px;
    --sidebar-bg: #212e3e;
    --primary-blue: #0d6efd;
    --font-main: 'Prompt', sans-serif;
}

body {
    font-family: var(--font-main);
    background-color: #f3f6f9;
    overflow-x: hidden;
}

/* assets/css/style.css */

/* --- Login Page Specific --- */
/* ใช้ Class login-page เพื่อแยกดีไซน์ออกจากหน้า Dashboard */
body.login-page {
    background-color: #212e3e !important; /* สีเดียวกับ Sidebar */
    background: linear-gradient(135deg, #1a2533 0%, #212e3e 100%); /* ไล่เฉดสีให้ดูมีมิติ */
    min-height: 100vh;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 20px;
    margin: 0;
}

.login-card {
    width: 100%;
    max-width: 420px; /* ขยายให้กว้างขึ้นนิดนึงเพื่อความสบายตา */
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.25);
    padding: 2.5rem;
    position: relative;
    overflow: hidden;
    animation: fadeIn 0.5s ease-out; /* เพิ่ม Effect ตอนโหลด */
}

.login-brand-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(45deg, #0d6efd, #0dcaf0);
    color: white;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 1.5rem;
    box-shadow: 0 10px 20px rgba(13, 110, 253, 0.3);
}

/* ปรับช่องกรอกข้อมูลให้ดูนุ่มนวล */
.login-input {
    background-color: #f8f9fa;
    border: 2px solid transparent;
    padding: 12px 15px;
    font-size: 1rem;
    transition: all 0.3s;
    border-radius: 10px;
}

.login-input:focus {
    background-color: #fff;
    border-color: #0d6efd;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.1);
}

.btn-login {
    padding: 12px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 10px;
    font-size: 1rem;
    transition: all 0.3s;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(13, 110, 253, 0.4);
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Sidebar Style --- */
#wrapper {
    display: flex;
    width: 100%;
    align-items: stretch;
}

#sidebar-wrapper {
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    color: #fff;
    min-height: 100vh;
    transition: all 0.3s;
    display: flex;
    flex-direction: column;
    position: fixed;
    z-index: 1000;
}

.sidebar-nav {
    padding: 0;
    list-style: none;
    margin-bottom: 0;
}

.sidebar-nav li {
    text-indent: 20px;
    line-height: 45px;
}

.sidebar-nav li a {
    display: block;
    text-decoration: none;
    color: #aebcd0;
    font-weight: 400;
    border-left: 4px solid transparent;
    transition: all 0.2s;
    padding: 5px 15px;
    border-radius: 0 30px 30px 0;
    margin-right: 15px;
}

.sidebar-nav li a:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.sidebar-nav li a.active {
    color: #fff;
    background: var(--primary-blue);
    box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
}

.sidebar-nav li a i {
    margin-right: 10px;
    font-size: 1.1rem;
}

.sidebar-profile {
    padding: 30px 20px;
    text-align: center;
}

.profile-img {
    width: 70px;
    height: 70px;
    background: #4facfe;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: bold;
    color: white;
    margin: 0 auto 10px;
    border: 3px solid rgba(255,255,255,0.2);
}

/* --- Content & Cards --- */
#page-content-wrapper {
    width: 100%;
    padding: 20px;
    margin-left: var(--sidebar-width);
    transition: all 0.3s;
}

.custom-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    background: #fff;
    padding: 20px;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.border-left-blue { border-left: 6px solid #0d6efd; }
.border-left-yellow { border-left: 6px solid #ffc107; }
.border-left-green { border-left: 6px solid #198754; }

.card-label { font-size: 0.9rem; color: #6c757d; font-weight: 600; }
.card-value { font-size: 1.8rem; font-weight: bold; color: #333; margin-top: 5px; }

/* --- Mobile Responsive --- */
@media (max-width: 768px) {
    #sidebar-wrapper { margin-left: calc(-1 * var(--sidebar-width)); }
    #page-content-wrapper { margin-left: 0; }
    #wrapper.toggled #sidebar-wrapper { margin-left: 0; }
    .mobile-nav-toggle { display: block !important; }
}

.mobile-nav-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: #333;
    margin-bottom: 15px;
}

/* --- Sidebar Style --- */
        #wrapper {
            display: flex;
            width: 100%;
            align-items: stretch;
        }

        #sidebar-wrapper {
            min-width: var(--sidebar-width);
            max-width: var(--sidebar-width);
            background-color: var(--sidebar-bg);
            color: #fff;
            min-height: 100vh;
            transition: all 0.3s;
            display: flex;
            flex-direction: column;
            position: fixed;
            /* Fix ติดซ้ายตลอด */
            z-index: 1000;
        }

        /* เมนู Sidebar */
        .sidebar-nav {
            padding: 0;
            list-style: none;
            margin-bottom: 0;
        }

        .sidebar-nav li {
            text-indent: 20px;
            line-height: 45px;
        }

        .sidebar-nav li a {
            display: block;
            text-decoration: none;
            color: #aebcd0;
            /* สีข้อความปกติ */
            font-weight: 400;
            border-left: 4px solid transparent;
            transition: all 0.2s;
            padding: 5px 15px;
            border-radius: 0 30px 30px 0;
            /* มนด้านขวา */
            margin-right: 15px;
        }

        .sidebar-nav li a:hover {
            color: #fff;
            background: rgba(255, 255, 255, 0.05);
        }

        /* สถานะ Active (เหมือนในภาพ) */
        .sidebar-nav li a.active {
            color: #fff;
            background: var(--primary-blue);
            box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4);
        }

        .sidebar-nav li a i {
            margin-right: 10px;
            font-size: 1.1rem;
        }

        /* ส่วน Profile ด้านบน */
        .sidebar-profile {
            padding: 30px 20px;
            text-align: center;
        }

        .profile-img {
            width: 70px;
            height: 70px;
            background: #4facfe;
            border-radius: 50%;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 24px;
            font-weight: bold;
            color: white;
            margin: 0 auto 10px;
            border: 3px solid rgba(255, 255, 255, 0.2);
        }

        /* --- Content Area --- */
        #page-content-wrapper {
            width: 100%;
            padding: 20px;
            margin-left: var(--sidebar-width);
            /* เว้นที่ให้ Sidebar */
            transition: all 0.3s;
        }

        /* --- Card Styles (ตามภาพเป๊ะ) --- */
        .custom-card {
            border: none;
            border-radius: 12px;
            box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
            background: #fff;
            padding: 20px;
            height: 100%;
            position: relative;
            overflow: hidden;
        }

        /* แถบสีด้านซ้าย */
        .border-left-blue {
            border-left: 6px solid #0d6efd;
        }

        .border-left-yellow {
            border-left: 6px solid #ffc107;
        }

        .border-left-green {
            border-left: 6px solid #198754;
        }

        .card-label {
            font-size: 0.9rem;
            color: #6c757d;
            font-weight: 600;
        }

        .card-value {
            font-size: 1.8rem;
            font-weight: bold;
            color: #333;
            margin-top: 5px;
        }

        /* --- Responsive (Mobile) --- */
        @media (max-width: 768px) {
            #sidebar-wrapper {
                margin-left: calc(-1 * var(--sidebar-width));
                /* ซ่อน Sidebar */
            }

            #page-content-wrapper {
                margin-left: 0;
            }

            #wrapper.toggled #sidebar-wrapper {
                margin-left: 0;
                /* แสดง Sidebar */
            }

            .mobile-nav-toggle {
                display: block !important;
            }
        }

        .mobile-nav-toggle {
            display: none;
            font-size: 1.5rem;
            cursor: pointer;
            color: #333;
            margin-bottom: 15px;
        }

        /* --- Sidebar Improvements --- */

/* 1. โลโก้ใน Sidebar (ย่อส่วนจากหน้า Login) */
.sidebar-logo-box {
    background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
    padding: 12px;
    border-radius: 12px;
    display: inline-block;
    margin-bottom: 15px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
}
.sidebar-logo-img {
    width: 40px; /* ขนาดเล็กลงเพื่อให้พอดี Sidebar */
    height: auto;
    display: block;
}

/* 2. Overlay (ฉากหลังดำจางๆ เวลาเปิดเมนูมือถือ) */
#sidebar-overlay {
    display: none; /* ซ่อนปกติ */
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5); /* สีดำโปร่งแสง */
    z-index: 999; /* อยู่ใต้ Sidebar (1000) แต่อยู่บน Content */
    backdrop-filter: blur(3px); /* เบลอฉากหลังนิดๆ ให้ดูหรู */
    transition: opacity 0.3s;
}

/* 3. ปุ่มปิด Sidebar (กากบาท) */
.sidebar-close-btn {
    display: none; /* ซ่อนบน PC */
    position: absolute;
    top: 10px;
    right: 15px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.4);
    font-size: 1.5rem;
    cursor: pointer;
    transition: color 0.2s;
}
.sidebar-close-btn:hover {
    color: #fff;
}

/* --- Mobile Logic --- */
@media (max-width: 768px) {
    /* แสดงปุ่มปิดเฉพาะบนมือถือ */
    .sidebar-close-btn {
        display: block;
    }
    
    /* แสดง Overlay เมื่อ Sidebar ถูกเปิด (class toggled) */
    #wrapper.toggled #sidebar-overlay {
        display: block;
    }
}