/* UPLOAD/DOWNLOAD BUTTONS - made global from ordertreatments.php */
.upload-download-btn {
    background: linear-gradient(135deg, #DED447 0%, #f1e85c 100%) !important;
    border: 1px solid #DED447 !important;
    color: #1a1a1a !important;
    border-radius: 0.375rem;
    font-weight: 600;
    height: 50px;
    transition: all 0.2s ease;
    margin-bottom: 0.5rem;
}

.upload-download-btn:hover {
    background: linear-gradient(135deg, #f1e85c 0%, #fff17a 100%) !important;
    border-color: #f1e85c !important;
    color: #1a1a1a !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(222, 212, 71, 0.3);
}
/* Ensure full height for layout structure */
html,
body {
    height: 100%;
}

:root {
    --idtt-color-brand: #DED447;
    --idtt-color-bg: #1b1b1b;
    --idtt-color-surface: #1e2a36;
    --idtt-color-surface-strong: #263545;
    --idtt-color-border: #3a4f62;
    --idtt-color-text: #f1f1f1;
    --idtt-color-muted: #8fa8bf;
    --idtt-header-height: 72px;
    --idtt-bottom-nav-height: 78px;
    --idtt-page-max-width: 1280px;
    --idtt-form-select-arrow: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23DED447' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}

#appContent {
    max-height: calc(100dvh - var(--idtt-header-height));
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 0.85rem 1rem !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 1rem;
}

body.app-shell-has-bottom-nav #appContent {
    max-height: calc(100dvh - var(--idtt-header-height) - var(--idtt-bottom-nav-height));
    padding-bottom: calc(var(--idtt-bottom-nav-height) + env(safe-area-inset-bottom) + 1.25rem) !important;
}

.idtt-page {
    min-height: 100%;
    position: relative;
    width: min(100%, var(--idtt-page-max-width));
    margin: 0 auto;
}

.idtt-page-centered {
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* ── Login mode: hide navbar, let login card use full viewport ── */
body.login-mode .app-shell-header {
    display: none !important;
}
body.login-mode main {
    padding: 0 !important;
}
body.login-mode #appContent {
    max-height: 100dvh;
    min-height: 100dvh;
    padding-bottom: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
body.login-mode .idtt-page-centered {
    padding: 1rem;
}

@media (max-height: 600px) {
    body.login-mode .idtt-page-centered {
        align-items: flex-start;
        padding-top: 1rem;
        padding-bottom: 1.5rem;
    }
}

@font-face {
    font-family: 'Selawik';
    src: url('fonts/Selawik-Regular.woff2') format('woff2'),
        url('fonts/Selawik-Regular.woff') format('woff'),
        url('fonts/Selawik-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

html,
body {
    height: 100%;
    margin: 0;
    background-color: #1b1b1b;
    color: #f1f1f1;
    font-family: 'Selawik', sans-serif !important;
    /* font-family: 'Segoe UI', sans-serif !important; */
}

body {
    overflow-x: hidden;
    position: relative;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.58);
    pointer-events: none;
    z-index: 0;
}

body > * {
    position: relative;
    z-index: 1;
}

.app-shell-main {
    padding-top: 0;
    padding-bottom: 0.75rem;
}

.app-shell-header {
    position: sticky;
    top: 0;
    z-index: 1030;
    border-color: rgba(58, 79, 98, 0.72) !important;
    border-bottom-color: rgba(58, 79, 98, 0.72) !important;
    background: linear-gradient(180deg, rgba(27, 27, 27, 0.96) 0%, rgba(27, 27, 27, 0.82) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22);
}

.app-navbar-dark {
    min-height: var(--idtt-header-height);
}

.app-shell-brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
}

.app-shell-header-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.65rem;
    min-height: var(--idtt-header-height);
    padding: 0 0.85rem;
}

.app-shell-nav-left,
.app-shell-nav-center,
.app-shell-nav-right {
    min-width: 0;
}

.app-shell-nav-left,
.app-shell-nav-right {
    display: flex;
    align-items: center;
}

.app-shell-signout {
    color: #e67e22;
}

.app-shell-nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
}

