/* design_system.css — Dental XRay Design System
   Based on NEXT_PROJECT_DESIGN_SYSTEM.md + UX_UI_GUIDE.md
   Brand: Soft Medical (สุขุม · น่าเชื่อถือ · ใส่ใจ)
*/

/* ============================================
   1. CSS Custom Properties (Design Tokens)
   ============================================ */
:root {
    /* 🔵 Brand Colors */
    --primary: #1367c8;
    --primary-light: #3b82f6;
    --primary-dark: #1d4ed8;
    --secondary: #1367c8;

    /* 🟢 Accent Colors (ฟ้าพรีเมียม) */
    --accent: #1367c8;
    --accent-light: #eff6ff;
    --accent-dark: #0f58ab;

    /* 🔴 Semantic Colors */
    --success: #15803d;
    --warning: #b45309;
    --danger: #b91c1c;
    --info: #0ea5e9;

    /* ⚪ Background Colors */
    --bg-main: #f4f7fb;
    --bg-sidebar: #1367c8;
    --bg-surface: #ffffff;
    --bg-surface-2: #f8fafc;

    /* 🖤 Typography & Lines */
    --text-heading: #0f172a;
    --text-body: #334155;
    --text-muted: #64748b;
    --line: #e8edf3;
    --line-strong: #dbe3ec;

    /* 👤 Shadows */
    --card-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);

    /* Sidebar width */
    --sidebar-width: 260px;
    --sidebar-collapsed: 80px;
}

/* ============================================
   2. Global Resets & Typography
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', 'Sarabun', sans-serif !important;
    background: var(--bg-main);
    color: var(--text-body);
    font-size: 14px;
    line-height: 1.6;
    overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-heading);
    font-weight: 800;
    line-height: 1.3;
}

a {
    color: var(--primary);
    text-decoration: none;
}

/* Tabular numbers for clinical data */
.tabular-nums {
    font-variant-numeric: tabular-nums;
}

/* ============================================
   3. App Layout (Sidebar + Content)
   ============================================ */
.app-container {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar --- */
#sidebar {
    width: var(--sidebar-width);
    background: #1367c8;
    border-right: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow-y: auto;
    color: #ffffff;
}

#sidebar.collapsed {
    width: var(--sidebar-collapsed);
}

#sidebar.collapsed .logo-info,
#sidebar.collapsed .menu-item-label,
#sidebar.collapsed .sidebar-section-header,
#sidebar.collapsed .sidebar-user-info,
#sidebar.collapsed .sidebar-user a {
    display: none;
}

#sidebar.collapsed .sidebar-header,
#sidebar.collapsed .menu-item,
#sidebar.collapsed .sidebar-user {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
}

.sidebar-header {
    padding: 16px 24px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.08);
}

.sidebar-header i {
    color: #ffffff !important;
    font-size: 22px;
}

.logo-text {
    font-weight: 800;
    font-size: 16px;
    color: #ffffff !important;
    white-space: nowrap;
    letter-spacing: 0.5px;
}

.logo-sub {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.8) !important;
    display: block;
    font-weight: 500;
}

/* --- Sidebar Menu --- */
.sidebar-menu {
    flex: 1;
    padding: 8px 0;
    overflow-y: auto;
}

.sidebar-section-header {
    padding: 20px 24px 8px;
    font-size: 11px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.68);
    text-transform: uppercase;
    letter-spacing: 1px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    margin-top: 8px;
}

.sidebar-menu .sidebar-section-header:first-of-type {
    border-top: none;
    margin-top: 0;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 24px;
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
    transition: all 0.15s ease;
    cursor: pointer;
    border-left: 3px solid transparent;
    text-decoration: none;
}

.menu-item i {
    width: 20px;
    text-align: center;
    font-size: 18px;
    color: rgba(255, 255, 255, 0.85);
    transition: color 0.15s;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

.menu-item:hover i {
    color: #ffffff !important;
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
    border-left: 4px solid #ffffff;
    font-weight: 700;
}

.menu-item.active i {
    color: #ffffff !important;
}

/* Sidebar user info */
.sidebar-user {
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(0, 0, 0, 0.12);
}

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ffffff;
    color: #1367c8;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 14px;
}

