﻿/* wwwroot/css/site.css */

html {
    position: relative;
}

body {
    font-family: 'Prompt', sans-serif;
}

th.fit-content,
td.fit-content {
    white-space: nowrap;
    width: 1%;
    max-width: 12rem;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-bottom {
    backdrop-filter: blur(1rem);
}

.sticky-top {
    backdrop-filter: blur(1rem);
}

#sidebarRail .btn.btn-light {
    background-color: var(--bs-body-bg);
}


.form-floating > select.form-select + .select2-container--bootstrap-5 .select2-selection {
    height: calc(3.5rem + 2px);
    padding: 1rem 0.75rem;
    display: flex;
    align-items: center;
}

.form-floating > select.form-select + .select2-container--bootstrap-5 .select2-selection__rendered {
    padding-left: 0;
    padding-top: 1rem;
}

.form-floating > select.form-select + .select2-container--bootstrap-5 .select2-selection__arrow {
    top: 50%;
    transform: translateY(-50%);
}

.form-floating > .form-select:not(:placeholder-shown) ~ label,
.form-floating > .form-select:focus ~ label {
    z-index: 5;
}

.form-select-xs, .form-control-xs {
    padding: 0.25rem 0.5rem;
    font-size: .75rem;
}

/* ==========================================================================
   ยูทิลิตี้เพิ่มเติมสำหรับการกำจัด Inline CSS และปรับปรุง UX/UI 
   ========================================================================== */

/* คุมความสูงของ Header ให้เป๊ะ เพื่อป้องกัน Phantom Scrollbar */
.topbar {
    height: var(--topbar-height, 56px);
    box-sizing: border-box;
}

.sidebar-header-height {
    height: var(--topbar-height, 56px);
    flex-shrink: 0;
}

/* คลาสทดแทน Inline CSS */
.badge-compact {
    font-size: 0.65rem;
}

.min-w-0 {
    min-width: 0 !important;
}

.min-w-500 {
    min-width: 500px;
}

.min-w-60 {
    min-width: 60px;
}

.max-w-200 {
    max-width: 200px;
}

.max-w-250 {
    max-width: 250px;
}

.max-h-300 {
    max-height: 300px;
}

.cursor-grab {
    cursor: grab;
}

.square-28 {
    width: 28px;
    height: 28px;
}

.square-36 {
    width: 36px;
    height: 36px;
}

.square-38 {
    width: 38px;
    height: 38px;
}

.square-42 {
    width: 42px;
    height: 42px;
}

.square-54 {
    width: 54px;
    height: 54px;
}

.h-4px {
    height: 4px;
}

.fs-08 {
    font-size: 0.8rem;
}

.fs-07 {
    font-size: 0.7rem;
}

.fs-dot-xs {
    font-size: 0.5rem;
}

.lh-relaxed {
    line-height: 1.6;
}

.text-pre-wrap {
    white-space: pre-wrap;
}

.sticky-panel-top-24 {
    top: 1.5rem;
    z-index: 10;
}