.app-shell-nav-start {
    gap: 0.15rem;
}

.app-shell-main {
    max-width: 100%;
    margin: 0 auto;
}

.btn-action-link {
    min-height: 42px;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(58, 79, 98, 0.7);
    background: rgba(38, 53, 69, 0.36);
    color: var(--idtt-color-brand);
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.btn-action-link:hover,
.btn-action-link:focus,
.btn-action-link.active {
    background: var(--idtt-color-brand);
    color: #1a1a1a;
    border-color: var(--idtt-color-brand);
    transform: translateY(-1px);
}

.btn-warning,
.btn-outline-warning,
.btn[class*="btn-outline-warning"] {
    color: #1a1a1a !important;
    background-color: var(--idtt-color-brand) !important;
    border-color: var(--idtt-color-brand) !important;
}

.btn-warning:hover,
.btn-warning:focus,
.btn-warning:active,
.btn-outline-warning:hover,
.btn-outline-warning:focus,
.btn-outline-warning:active,
.btn-check:checked + .btn-outline-warning,
.btn-check:active + .btn-outline-warning,
.show > .btn-outline-warning.dropdown-toggle {
    color: #1a1a1a !important;
    background-color: #f1e85c !important;
    border-color: #f1e85c !important;
    box-shadow: 0 0 0 0.2rem rgba(222, 212, 71, 0.25) !important;
}

.btn-warning:disabled,
.btn-warning.disabled,
.btn-outline-warning:disabled,
.btn-outline-warning.disabled {
    color: #1a1a1a !important;
    background-color: rgba(222, 212, 71, 0.72) !important;
    border-color: rgba(222, 212, 71, 0.72) !important;
}

.btn[style*="color:#DED447"],
.btn[style*="color: #DED447"],
.btn[style*="color:#ded447"],
.btn[style*="color: #ded447"] {
    background: var(--idtt-color-brand) !important;
    color: #1a1a1a !important;
    border-color: var(--idtt-color-brand) !important;
}

.form-select:not([multiple]):not([size]),
.form-select:not([multiple])[size="1"] {
    padding-right: 3rem !important;
    background-image: var(--idtt-form-select-arrow), var(--bs-form-select-bg-icon, none) !important;
    background-repeat: no-repeat, no-repeat !important;
    background-position: right 0.9rem center, right 2.35rem center !important;
    background-size: 16px 12px, 16px 12px !important;
}

.form-select:disabled {
    opacity: 0.75;
}

.status-dot {
    width: 11px;
    height: 11px;
    border-radius: 999px;
    box-shadow: 0 0 0 4px rgba(38, 53, 69, 0.4);
}

.sidebar {
    width: min(88vw, 360px);
    border-right: 1px solid rgba(58, 79, 98, 0.75);
    background: linear-gradient(180deg, rgba(30, 42, 54, 0.98) 0%, rgba(27, 27, 27, 0.98) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    z-index: 1080;
}

.offcanvas-backdrop.show {
    z-index: 1040;
}

.table-dark thead th,
.table-dark thead td,
.detail-table thead th,
.detail-table thead td {
    color: #f1f1f1 !important;
}

.table-dark .text-muted,
.detail-table .text-muted {
    color: #8fa8bf !important;
}

.nav-btn-solid {
    min-height: 48px;
    display: flex;
    align-items: center;
    width: 100%;
    border: 1px solid rgba(58, 79, 98, 0.78);
    background: rgba(38, 53, 69, 0.65);
    color: var(--idtt-color-text);
    border-radius: 0.9rem;
    padding: 0.75rem 0.95rem;
    font-size: 0.96rem;
    font-weight: 600;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.nav-btn-solid:hover,
.nav-btn-solid:focus,
.nav-btn-solid.active {
    background: var(--idtt-color-brand);
    color: #1a1a1a;
    border-color: var(--idtt-color-brand);
    outline: none;
    transform: translateY(-1px);
}

.app-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1020;
    min-height: calc(var(--idtt-bottom-nav-height) + env(safe-area-inset-bottom));
    padding: 0.35rem 0.55rem calc(env(safe-area-inset-bottom) + 0.45rem);
    background: linear-gradient(180deg, rgba(27, 27, 27, 0.88) 0%, rgba(27, 27, 27, 0.98) 100%);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid rgba(58, 79, 98, 0.82);
    box-shadow: 0 -10px 26px rgba(0, 0, 0, 0.2);
}

body.app-sidebar-open .app-bottom-nav {
    opacity: 0;
    pointer-events: none;
    transform: translateY(110%);
}

body.role-devel .app-bottom-nav,
body.login-mode .app-bottom-nav {
    display: none !important;
}

.app-bottom-nav .nav {
    width: min(100%, 860px);
    margin: 0 auto;
}

.app-bottom-nav-link {
    min-height: 52px;
    padding: 0.3rem 0.2rem;
    border: 1px solid rgba(58, 79, 98, 0.78);
    border-radius: 0.85rem !important;
    background: rgba(38, 53, 69, 0.72);
    color: var(--idtt-color-muted);
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.08rem;
    font-size: 0.68rem;
    font-weight: 700;
    line-height: 1.05;
}

.app-bottom-nav-link i {
    font-size: 0.9rem;
}

.app-bottom-nav-link.active,
.app-bottom-nav-link:hover,
.app-bottom-nav-link:focus {
    background: var(--idtt-color-brand);
    color: #1a1a1a !important;
    border-color: var(--idtt-color-brand);
}

@media (max-width: 575.98px) {
    .app-bottom-nav {
        padding-left: 0.45rem;
        padding-right: 0.45rem;
    }

    .app-bottom-nav .nav {
        gap: 0.3rem !important;
    }

    .app-bottom-nav-link {
        min-height: 50px;
        font-size: 0.64rem;
    }
}

.idtt-page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.idtt-page-title {
    margin: 0;
    color: var(--idtt-color-text);
    font-size: clamp(1.05rem, 1rem + 0.6vw, 1.45rem);
    font-weight: 700;
}

.idtt-page-subtitle {
    margin: 0.25rem 0 0;
    color: var(--idtt-color-muted);
    font-size: 0.86rem;
}

.idtt-surface-card {
    background: linear-gradient(180deg, rgba(30, 42, 54, 0.96) 0%, rgba(27, 27, 27, 0.92) 100%);
    border: 1px solid rgba(58, 79, 98, 0.8);
    border-radius: 1rem;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.14);
}

.idtt-table-shell {
    background: rgba(30, 42, 54, 0.88);
    border: 1px solid rgba(58, 79, 98, 0.78);
    border-radius: 1rem;
    padding: 1rem;
}

.idtt-sticky-action-bar {
    position: sticky;
    bottom: calc(env(safe-area-inset-bottom) + 0.75rem);
    z-index: 20;
    padding: 0.85rem;
    border: 1px solid rgba(58, 79, 98, 0.78);
    border-radius: 1rem;
    background: rgba(27, 27, 27, 0.94);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 16px 28px rgba(0, 0, 0, 0.18);
}

@media (min-width: 768px) {
    #appContent {
        padding: 1rem 1rem 1.25rem !important;
    }

    body.app-shell-has-bottom-nav #appContent {
        padding-bottom: calc(var(--idtt-bottom-nav-height) + env(safe-area-inset-bottom) + 1.15rem) !important;
    }
}