.sidebar-user-info {
    flex: 1;
    overflow: hidden;
}

.sidebar-user-name {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.75);
}

/* --- Main Content --- */
#content {
    flex: 1;
    margin-left: var(--sidebar-width);
    transition: margin-left 0.3s ease;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

#content.expanded {
    margin-left: 70px;
}

.top-navbar {
    background: var(--bg-surface);
    border-bottom: 1px solid var(--line);
    padding: 0 32px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 90;
}

.toggle-sidebar {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: var(--accent) !important;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    transition: 0.2s;
}

.toggle-sidebar:hover {
    background: var(--bg-surface-2);
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.navbar-badge {
    position: relative;
}

.navbar-badge .badge-count {
    position: absolute;
    top: -4px;
    right: -4px;
    background: var(--danger);
    color: white;
    font-size: 10px;
    font-weight: 700;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Main Body --- */
.main-body {
    padding: 16px;
    flex: 1;
}

/* ============================================
   4. Page Header
   ============================================ */
.page-header {
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.page-header-title h1 {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-heading);
    margin-bottom: 2px;
}

.page-header-title p {
    color: var(--accent);
    margin-top: 2px;
    font-size: 13px;
    font-weight: 500;
}

.page-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ============================================
   5. Cards
   ============================================ */
.card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--card-shadow);
    margin-bottom: 12px;
}

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

.card-header h2, .card-header h3 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-heading);
    margin: 0;
}

/* ============================================
   6. Tables
   ============================================ */
.table-card {
    padding: 0 !important;
    overflow: hidden;
    background: var(--bg-surface);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--line);
}

.table-card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-surface-2);
}

.table-card-header h2 {
    font-size: 16px;
    font-weight: 800;
    color: var(--text-heading);
    margin: 0;
}

.standard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.standard-table thead tr {
    background: var(--bg-surface-2);
}

.standard-table th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 700;
    color: var(--text-muted);
    border-bottom: 2px solid var(--line-strong);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.standard-table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
    color: var(--text-body);
    font-size: 13.5px;
}

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

.standard-table tr:hover td {
    background: var(--bg-surface-2);
}

/* ============================================
   7. Buttons
   ============================================ */
.btn-std {
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: none;
    outline: none;
    text-decoration: none;
    white-space: nowrap;
}

.btn-std-primary {
    background: var(--accent) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(19, 103, 200, 0.2);
}

.btn-std-primary:hover {
    background: var(--accent-dark) !important;
    transform: translateY(-1px);
}

.btn-std-secondary {
    background: var(--bg-surface) !important;
    color: var(--primary) !important;
    border: 1px solid var(--line) !important;
}

.btn-std-secondary:hover {
    background: var(--bg-surface-2) !important;
    transform: translateY(-1px);
}

.btn-std-danger {
    background: var(--danger) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(185, 28, 28, 0.2);
}

.btn-std-danger:hover {
    background: #dc2626 !important;
    transform: translateY(-1px);
}

.btn-std-success {
    background: var(--success) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.2);
}

.btn-std-success:hover {
    background: #15803d !important;
    transform: translateY(-1px);
}

.btn-std-info {
    background: var(--secondary) !important;
    color: white !important;
    box-shadow: 0 4px 12px rgba(19, 103, 200, 0.2);
}

.btn-std-info:hover {
    background: var(--primary-dark) !important;
    transform: translateY(-1px);
}

.btn-std-warning {
    background: var(--warning) !important;
    color: white !important;
}

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

.btn-std-xs {
    padding: 4px 8px;
    font-size: 11px;
    border-radius: 6px;
}

/* ============================================
   8. Forms
   ============================================ */
.form-group {
    margin-bottom: 12px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 5px;
    color: var(--text-muted);
}

.form-control-std {
    width: 100%;
    padding: 9px 14px;
    border: 2px solid var(--line-strong);
    border-radius: 10px;
    background: var(--bg-surface);
    font-size: 14px;
    color: var(--text-body);
    outline: none;
    transition: 0.2s;
    font-family: inherit;
}

