/* Blockset - Sleek Dark Glassmorphism CSS Stylesheet */

@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&family=Kanit:wght@300;400;500;600&display=swap');

:root {
    --bg-color: #08090e;
    --card-bg: rgba(18, 20, 32, 0.65);
    --card-border: rgba(255, 255, 255, 0.07);
    --primary: #9d4edd;
    --primary-glow: rgba(157, 78, 221, 0.4);
    --secondary: #00f5d4;
    --secondary-glow: rgba(0, 245, 212, 0.3);
    --success: #00f5d4;
    --danger: #ff007f;
    --warning: #ffb703;
    --text-main: #f8f9fa;
    --text-muted: #8b9bb4;
    --sidebar-width: 260px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', 'Kanit', sans-serif;
}

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    min-height: 100vh;
    overflow-x: hidden;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(157, 78, 221, 0.1) 0%, transparent 40%),
        radial-gradient(circle at 90% 80%, rgba(0, 245, 212, 0.08) 0%, transparent 40%);
    background-attachment: fixed;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.02);
}
::-webkit-scrollbar-thumb {
    background: rgba(157, 78, 221, 0.3);
    border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(157, 78, 221, 0.6);
}

/* Login Page Styling */
.login-body {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.login-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    width: 100%;
    max-width: 420px;
    border-radius: 20px;
    padding: 40px 30px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.5), 0 0 20px rgba(157, 78, 221, 0.1);
    text-align: center;
    animation: fadeIn 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-logo {
    width: 90px;
    height: 90px;
    border-radius: 22px;
    margin-bottom: 20px;
    box-shadow: 0 0 25px rgba(157, 78, 221, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.1);
    object-fit: cover;
}

.login-container h1 {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #fff 30%, var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.login-container p {
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 22px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group {
    position: relative;
}

.input-group i {
    position: absolute;
    left: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.form-control {
    width: 100%;
    padding: 14px 15px 14px 45px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    color: var(--text-main);
    font-size: 15px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 12px var(--primary-glow);
}

select, select.form-control {
    background-color: #161824 !important; /* บังคับพื้นหลังทึบสีเข้มสำหรับ Dropdown ทั้งหมด */
    color: #ffffff !important;            /* บังคับตัวอักษรสีขาวเมื่อปิดช่อง */
}

select option, select.form-control option {
    background-color: #ffffff !important; /* บังคับพื้นหลังขาวสว่างเมื่อเปิด Dropdown */
    color: #000000 !important;            /* บังคับตัวอักษรสีดำเข้ม */
}

.btn-primary {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, var(--primary) 0%, #6200ea 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    font-weight: 600;
    font-size: 16px;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 15px var(--primary-glow);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(157, 78, 221, 0.6);
}

.alert {
    padding: 12px 15px;
    border-radius: 10px;
    font-size: 14px;
    margin-bottom: 20px;
    text-align: left;
}

.alert-danger {
    background: rgba(255, 0, 127, 0.15);
    border: 1px solid rgba(255, 0, 127, 0.3);
    color: #ffb3d1;
}

.alert-success {
    background: rgba(0, 245, 212, 0.15);
    border: 1px solid rgba(0, 245, 212, 0.3);
    color: #c7fff6;
}

/* Dashboard Layout */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
    width: var(--sidebar-width);
    background: rgba(13, 15, 26, 0.95);
    border-right: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: var(--transition);
}

.sidebar-brand {
    padding: 25px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar-brand h2 {
    font-size: 20px;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 40%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-menu {
    list-style: none;
    padding: 10px;
    flex-grow: 1;
}

.sidebar-menu li {
    margin-bottom: 6px;
}

.sidebar-menu a {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    border-radius: 10px;
    transition: var(--transition);
}

.sidebar-menu a:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.03);
}

.sidebar-menu li.active a {
    color: #fff;
    background: linear-gradient(135deg, rgba(157, 78, 221, 0.25) 0%, rgba(0, 245, 212, 0.1) 100%);
    border-left: 3px solid var(--primary);
    box-shadow: inset 0 0 10px rgba(157, 78, 221, 0.1);
}

.sidebar-user {
    padding: 20px;
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-main);
}

.user-info p {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: capitalize;
}

