:root {
    --luxury-dark: #111e30;
    --luxury-blue: #1f3653;
    --luxury-gold: #d4af37;
    --luxury-bg: #f8f9fa;
    --sidebar-width: 260px;
    --sidebar-collapsed-width: 86px;
}

body {
    font-family: 'Sarabun', sans-serif;
    background-color: var(--luxury-bg);
    overflow-x: hidden;
}

/* ---------------- Horizontal Drag Scroll ---------------- */
.drag-scroll-horizontal,
.referrals-scroll-drag {
    cursor: grab;
    /* ให้รองรับ vertical scroll ตามปกติ แต่กัน browser ไปจัดการ horizontal pan */
    touch-action: pan-y;
    overflow-x: auto;
    overflow-y: auto;
    /* กันไม่ให้เบราว์เซอร์เริ่มเลือกข้อความระหว่างลาก */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

.drag-scroll-horizontal *,
.referrals-scroll-drag * {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

.drag-scroll-horizontal.is-dragging,
.referrals-scroll-drag.is-dragging {
    cursor: grabbing;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none; /* iOS: ปิด text callout */
    cursor: grabbing;
}

/* DataTable: ไม่อยากให้มี vertical scroll ภายในตาราง */
.referrals-scroll-drag {
    overflow-y: hidden;
}

/* -------- Booking chips (daily view) -------- */
.booking-chip {
    width: 100%;
    max-width: 100%;
}

.booking-chip-main {
    min-width: 0;
}

.booking-chip-name {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 4px;
}

.booking-chip-course {
    white-space: nowrap;
}

/* ---------------- Sidebar ---------------- */
#sidebar {
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, var(--luxury-dark) 0%, var(--luxury-blue) 100%);
    color: #fff;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1040;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    overflow: hidden;
}

.sidebar-header {
    padding: 25px 20px;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.sidebar-header h4 {
    margin: 0;
    font-weight: 600;
    color: var(--luxury-gold);
    letter-spacing: 1px;
    font-size: 1.4rem;
}

ul.components {
    padding: 20px 0;
}

#sidebar ul li a {
    padding: 16px 25px;
    font-size: 1.05rem;
    display: block;
    color: #d1d8e0;
    text-decoration: none;
    transition: 0.3s;
    position: relative;
}

#sidebar ul li a:hover,
#sidebar ul li.active>a {
    color: #fff;
    background: rgba(255, 255, 255, 0.05);
}

#sidebar ul li.active>a::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 4px;
    background-color: var(--luxury-gold);
}

#sidebar ul li a i {
    margin-right: 15px;
    width: 20px;
    text-align: center;
    color: var(--luxury-gold);
}

/* Sidebar collapsed (desktop) */
#sidebar.active {
    width: var(--sidebar-collapsed-width);
}

#sidebar.active .sidebar-header {
    padding: 25px 0;
}

#sidebar.active .sidebar-header h4 {
    font-size: 0;
}

#sidebar.active .sidebar-header h4 i {
    font-size: 1.5rem;
}

#sidebar.active .sidebar-header small {
    display: none;
}

#sidebar.active ul.components {
    padding: 20px 0;
}

#sidebar.active ul.components li a {
    padding: 16px 0;
    text-align: center;
    font-size: 0; /* hide text, keep icon */
}

#sidebar.active ul.components li a i {
    margin-right: 0;
    width: 100%;
    font-size: 1.1rem;
}

#sidebar.active + #content {
    width: calc(100% - var(--sidebar-collapsed-width));
    margin-left: var(--sidebar-collapsed-width);
}

/* ---------------- Main Content ---------------- */
#content {
    width: calc(100% - var(--sidebar-width));
    min-height: 100vh;
    margin-left: var(--sidebar-width);
    transition: all 0.3s ease;
}

/* ---------------- Overlay for Mobile ---------------- */
.sidebar-overlay {
    background: rgba(0, 0, 0, 0.5);
    z-index: 1030;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

/* ---------------- Responsive ---------------- */
@media (max-width: 992px) {
    #sidebar {
        margin-left: -260px;
        width: var(--sidebar-width);
    }

    #sidebar.active {
        margin-left: 0;
        width: var(--sidebar-width);
    }

    /* Mobile: when sidebar is open, show full labels (not icon-only) */
    #sidebar.active .sidebar-header {
        padding: 25px 20px;
    }

    #sidebar.active .sidebar-header h4 {
        font-size: 1.4rem;
    }

    #sidebar.active .sidebar-header h4 i {
        font-size: inherit;
    }

    #sidebar.active .sidebar-header small {
        display: block;
    }

    #sidebar.active ul.components li a {
        padding: 16px 25px;
        text-align: left;
        font-size: 1.05rem;
    }

    #sidebar.active ul.components li a i {
        margin-right: 15px;
        width: 20px;
        font-size: 1rem;
    }

    #content {
        width: 100%;
        margin-left: 0;
    }

    /* กัน rule collapsed desktop แทรก */
    #sidebar.active + #content {
        width: 100%;
        margin-left: 0;
    }
}

/* มือถือ/จอเล็กมาก: ปรับบางส่วนเพิ่ม */
@media (max-width: 768px) {

    .navbar-brand {
        font-size: 1rem;
        max-width: 200px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        display: inline-block;
    }

    .luxury-card {
        padding: 1.25rem !important;
    }
}

/* มือถือแนวตั้งจอเล็ก: ปรับ layout ผู้จองไม่ให้ล้นกล่อง */
@media (max-width: 576px) {
    .booking-chip {
        flex-wrap: nowrap;
        gap: 6px;
    }

    .booking-chip-main {
        flex: 1 1 auto;
        min-width: 0;
    }

    .booking-chip-cancel {
        flex: 0 0 auto;
    }

    /* ถ้าพื้นที่ชื่อไม่พอ ให้ดัน badge ลงบรรทัดถัดไป */
    .booking-chip-name {
        flex-direction: column;
        align-items: flex-start;
    }

    .booking-chip-course {
        align-self: flex-start;
    }
}

/* ---------------- Shared Cards & Layout ---------------- */
.luxury-card {
    border: none;
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.04);
    background: #fff;
    padding: 2rem;
}

.login-card {
    background: #fff;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    padding: 40px;
    width: 100%;
    max-width: 450px;
}


/* ---------------- Navbar ---------------- */
.navbar {
    background: #fff;
    padding: 15px 25px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.navbar .container-fluid {
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.navbar-brand {
    font-weight: 500;
    color: var(--luxury-dark);
    font-size: 1.2rem;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
}

.user-profile img {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--luxury-gold);
    padding: 2px;
}