﻿/* ============================================================
   MỤC LỤC
   1.  Theme variables
   2.  Blazor error UI & loading progress
   3.  Loading screens (splash, overlay, spinner)
   4.  Layout fixes (navbar, page content, dashboard)
   5.  Forms & inputs
   6.  Validation
   7.  Tables
   8.  Dropdowns, typeahead & date picker
   9.  Components (info-box, btn-app, badge, progress...)
   10. Màu nền ngày (thứ 7, CN, ngày lễ)
   11. QuillJS view
   12. FullCalendar / RoomPlan / RoomMap
   13. Occupancy & Leads
   14. SweetAlert2
   15. Keyframes
   16. Responsive
   ============================================================ */


/* ============================================================
   1. THEME VARIABLES
   ============================================================ */
[data-theme=material][data-theme-colors=purple] {
    --vz-primary: #445577;
    --vz-primary-rgb: 68, 85, 119;
    --vz-primary-bg-subtle: rgba(68, 85, 119, 0.15);
    --vz-primary-border-subtle: rgba(68, 85, 119, 0.3);
    --vz-primary-text-emphasis: #6179aa;
}


/* ============================================================
   2. BLAZOR ERROR UI & LOADING PROGRESS
   ============================================================ */
#blazor-error-ui {
    display: none;
    position: fixed;
    width: 100%;
    z-index: 1200;
}

.loading-progress {
    position: relative;
    display: block;
    width: 10rem;
    height: 8rem;
    margin: 45vh auto 1rem auto;
}

.loading-progress circle {
    fill: none;
    stroke: #e0e0e0;
    stroke-width: 0.3rem;
    transform-origin: 50% 50%;
    transform: rotate(-90deg);
}

.loading-progress circle:last-child {
    stroke: var(--vz-primary);
    stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
    transition: stroke-dasharray 0.05s ease-in-out;
}

.loading-progress-text {
    position: absolute;
    color: var(--vz-primary);
    text-align: center;
    font-weight: bold;
    inset: calc(45vh + 3.25rem) 0 auto 0.2rem;
}

.loading-progress-text:after {
    content: var(--blazor-load-percentage-text, "Loading");
}


/* ============================================================
   3. LOADING SCREENS
   ============================================================ */
/* Phần chung: căn giữa màn hình */
.loading-screen,
.loading {
    position: fixed;
    display: block;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.loading-screen {
    z-index: 1200;
}

.loading {
    z-index: 1160;
}

/* Phần chung: lớp phủ toàn màn hình */
.loading-screen-overlay,
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.loading-screen-overlay {
    z-index: 1160;
    opacity: 1;
    background: white;
}

.loading-overlay {
    z-index: 1159;
    background: rgba(255, 255, 255, 0.7);
}

/* Logo hiệu ứng — giữ logo đứng yên, vòng tròn quay quanh */
.loading-wrapper {
    position: relative;
    width: 110px;
    height: 110px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.loading-logo {
    width: 110px;
    height: auto;
    position: relative;
    z-index: 10;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.8));
}

.loading-wrapper::before {
    content: "";
    position: absolute;
    top: -10px;
    left: -10px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: #D3D3D3; /* Xám nhạt tinh tế */
    border-bottom-color: #D3D3D3;
    border-left-color: #D3D3D3;
    border-right-color: transparent; /* Trong suốt để giữ hiệu ứng quay */
    box-shadow: 0 0 10px rgba(211, 211, 211, 0.3);
    animation: spin 1.2s ease-in-out infinite;
}

.spinner-gradient {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 4px solid #ecf0f1; /* Xám trắng nhạt */
    border-right-color: var(--vz-primary);
    animation: spin 0.8s linear infinite;
}


/* ============================================================
   4. LAYOUT FIXES
   ============================================================ */
a {
    cursor: pointer;
}

.navbar-header {
    padding: 0 0.75rem;
}

.page-content {
    padding: calc(45px + 2rem) 0.75rem 0;
}

.navbar-menu .navbar-nav .nav-link {
    font-weight: 500;
}

.dashboard-content {
    height: calc(100vh - 162px);
    text-align: center;
    position: relative;
    background-position: center;
    background-repeat: no-repeat;
    background-size: 60%;
}

.error-page {
    padding-top: 100px;
}

.card {
    margin-bottom: 8px;
}