.form-control-std:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-control-std::placeholder {
    color: var(--text-muted);
}

select.form-control-std {
    appearance: auto;
    padding-top: 5px;
    padding-bottom: 5px;
}

textarea.form-control-std {
    resize: vertical;
    min-height: 80px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

/* Checkbox / Radio custom */
.form-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0;
}

.form-check input[type="checkbox"],
.form-check input[type="radio"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.form-check label {
    font-size: 13.5px;
    color: var(--text-body);
    cursor: pointer;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-slider {
    width: 44px;
    height: 24px;
    background: var(--line-strong);
    border-radius: 12px;
    cursor: pointer;
    transition: 0.2s;
    position: relative;
}

.toggle-slider::after {
    content: '';
    width: 18px;
    height: 18px;
    background: white;
    border-radius: 50%;
    position: absolute;
    top: 3px;
    left: 3px;
    transition: 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.toggle-switch input:checked + .toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked + .toggle-slider::after {
    transform: translateX(20px);
}

.toggle-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-body);
}

/* ============================================
   9. Badges / Pills
   ============================================ */
.badge-pill {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.badge-success {
    background: #dcfce7;
    color: #15803d;
}

.badge-warning {
    background: #fef9c3;
    color: #a16207;
}

.badge-danger {
    background: #fee2e2;
    color: #b91c1c;
}

.badge-info {
    background: #dbeafe;
    color: #1d4ed8;
}

.badge-neutral {
    background: #f1f5f9;
    color: #64748b;
}

/* ============================================
   10. Metric Cards
   ============================================ */
.metric-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.metric-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--card-shadow);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
    text-decoration: none;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.metric-card-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-heading);
    font-variant-numeric: tabular-nums;
}

.metric-card-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 2px;
}

.metric-card-icon {
    font-size: 20px;
    margin-bottom: 8px;
}

.metric-card.blue { border-top: 3px solid var(--primary); }
.metric-card.blue .metric-card-icon { color: var(--primary); }
.metric-card.green { border-top: 3px solid var(--success); }
.metric-card.green .metric-card-icon { color: var(--success); }
.metric-card.orange { border-top: 3px solid var(--warning); }
.metric-card.orange .metric-card-icon { color: var(--warning); }
.metric-card.red { border-top: 3px solid var(--danger); }
.metric-card.red .metric-card-icon { color: var(--danger); }

/* ============================================
   11. Kanban Board (Worklist)
   ============================================ */
.kanban-board {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    min-height: 500px;
}

.kanban-column {
    background: var(--bg-surface-2);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
}

.kanban-column-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px;
    margin-bottom: 8px;
    border-bottom: 2px solid var(--line);
}

.kanban-column-title {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-heading);
}

.kanban-count {
    background: var(--line-strong);
    color: var(--text-muted);
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 700;
}

.kanban-cards {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.kanban-card {
    background: var(--bg-surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    box-shadow: var(--card-shadow);
    transition: all 0.15s;
    cursor: pointer;
}

.kanban-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    transform: translateY(-1px);
}

.kanban-card.emergency {
    border-left: 3px solid var(--danger);
    background-color: #fef2f2 !important;
}

.kanban-card.special-needs {
    border-left: 3px solid var(--warning);
    background-color: #fffbeb !important;
}

.kanban-card-hn {
    font-size: 13px;
    font-weight: 800;
    color: var(--text-heading);
    font-variant-numeric: tabular-nums;
}

.kanban-card-name {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.kanban-card-technique {
    font-size: 11px;
    color: var(--primary);
    font-weight: 600;
    margin-top: 4px;
}

.kanban-card-time {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-variant-numeric: tabular-nums;
}

.kanban-card-actions {
    margin-top: 8px;
    display: flex;
    gap: 4px;
}

/* ============================================
   12. Technique Selector (Request Form)
   ============================================ */
.technique-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
}

.technique-card {
    border: 2px solid var(--line);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--bg-surface);
}

.technique-card:hover {
    border-color: var(--primary-light);
    background: #eff6ff;
}

.technique-card.selected {
    border-color: var(--accent);
    background: var(--accent-light);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15);
}