/* Main Content Area */
.main-content {
    margin-left: var(--sidebar-width);
    flex-grow: 1;
    padding: 30px;
    min-height: 100vh;
    transition: var(--transition);
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.content-header h1 {
    font-size: 28px;
    font-weight: 700;
}

.content-header p {
    color: var(--text-muted);
    font-size: 14px;
}

/* Grid & Cards Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    padding: 22px;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    transition: var(--transition);
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(0,0,0,0.3);
    border-color: rgba(255, 255, 255, 0.12);
}

.stat-card.primary::before { background: var(--primary); }
.stat-card.secondary::before { background: var(--secondary); }
.stat-card.success::before { background: var(--success); }
.stat-card.danger::before { background: var(--danger); }

.stat-info p {
    font-size: 13px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.stat-info h2 {
    font-size: 24px;
    font-weight: 700;
}

.stat-info span {
    font-size: 13px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    margin-top: 4px;
}

.stat-icon {
    font-size: 26px;
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-card.primary .stat-icon { color: var(--primary); background: rgba(157, 78, 221, 0.1); }
.stat-card.secondary .stat-icon { color: var(--secondary); background: rgba(0, 245, 212, 0.1); }
.stat-card.success .stat-icon { color: var(--success); background: rgba(0, 245, 212, 0.1); }
.stat-card.danger .stat-icon { color: var(--danger); background: rgba(255, 0, 127, 0.1); }

/* Charts Layout */
.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

@media (max-width: 992px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
}

.chart-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 22px;
}

.chart-card h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-container {
    position: relative;
    width: 100%;
    min-height: 250px;
}

/* Tables & Lists */
.card-table-container {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    padding: 22px;
    margin-bottom: 30px;
    overflow: hidden;
}

.card-title-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.card-title-actions h3 {
    font-size: 18px;
    font-weight: 600;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
}

.table-custom {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

.table-custom th {
    padding: 14px 16px;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 13px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--card-border);
    letter-spacing: 0.5px;
}

.table-custom td {
    padding: 16px;
    font-size: 14px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    color: var(--text-main);
}

.table-custom tr:last-child td {
    border-bottom: none;
}

.table-custom tr:hover td {
    background: rgba(255, 255, 255, 0.015);
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 6px 12px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-success { background: rgba(0, 245, 212, 0.12); color: var(--success); border: 1px solid rgba(0, 245, 212, 0.2); }
.badge-danger { background: rgba(255, 0, 127, 0.12); color: var(--danger); border: 1px solid rgba(255, 0, 127, 0.2); }
.badge-warning { background: rgba(255, 183, 3, 0.12); color: var(--warning); border: 1px solid rgba(255, 183, 3, 0.2); }
.badge-primary { background: rgba(157, 78, 221, 0.12); color: var(--primary); border: 1px solid rgba(157, 78, 221, 0.2); }
.badge-secondary { background: rgba(139, 155, 180, 0.12); color: var(--text-muted); border: 1px solid rgba(139, 155, 180, 0.2); }

/* Text colors */
.text-success { color: var(--success) !important; }
.text-danger { color: var(--danger) !important; }
.text-muted { color: var(--text-muted) !important; }

/* Buttons & Inputs in Panels */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    border: none;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 12px;
    border-radius: 6px;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger) 0%, #d90429 100%);
    color: #fff;
    box-shadow: 0 4px 15px rgba(255, 0, 127, 0.3);
}

.btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(255, 0, 127, 0.5);
}

/* Modal / Action Form Styling */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

/* Tabs or toggle controls */
.tabs-container {
    display: flex;
    gap: 10px;
    margin-bottom: 25px;
    background: rgba(255, 255, 255, 0.02);
    padding: 5px;
    border-radius: 10px;
    border: 1px solid var(--card-border);
    width: fit-content;
}

.tab-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-weight: 600;
    cursor: pointer;
    border-radius: 8px;
    transition: var(--transition);
}

.tab-btn.active {
    background: var(--primary);
    color: #fff;
}

/* Menu Toggle for Mobile */
.menu-toggle {
    display: none;
    font-size: 24px;
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
}

/* Responsive sidebar */
@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.active {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 20px;
    }
    .menu-toggle {
        display: block;
    }
    .stats-grid {
        grid-template-columns: 1fr;
    }
}