/* ============================================================
   5. FORMS & INPUTS
   ============================================================ */
.form-group {
    margin-bottom: 0.4rem !important;
}

.form-label {
    font-weight: 600 !important;
    color: var(--vz-heading-color);
    margin-bottom: 0.1rem !important;
}

.col-form-label {
    font-weight: 600;
    padding-top: calc(0.3rem + var(--vz-border-width));
}

.form-control-sm,
.input-group-sm .form-control-sm,
.input-group-sm > .input-group-text {
    font-size: var(--vz-font-13);
}

.btn-sm {
    font-size: var(--vz-font-13);
}

.input-step {
    height: 29.5px;
}

/* Input gạch chân (underline style) */
.form-control.form-control-border {
    border-top: 0;
    border-left: 0;
    border-right: 0;
    border-radius: 0;
    box-shadow: inherit;
}

    .form-control.form-control-border.border-width-2 {
        border-bottom-width: 2px;
    }

.none-border {
    border: 0;
    outline: 0;
}

.form-icon.right i {
    right: 8px;
}

.search-box .search-icon {
    left: 8px;
}

.search-box .form-control {
    padding-left: 25px;
}

.search-box .form-control-lg {
    padding-left: 30px;
}

input[type="search"]::-webkit-search-cancel-button {
    cursor: pointer;
}

.ql-container {
    height: 85px;
}


/* ============================================================
   6. VALIDATION
   ============================================================ */
input.invalid,
textarea.invalid {
    border: 1px solid #ced4da !important;
}

.validation-message {
    width: 100%;
    margin-top: .25rem;
    font-size: 85%;
    color: #f06548;
}


/* ============================================================
   7. TABLES
   ============================================================ */
.table-sm,
.table-sm td input {
    font-size: var(--vz-font-12);
}

.table .form-check {
    text-align: center;
}

.table .sticky-top {
    z-index: 3 !important;
}

.table-card td:first-child,
.table-card th:first-child {
    padding-left: 4px;
}

.table-card td:last-child,
.table-card th:last-child {
    padding-right: 4px;
}

td.active {
    background-color: var(--vz-primary) !important;
}

/* Bảng có header cố định khi cuộn */
.table-head-fixed > thead > tr:nth-child(1) > th {
    border-bottom: 0;
    box-shadow: inset 0 1px 0 #dee2e6, inset 0 -1px 0 #dee2e6;
    position: sticky;
    top: 0;
    z-index: 10;
}

.table.table-head-fixed > tbody > tr > th:first-child {
    background-color: #f3f6f9;
    position: sticky;
    left: 0;
    z-index: 2;
}

.table.table-head-fixed > thead > tr > th:first-child {
    left: 0;
    z-index: 15 !important;
}

.square-td {
    font-weight: bold;
    padding: 0 2px !important;
    min-width: 57px;
}

.dutyroster-input {
    text-align: center;
    font-weight: bold;
    padding: 1px;
    border: 0;
    outline: 0;
    font-size: var(--vz-font-12);
}


/* ============================================================
   8. DROPDOWNS, TYPEAHEAD & DATE PICKER
   ============================================================ */
.dropdown-item.active,
.dropdown-item:active {
    color: white;
    background-color: var(--vz-primary) !important;
}

.bootstrap-select .dropdown-toggle {
    min-height: calc(1.5em + 0.5rem + calc(var(--vz-border-width, 1px) * 2));
    border: var(--vz-border-width) solid var(--vz-input-border-custom);
    box-shadow: none;
}

/* Blazored Typeahead */
.blazored-typeahead__results {
    z-index: 20;
}

.blazored-typeahead__active-item,
.blazored-typeahead__result:hover,
.blazored-typeahead__result:focus {
    background-color: var(--vz-primary) !important;
    border-top: 1px solid var(--vz-primary);
    border-bottom: 1px solid var(--vz-primary);
}

    .blazored-typeahead__active-item .text-info,
    .blazored-typeahead__result:hover .text-info {
        color: #fff !important;
    }

/* Date range picker */
.daterangepicker .ranges li {
    font-weight: bold;
    background-color: #f3f6f9;
    border: 1px solid #f3f6f9;
    border-radius: 4px;
    margin: 5px;
}

    .daterangepicker .ranges li.active {
        background-color: var(--vz-primary) !important;
    }