@media (min-width: 992px) {
    #appContent {
        padding: 1.1rem 1.1rem 1.35rem !important;
    }

    body.app-shell-has-bottom-nav #appContent {
        padding-bottom: 1.35rem !important;
    }

    .app-shell-header-row {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 1rem;
        padding: 0 1.1rem;
        position: relative;
    }

    .app-shell-nav-start {
        flex: 1 1 auto;
        flex-wrap: nowrap;
        gap: 0.1rem;
        min-width: 0;
        overflow-x: visible;
        overflow-y: visible;
        scrollbar-width: none;
    }

    .app-shell-nav-start::-webkit-scrollbar {
        display: none;
    }

    .app-shell-nav-center {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        justify-content: center;
        flex: 0 0 auto;
        z-index: 1;
        pointer-events: none;
    }

    .app-shell-brand {
        justify-content: center;
        margin: 0 !important;
        pointer-events: auto;
    }

    .app-shell-brand img {
        height: 36px;
        width: auto;
        display: block;
    }

    .app-shell-nav-right {
        justify-content: flex-end;
        white-space: nowrap;
        padding-left: 0.35rem;
        gap: 0.2rem;
    }

    .app-shell-signout {
        color: #e67e22;
    }

    .app-shell-signout:hover,
    .app-shell-signout:focus,
    .app-shell-signout.active {
        color: #ffb15e;
    }

    .btn-action-link {
        min-height: auto;
        padding: 0.15rem 0.3rem;
        border-radius: 0;
        border: 0;
        background: transparent;
        color: var(--idtt-color-muted);
        font-weight: 700;
        line-height: 1.2;
    }

    .btn-action-link:hover,
    .btn-action-link:focus {
        background: transparent;
        color: var(--idtt-color-brand);
        border: 0;
        transform: none;
        box-shadow: none;
    }

    .btn-action-link.active {
        background: transparent;
        color: var(--idtt-color-brand);
        border: 1px solid var(--idtt-color-brand);
        border-radius: 0.375rem;
        box-shadow: none;
    }

    .btn-action-link.dropdown-toggle {
        padding-right: 0.55rem;
    }

    .app-shell-nav-start .dropdown {
        position: relative;
        z-index: 1040;
    }

    .app-shell-nav-start .dropdown-menu {
        z-index: 1055;
        margin-top: 0.4rem;
    }

    .app-bottom-nav {
        display: none !important;
    }
}