.technique-card img {
    width: 60px;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 6px;
    background: var(--bg-surface-2);
}

.technique-card-name {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-heading);
    line-height: 1.3;
}

.technique-category-header {
    font-size: 14px;
    font-weight: 800;
    color: var(--text-heading);
    margin: 16px 0 8px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--accent);
    display: flex;
    align-items: center;
    gap: 8px;
}

.technique-category-header i {
    color: var(--accent);
}

/* ============================================
   13. Urgency Radio Selector
   ============================================ */
.urgency-selector {
    display: flex;
    gap: 10px;
}

.urgency-option {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--line);
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.urgency-option.selected-general {
    border-color: var(--success);
    background: #dcfce7;
}

.urgency-option.selected-special {
    border-color: var(--warning);
    background: #fef9c3;
}

.urgency-option.selected-emergency {
    border-color: var(--danger);
    background: #fee2e2;
}

.urgency-option input { display: none; }

.urgency-icon {
    font-size: 24px;
    margin-bottom: 4px;
}

.urgency-label {
    font-size: 12px;
    font-weight: 700;
}

/* ============================================
   14. Vital Signs Display
   ============================================ */
.vital-signs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.vital-card {
    background: var(--bg-surface-2);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    border: 1px solid var(--line);
}

.vital-card-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 4px;
}

.vital-card-value {
    font-size: 22px;
    font-weight: 800;
    color: var(--text-heading);
    font-variant-numeric: tabular-nums;
}

.vital-card-unit {
    font-size: 11px;
    color: var(--text-muted);
}

/* ============================================
   15. History Timeline
   ============================================ */
.history-timeline {
    position: relative;
    padding-left: 20px;
}

.history-timeline::before {
    content: '';
    position: absolute;
    left: 6px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--line-strong);
}

.timeline-item {
    position: relative;
    padding: 8px 0 8px 16px;
    border-bottom: 1px solid var(--line);
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -17px;
    top: 14px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--bg-surface);
}

.timeline-date {
    font-size: 11px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
}

.timeline-content {
    font-size: 13px;
    color: var(--text-body);
    margin-top: 2px;
}

/* ============================================
   16. Scrollbars & Loader
   ============================================ */
::-webkit-scrollbar {
    width: 7px;
    height: 7px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

#global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.85);
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    gap: 16px;
}

#global-loader.show {
    display: flex;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 4px solid #e2e8f0;
    border-top: 4px solid var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    font-size: 13px;
    color: var(--text-muted);
    font-weight: 600;
}

/* ============================================
   17. Grid helpers
   ============================================ */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
.grid-7030 { display: grid; grid-template-columns: 7fr 3fr; gap: 16px; }
.grid-6040 { display: grid; grid-template-columns: 6fr 4fr; gap: 16px; }
.grid-5050 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ============================================
   18. Utility Classes
   ============================================ */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-muted) !important; }
.text-accent { color: var(--accent) !important; }
.text-danger { color: var(--danger) !important; }
.text-success { color: var(--success) !important; }
.text-warning { color: var(--warning) !important; }
.font-bold { font-weight: 700; }
.font-extrabold { font-weight: 800; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.d-flex { display: flex; }
.d-flex-center { display: flex; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.flex-1 { flex: 1; }
.hidden { display: none !important; }

/* ============================================
   19. Empty State
   ============================================ */
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 14px;
    font-weight: 600;
}

/* ============================================
   20. Print Styles
   ============================================ */
@media print {
    #sidebar, .top-navbar, .toggle-sidebar, .btn-std, .pagination-container, .no-print {
        display: none !important;
    }
    #content { margin: 0 !important; padding: 0 !important; }
    .main-body { padding: 0 !important; }
    .card, .table-card { box-shadow: none !important; border: none !important; }
    body { background: white !important; }
}

/* ============================================
   21. Icon rendering fix
   ============================================ */
.menu-item i, .card i, .btn-std i {
    transform: translateZ(0) !important;
    backface-visibility: hidden !important;
}

/* ============================================
   22. Responsive (Tablet)
   ============================================ */