.daterangepicker td.today {
    background-color: #0d6efd;
    color: #fff;
}

.monthselect,
.yearselect {
    border: var(--vz-border-width) solid var(--vz-input-border-custom);
    border-radius: var(--vz-border-radius);
}


/* ============================================================
   9. COMPONENTS
   ============================================================ */
.bg-primary,
.bg-primary > a {
    color: #fff !important;
}

.actions-btn {
    font-weight: bold;
}

.active_btnPMode {
    background-color: var(--vz-primary) !important;
    color: white !important;
}

/* Nút dạng app (icon lớn) */
.btn-app {
    border-radius: 3px;
    background-color: #f8f9fa;
    color: #6c757d;
    font-size: 14px;
    font-weight: bold;
    padding: 5px 5px 10px 5px;
    position: relative;
    text-align: center;
    min-width: 144px;
    height: 125px;
    margin: 0 8px 10px 8px;
}

    .btn-app > .badge {
        font-size: 12px;
        font-weight: 500;
        top: -2px;
        line-height: 16px;
    }

/* Info box */
.info-box {
    box-shadow: 0 0 1px rgba(0, 0, 0, 0.125), 0 1px 3px rgba(0, 0, 0, 0.2);
    border-radius: 0.25rem;
    background-color: #fff;
    display: flex;
    min-height: 60px;
    padding: .5rem;
    position: relative;
    width: 100%;
}

    .info-box .info-box-icon {
        border-radius: 0.25rem;
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        font-size: 1.875rem;
        width: 50px;
    }

    .info-box .info-box-content {
        display: flex;
        flex-direction: column;
        justify-content: center;
        line-height: 1.8;
        flex: 1;
        padding: 0 10px;
        overflow: hidden;
    }

/* Thanh tiến trình (progress) */
.progress-container {
    position: relative;
    width: 100%;
    height: 20px;
    background: #f3f6f9;
    border-radius: 12px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    width: 0%;
    border-radius: 12px;
    background: linear-gradient(90deg, #0072ff, #00c6ff);
    box-shadow: 0 0 8px rgba(0, 114, 255, 0.5);
    transition: width 0.6s cubic-bezier(0.25, 1, 0.5, 1);
    position: relative;
    display: flex;
    align-items: center;
    padding-right: 10px;
    font-size: 12px;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 3px rgba(0, 0, 0, 0.3);
}

    /* Hiệu ứng ánh sáng chạy trên thanh tiến trình */
    .progress-bar::after {
        content: "";
        position: absolute;
        top: 0;
        left: -50px;
        width: 50px;
        height: 100%;
        background: rgba(255, 255, 255, 0.2);
        transform: skewX(-25deg);
        animation: light-wave 1.5s infinite linear;
    }

.progress-complete {
    background: linear-gradient(90deg, #28a745, #218838);
    box-shadow: 0 0 12px rgba(40, 167, 69, 0.6);
}

/* Chuông rung */
.bell-shake {
    display: inline-block;
    animation: ring 1s ease-in-out infinite;
    transform-origin: top center;
}


/* ============================================================
   10. MÀU NỀN NGÀY (Thứ 7 / Chủ nhật / Ngày lễ)
   ============================================================ */
.bg-saturday-header {
    background-color: #fff3cd !important;
}

.bg-saturday {
    background-color: #FFFCF5 !important;
}

.bg-sunday-header {
    background-color: #f8d7da !important;
}

.bg-sunday {
    background-color: #FDF7F7 !important;
}

.bg-holiday-header {
    background-color: #FACCE5 !important;
}

.bg-holiday {
    background-color: #FEF4F9 !important;
}


/* ============================================================
   11. QUILLJS VIEW — chuẩn hóa margin/padding khi hiển thị
   ============================================================ */
.quill-note-view {
    line-height: 1.2;
    white-space: normal;
    word-break: break-word;
}

    .quill-note-view p {
        margin: 0;
        padding: 0;
    }

    .quill-note-view ul,
    .quill-note-view ol {
        margin: 0;
        padding-left: 1.2rem;
    }

    .quill-note-view br {
        line-height: 1.2;
    }

/* ============================================================
   12. FULLCALENDAR / ROOMPLAN / ROOMMAP
   ============================================================ */
.fc-event-main-frame {
    overflow: hidden;
}

    .fc-event-main-frame .badge,
    .fc-event-main-frame small.ms-auto {
        flex-shrink: 0;
    }

    .fc-event-main-frame small:not(.ms-auto) {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        min-width: 0;
    }

/* Căn giữa resource label (RoomPlan) */
.fc-datagrid-cell-frame {
    display: flex !important;
    align-items: center !important;
}

.fc-event {
    border: none !important;
    border-radius: 7px !important;
    /* Lớp sáng nhẹ phủ lên màu nền, không cần pseudo-element */
    background-image: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0));
    filter: saturate(0.72) brightness(1.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.10), 0 2px 6px rgba(0, 0, 0, 0.08) !important;
}