@media (min-width: 1200px) {
    #appContent {
        max-height: calc(100dvh - var(--idtt-header-height));
        padding: 1.25rem 1.25rem 1.5rem !important;
    }

    body.app-shell-has-bottom-nav #appContent {
        padding-bottom: 1.5rem !important;
    }

    .idtt-page {
        width: min(100%, var(--idtt-page-max-width));
    }

    .app-shell-header-row {
        padding: 0 1.35rem;
    }
}

/* Main content area */
/* .main {
    position: relative;
    background-color: #232526;
    min-height: 100vh;
}

.main::before {
    content: "";
    position: absolute;
    top: 70px;
    left: 0;
    right: 0;
    bottom: 0;
    background: url('../images/bg.jpg') no-repeat center center;
    background-size: cover;
    opacity: 0.6;
    filter:blur(2px);
    pointer-events: none;
    z-index: 0;
} */

.main {
    position: relative;
    z-index: 1;
    background: rgba(255, 255, 255, 0.05);
    /* subtle transparent layer */
    backdrop-filter: blur(8px);
    /* apply blur behind */
    -webkit-backdrop-filter: blur(8px);
    /* Safari support */
    border-radius: 12px;
    box-shadow: 0 4px 30px rgba(0, 0, 0, 0.3);
    min-height: 100vh;
}

body {
    background: url('../images/bg.jpg') no-repeat center center fixed;
    background-size: cover;
}

.container-fluid {
    padding: 0px;
}

.content {
    position: relative;
    z-index: 1;
    padding: 15px;
} 

/* Sidebar styles from Offcanvas */
.offcanvas {
    --bs-offcanvas-bg: #2C3E50;
    /* Dark background */
    --bs-offcanvas-color: white;
    /* Light text for contrast */
    --bs-offcanvas-border-color: #343a40;
    /* Dark border */
}