@media (max-width: 1024px) {
    .kanban-board {
        grid-template-columns: repeat(2, 1fr);
    }
    .grid-7030, .grid-6040 {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #sidebar {
        transform: translateX(-100%);
    }
    #sidebar.open {
        transform: translateX(0);
    }
    #content {
        margin-left: 0;
    }
    .kanban-board {
        grid-template-columns: 1fr;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .metric-cards {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ============================================
   23. Reduced Motion
   ============================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================
   24. Login Page
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-main);
    padding: 20px;
}

.login-card {
    background: var(--bg-surface);
    border-radius: 16px;
    padding: 40px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.06);
    border: 1px solid var(--line);
}

.login-logo {
    text-align: center;
    margin-bottom: 24px;
}

.login-logo i {
    font-size: 40px;
    color: var(--accent);
    margin-bottom: 8px;
}

.login-logo h1 {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
}

.login-logo p {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 4px;
}

.login-error {
    background: #fee2e2;
    color: #b91c1c;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Sub-options panel */
.sub-options-panel {
    background: var(--bg-surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px;
    margin-top: 8px;
    display: none;
}

.sub-options-panel.show {
    display: block;
}

/* ============================================
   14. SweetAlert2 Custom Styling Overrides
   ============================================ */
.swal2-popup {
    border-radius: 16px !important;
    padding: 24px !important;
    font-family: 'Inter', 'Sarabun', sans-serif !important;
}

.swal2-popup .swal2-title {
    font-size: 20px !important;
    font-weight: 800 !important;
    color: var(--text-heading) !important;
    margin-bottom: 20px !important;
}

.swal2-popup .swal2-input,
.swal2-popup .swal2-select,
.swal2-popup .swal2-textarea {
    width: 100% !important;
    max-width: 100% !important;
    height: 44px !important;
    margin: 6px 0 16px 0 !important;
    padding: 10px 16px !important;
    border: 1.5px solid #cbd5e1 !important;
    border-radius: 10px !important;
    background: #ffffff !important;
    color: #1e293b !important;
    font-size: 14px !important;
    font-family: inherit !important;
    box-sizing: border-box !important;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05) !important;
    outline: none !important;
    transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.swal2-popup .swal2-input::placeholder,
.swal2-popup .swal2-textarea::placeholder {
    color: #94a3b8 !important;
}

.swal2-popup .swal2-textarea {
    height: 100px !important;
}

.swal2-popup .swal2-input:focus,
.swal2-popup .swal2-select:focus,
.swal2-popup .swal2-textarea:focus {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 3px rgba(19, 103, 200, 0.15) !important;
}

.swal2-popup .swal2-actions {
    margin-top: 16px !important;
    gap: 12px !important;
}

.swal2-popup .swal2-confirm,
.swal2-popup .swal2-cancel {
    padding: 10px 24px !important;
    border-radius: 12px !important;
    font-weight: 700 !important;
    font-size: 14px !important;
    font-family: inherit !important;
    border: none !important;
    box-shadow: none !important;
    transition: all 0.2s ease !important;
}

.swal2-popup .swal2-confirm {
    background-color: var(--accent) !important;
    color: white !important;
}

.swal2-popup .swal2-confirm:hover {
    background-color: var(--accent-dark) !important;
    transform: translateY(-1px);
}

.swal2-popup .swal2-cancel {
    background-color: #64748b !important;
    color: white !important;
}

.swal2-popup .swal2-cancel:hover {
    background-color: #475569 !important;
    transform: translateY(-1px);
}

/* Custom Select Dropdown & Scrollbar Styles */
.custom-option {
    transition: background 0.15s ease, color 0.15s ease;
}
.custom-option:hover {
    background: #f1f5f9 !important;
    color: var(--primary) !important;
}
.custom-option.selected {
    background: #e0f2fe !important;
    color: var(--primary) !important;
    font-weight: 600 !important;
}
.custom-select-options::-webkit-scrollbar {
    width: 6px;
}
.custom-select-options::-webkit-scrollbar-track {
    background: #f8fafc;
    border-radius: 4px;
}
.custom-select-options::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}
.custom-select-options::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