/* Hover chung cho event & room card */
.fc-event,
.room-card {
    transition: transform 0.16s ease, box-shadow 0.16s ease;
}

    .fc-event:hover,
    .room-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.16), 0 2px 4px rgba(0, 0, 0, 0.10) !important;
    }

/* Popover đặt phòng */
.booking-popover {
    min-width: 350px !important;
}

    .booking-popover .popover-body {
        padding: 8px !important;
    }

/* Lớp phủ loading cho calendar — hiển thị ở phía trên */
.fc-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: saturate(180%) blur(8px);
    -webkit-backdrop-filter: saturate(180%) blur(8px);
    display: none;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding-top: 3rem;
    z-index: 999;
    border-radius: 0.375rem;
}

.fc-loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

    .fc-loading-spinner .spinner-border {
        width: 2.5rem;
        height: 2.5rem;
        border-width: 0.2rem;
        color: #0d6efd;
    }

    .fc-loading-spinner .text-muted {
        font-size: 0.875rem;
        font-weight: 400;
        margin: 0;
        color: #6c757d;
    }

#roomCalendar:has(.fc-loading-overlay[style*="display: flex"]) .fc {
    opacity: 0.5;
    pointer-events: none;
    filter: blur(1px);
}


/* ============================================================
   13. OCCUPANCY & LEADS
   ============================================================ */
.occ i.fa-circle-check,
.occ i.fa-circle-question {
    font-size: 13px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
    transition: transform 0.15s ease, background-color 0.15s ease;
}

    .occ i.fa-circle-check:hover,
    .occ i.fa-circle-question:hover {
        transform: scale(1.1);
    }

.occ i.fa-triangle-exclamation {
    animation: warningPulse 1.5s infinite ease-in-out;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.6);
}

/* Leads */
.badge.cursor-pointer {
    cursor: pointer;
    transition: all 0.2s ease;
}

    .badge.cursor-pointer:hover {
        opacity: 0.8;
        transform: translateY(-2px);
    }


/* ============================================================
   14. SWEETALERT2
   ============================================================ */
div:where(.swal2-container) {
    z-index: 1165;
}

    div:where(.swal2-container) button:where(.swal2-styled):where(.swal2-confirm) {
        background-color: var(--vz-primary, #445577);
    }


/* ============================================================
   15. KEYFRAMES
   ============================================================ */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes light-wave {
    0% {
        left: -50px;
    }

    100% {
        left: 100%;
    }
}

@keyframes glow {
    0% {
        box-shadow: 0 0 10px rgba(255, 221, 0, 0.4);
    }

    100% {
        box-shadow: 0 0 25px rgba(255, 221, 0, 0.8);
    }
}

@keyframes ring {
    0% {
        transform: rotate(0);
    }

    10% {
        transform: rotate(15deg);
    }

    20% {
        transform: rotate(-15deg);
    }

    30% {
        transform: rotate(10deg);
    }

    40% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(5deg);
    }

    60% {
        transform: rotate(-5deg);
    }

    70%, 100% {
        transform: rotate(0);
    }
}


/* ============================================================
   16. RESPONSIVE
   ============================================================ */
.modal-content {
    overflow-x: hidden;
}

@media (max-width: 767.98px) {

    #OpenModalUpdate_Reservation .modal-header.bg-light,
    #OpenModalUpdate_Voucher .modal-header.bg-light {
        position: sticky;
        top: 0;
        z-index: 2001;
        flex-wrap: wrap;
    }

    #OpenModalUpdate_Reservation .modal-footer,
    #OpenModalUpdate_Voucher .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 2000;
        flex-wrap: wrap;
    }
}