.offcanvas-start {
    width: 250px;
    /* Adjust width as needed for desktop and mobile */
}

@media (min-width: 992px) {
    .offcanvas-start {
        transform: translateX(-100%);
        /* Ensure offcanvas starts hidden on desktop */
    }

    .offcanvas-start.show {
        transform: translateX(0);
        /* Show on toggle */
    }
}

.sidebar h4 {
    margin-bottom: 1.5rem;
    color: #DED447;
}

.sidebar .nav-link {
    color: white;
}

.sidebar .nav-link:hover {
    color: #adb5bd;
}

.nav-btn-solid {
    display: block;
    width: 100%;
    background-color: #34495E;
    color: #fff;
    border: none;
    padding: 0.75rem 1rem;
    text-align: left;
    border-radius: 0.375rem;
    font-size: 1rem;
    margin-bottom: 0.5rem;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.nav-btn-solid:hover,
.nav-btn-solid:focus {
    background-color: #3e5870;
    color: #DED447;
    outline: none;
}

.nav-btn-solid.sign-in {
    background-color: #28a745;
}

.nav-btn-solid.sign-out {
    background-color: #E04F3F;
}

/* Navbar styles */
.navbar {
    height: 70px;
    flex-shrink: 0;
    background-color: transparent;
}

.navbar::after {
    content: "";
    display: block;
    height: 3px;
    margin: 0.3rem auto;
    width: 100%;
    background: linear-gradient(to right, #232526, #DED447, #232526);
    border-radius: 2px;
}

.navbar .container-fluid {
    align-items: center;
    position: relative;
    padding: 0 15px;
}

.navbar-brand {
    font-size: 1.5rem;
    font-weight: bold;
    line-height: 1;
    color: #DED447 !important;
    text-align: center;
    flex: 1;
    margin: 0 50px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.navbar-brand:hover,
.navbar-brand:focus {
    color: #DED447 !important;
    text-decoration: none;
}

#connection-status {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background-color: gray;
    box-shadow: 0 0 6px rgba(0, 0, 0, 0.3);
    cursor: pointer;
}

#connection-status-text {
    font-size: 0.75rem;
    white-space: nowrap;
    margin-left: 5px;
}

.sidebar-toggle {
    font-size: 1.2rem;
    padding: 0.5rem;
    border: none;
    background-color: transparent;
    color: #DED447;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 0.5rem;
}

.sidebar-toggle .navbar-toggler-icon {
    width: 1.35rem;
    height: 1.35rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgb(222, 212, 71)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2.5' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}


/* Responsive adjustments */
@media (max-width: 767.98px) {
    .content {
        padding: 10px;
    }

    .offcanvas-start {
        width: 200px;
    }

    .navbar {
        height: auto;
        padding: 10px 0;
    }

    .navbar-brand {
        font-size: 1.2rem;
        margin: 0 40px;
    }

    #connection-status {
        width: 12px;
        height: 12px;
    }

    #connection-status-text {
        font-size: 0.65rem;
        display: none;
    }

    .sidebar-toggle {
        font-size: 1rem;
        padding: 0.4rem;
    }
}

#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    /* Stack spinner and message vertically */
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.spinner {
    border: 8px solid #f3f3f3;
    border-top: 8px solid #007bff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    animation: spin 1s linear infinite;
}

.spinner-message {
    color: white;
    font-family: Arial, sans-serif;
    font-size: 16px;
    margin-top: 10px;
    text-align: center;
    max-width: 80%;
}

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

    100% {
        transform: rotate(360deg);
    }
}

.offcanvas,
.offcanvas-lg,
.offcanvas-md,
.offcanvas-sm,
.offcanvas-xl,
.offcanvas-xxl {
    --bs-offcanvas-width: 300px !important;
}

.btn-check:checked+.btn,
.btn.active,
.btn.show,
.btn:first-child:active,
:not(.btn-check)+.btn:active {
    color: #DED447 !important;
}