.avatar-circle-xs {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

.custom-checkbox-wrapper:hover {
    background-color: var(--bs-light);
}

.form-check-input.permission-checkbox:checked {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.fs-icon-huge {
    font-size: 4rem;
}

.fs-icon-xl {
    font-size: 3rem;
}

.textarea-fixed-md {
    height: 100px !important;
}

.switch-lg {
    width: 3rem;
    height: 1.5rem;
}

.img-preview-lg {
    max-height: 250px;
}

/* Animation สำหรับ Dropdown Menu ให้ดูนุ่มนวลขึ้น */
.dropdown-menu {
    animation: dropdownFade 0.2s ease-out forwards;
    transform-origin: top center;
}

@keyframes dropdownFade {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.sticky-panel-desktop {
    top: 80px;
    z-index: 10;
}

@media (max-width: 1199.98px) {
    .sticky-panel-desktop {
        position: static !important;
        top: auto;
    }
}

.table-header-theme th {
    background-color: var(--bs-tertiary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

/* =========================
   Shared Upsert Dark Theme
   ========================= */
[data-bs-theme="dark"] .upsert-form-page .bg-white {
    background-color: var(--bs-secondary-bg) !important;
}

[data-bs-theme="dark"] .upsert-form-page .text-dark {
    color: var(--bs-body-color) !important;
}

[data-bs-theme="dark"] .upsert-form-page .text-muted,
[data-bs-theme="dark"] .upsert-form-page .text-body-secondary {
    color: var(--bs-secondary-color) !important;
}

[data-bs-theme="dark"] .upsert-form-page .border-light,
[data-bs-theme="dark"] .upsert-form-page .border-light-subtle {
    border-color: var(--bs-border-color) !important;
}

[data-bs-theme="dark"] .upsert-form-page .card,
[data-bs-theme="dark"] .upsert-form-page .admin-card {
    box-shadow: 0 .5rem 1rem rgba(0, 0, 0, .35) !important;
}

[data-bs-theme="dark"] .upsert-form-page .form-control,
[data-bs-theme="dark"] .upsert-form-page .form-select,
[data-bs-theme="dark"] .upsert-form-page textarea.form-control {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .upsert-form-page .form-control:read-only,
[data-bs-theme="dark"] .upsert-form-page .form-control:disabled {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-secondary-color);
}

[data-bs-theme="dark"] .upsert-form-page .suggest-dropdown {
    background-color: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
}

[data-bs-theme="dark"] .upsert-form-page .suggest-dropdown .list-group-item {
    background-color: var(--bs-secondary-bg);
    color: var(--bs-body-color);
    border-color: var(--bs-border-color);
}

[data-bs-theme="dark"] .upsert-form-page .suggest-dropdown .list-group-item:hover,
[data-bs-theme="dark"] .upsert-form-page .suggest-dropdown .list-group-item:focus {
    background-color: rgba(var(--bs-primary-rgb), .15);
    color: var(--bs-body-color);
}

.admin-card {
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}

    .admin-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15) !important;
    }

.hover-elevate {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.hover-elevate:hover {
    transform: translateY(-2px);
    box-shadow: 0 .5rem 1rem rgba(0,0,0,.15) !important;
}

.timeline-steps {
    position: relative;
}

.timeline-steps .step {
    position: relative;
    padding-left: 2.5rem;
    padding-bottom: 1.5rem;
}

.timeline-steps .step:last-child {
    padding-bottom: 0;
}

.timeline-steps .step::before {
    content: "";
    position: absolute;
    left: 0.75rem;
    top: 0;
    bottom: 0;
    width: 2px;
    background-color: var(--bs-border-color);
}

.timeline-steps .step:last-child::before {
    display: none;
}

.timeline-steps .step-icon {
    position: absolute;
    left: 0;
    top: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--bs-body-bg);
    border: 2px solid var(--bs-border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
}

.timeline-steps .step-icon.active {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
}

/* .text-truncate class removed to avoid conflict with Bootstrap */

.upsert-form-page .admin-card,
.upsert-form-page .admin-card:hover {
    transform: none !important;
    transition: none !important;
}

.storage-address-switch-wrap .form-check-input {
    margin-top: 0;
}

.storage-address-switch-wrap .form-check-label {
    line-height: 1.2;
}

/* Better spacing for pill action buttons; use this wrapper instead of btn-group with rounded-pill buttons */
.action-btn-row {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    flex-wrap: nowrap;
}

/* คอนเทนเนอร์ความสูงคงที่สำหรับกราฟ/แผนภูมิ */
.chart-container-sm {
    height: 280px;
}

/* ===== Notification Panel ===== */
.notification-panel-scrollable {
    max-height: 380px;
    overflow-y: auto;
}

.notification-item {
    cursor: pointer;
    border-bottom: 1px solid var(--bs-border-color-translucent);
    transition: background-color 0.15s ease;
}

.notification-item:last-child {
    border-bottom: none;
}

.notification-item:hover {
    background-color: var(--bs-tertiary-bg);
}

.notification-item.unread {
    background-color: var(--bs-primary-bg-subtle);
}

.notification-item.unread:hover {
    background-color: var(--bs-primary-bg-subtle);
    filter: brightness(0.97);
}

.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
