@import url("/css/fontawesome.min.css");

:root {
    --brand-50: #ecfdf5;
    --brand-100: #d1fae5;
    --brand-500: #10b981;
    --brand-600: #059669;
    --brand-700: #047857;
    --brand-800: #065f46;
    --brand-900: #064e3b;
    --darkbg-900: #0b0f19;
    --darkbg-800: #111827;
    --darkbg-700: #1e293b;
    --darkbg-600: #334155;
    --border-dark: rgba(255, 255, 255, 0.08);
}

html,
body {
    height: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0;
}

body {
    font-family:
        "Inter",
        "Noto Sans SC",
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        Roboto,
        sans-serif;
    background-color: var(--darkbg-900);
    color: #e2e8f0;
}

/* Custom Sleek Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: var(--darkbg-800);
}
::-webkit-scrollbar-thumb {
    background: var(--darkbg-600);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Glassmorphism & High-tech Cards */
.glass-card {
    background: rgba(17, 24, 39, 0.75);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border-dark);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

.glass-card-hover:hover {
    border-color: rgba(16, 185, 129, 0.3);
    box-shadow: 0 10px 30px -10px rgba(16, 185, 129, 0.15);
}

.glow-green {
    box-shadow: 0 0 15px rgba(16, 185, 129, 0.3);
}

/* ==========================================================================
   Global Translucent Glassmorphic Stat Icon Styles (全局半透明微光图标盒规范)
   ========================================================================== */
.stat-icon-wrapper,
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    flex-shrink: 0;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, 0.15);
}

.stat-card:hover .stat-icon-wrapper,
.stat-card:hover .stat-icon {
    transform: scale(1.08);
}

/* 红色 / 高危 / 异常 / 拒绝 (Rose / Danger) */
.stat-icon-wrapper.icon-subtle-rose,
.stat-icon-wrapper.icon-subtle-danger,
.stat-icon-wrapper.bg-danger-subtle,
.stat-icon.icon-subtle-rose,
.stat-icon.icon-subtle-danger,
.stat-icon.bg-danger-subtle {
    background: linear-gradient(
        135deg,
        rgba(244, 63, 94, 0.22) 0%,
        rgba(225, 29, 72, 0.08) 100%
    ) !important;
    border: 1px solid rgba(244, 63, 94, 0.35) !important;
    color: #fb7185 !important;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 4px 14px rgba(244, 63, 94, 0.18) !important;
    text-shadow: 0 0 10px rgba(244, 63, 94, 0.4);
}

/* 橙黄色 / 告警 / 待办 / 提醒 / 快照 (Amber / Warning) */
.stat-icon-wrapper.icon-subtle-amber,
.stat-icon-wrapper.icon-subtle-warning,
.stat-icon-wrapper.bg-warning-subtle,
.stat-icon.icon-subtle-amber,
.stat-icon.icon-subtle-warning,
.stat-icon.bg-warning-subtle {
    background: linear-gradient(
        135deg,
        rgba(245, 158, 11, 0.22) 0%,
        rgba(217, 119, 6, 0.08) 100%
    ) !important;
    border: 1px solid rgba(245, 158, 11, 0.35) !important;
    color: #fbbf24 !important;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 4px 14px rgba(245, 158, 11, 0.18) !important;
    text-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}

/* 青蓝 / 科技 / 监测 / 记录 (Cyan / Info) */
.stat-icon-wrapper.icon-subtle-cyan,
.stat-icon-wrapper.icon-subtle-info,
.stat-icon-wrapper.bg-info-subtle,
.stat-icon.icon-subtle-cyan,
.stat-icon.icon-subtle-info,
.stat-icon.bg-info-subtle {
    background: linear-gradient(
        135deg,
        rgba(6, 182, 212, 0.22) 0%,
        rgba(8, 145, 178, 0.08) 100%
    ) !important;
    border: 1px solid rgba(6, 182, 212, 0.35) !important;
    color: #38bdf8 !important;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 4px 14px rgba(6, 182, 212, 0.18) !important;
    text-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

/* 绿色 / 达标 / 安全 / 正常 / 同意 (Emerald / Success) */
.stat-icon-wrapper.icon-subtle-emerald,
.stat-icon-wrapper.icon-subtle-success,
.stat-icon-wrapper.bg-success-subtle,
.stat-icon.icon-subtle-emerald,
.stat-icon.icon-subtle-success,
.stat-icon.bg-success-subtle {
    background: linear-gradient(
        135deg,
        rgba(16, 185, 129, 0.22) 0%,
        rgba(5, 150, 105, 0.08) 100%
    ) !important;
    border: 1px solid rgba(16, 185, 129, 0.35) !important;
    color: #34d399 !important;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 4px 14px rgba(16, 185, 129, 0.18) !important;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}

/* 蓝色 / 仓房 / 设备 / 授权 (Primary / Blue) */
.stat-icon-wrapper.icon-subtle-primary,
.stat-icon-wrapper.icon-subtle-blue,
.stat-icon-wrapper.bg-primary-subtle,
.stat-icon.icon-subtle-primary,
.stat-icon.icon-subtle-blue,
.stat-icon.bg-primary-subtle {
    background: linear-gradient(
        135deg,
        rgba(59, 130, 246, 0.22) 0%,
        rgba(29, 78, 216, 0.08) 100%
    ) !important;
    border: 1px solid rgba(59, 130, 246, 0.35) !important;
    color: #60a5fa !important;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 4px 14px rgba(59, 130, 246, 0.18) !important;
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.4);
}

/* 紫色 / 活体 / 人脸 / 规则 (Purple / Violet) */
.stat-icon-wrapper.icon-subtle-purple,
.stat-icon-wrapper.icon-subtle-violet,
.stat-icon-wrapper.bg-purple-subtle,
.stat-icon.icon-subtle-purple,
.stat-icon.icon-subtle-violet,
.stat-icon.bg-purple-subtle {
    background: linear-gradient(
        135deg,
        rgba(139, 92, 246, 0.22) 0%,
        rgba(109, 40, 217, 0.08) 100%
    ) !important;
    border: 1px solid rgba(139, 92, 246, 0.35) !important;
    color: #c084fc !important;
    box-shadow:
        inset 0 1px 1px rgba(255, 255, 255, 0.15),
        0 4px 14px rgba(139, 92, 246, 0.18) !important;
    text-shadow: 0 0 10px rgba(139, 92, 246, 0.4);
}

/* Global Form Controls & High-Contrast Placeholders for Dark Theme */
.form-control,
.form-select {
    background-color: rgba(15, 23, 42, 0.75);
    border-color: rgba(255, 255, 255, 0.15);
    color: #e2e8f0;
}

.form-control:focus,
.form-select:focus {
    background-color: rgba(15, 23, 42, 0.95);
    border-color: #3b82f6;
    color: #ffffff;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.25);
}

/* High-Contrast Crisp Placeholder Styling Across All Browsers & Inputs */
::placeholder {
    color: #94a3b8 !important;
    opacity: 0.9 !important;
}

::-webkit-input-placeholder {
    color: #94a3b8 !important;
    opacity: 0.9 !important;
}

::-moz-placeholder {
    color: #94a3b8 !important;
    opacity: 0.9 !important;
}

:-ms-input-placeholder {
    color: #94a3b8 !important;
    opacity: 0.9 !important;
}

.form-control::placeholder,
.search-box .form-control::placeholder,
.search-box input::placeholder,
input.form-control::placeholder,
textarea.form-control::placeholder {
    color: #94a3b8 !important;
    opacity: 0.9 !important;
}

.search-box .search-icon {
    color: #94a3b8;
}

/* Pulse Dot Animation */
@keyframes pulse-ring {
    0% {
        transform: scale(0.95);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.4;
    }
    100% {
        transform: scale(0.95);
        opacity: 0.8;
    }
}
.pulse-dot {
    animation: pulse-ring 2s infinite ease-in-out;
}

/* Global Dark Theme Tables */
.table {
    --bs-table-bg: transparent !important;
    --bs-table-color: #cbd5e1 !important;
    --bs-table-hover-bg: rgba(255, 255, 255, 0.035) !important;
    --bs-table-hover-color: #ffffff !important;
    --bs-table-border-color: rgba(255, 255, 255, 0.06) !important;
    --bs-table-accent-bg: transparent !important;
    --bs-table-striped-bg: transparent !important;
    --bs-table-active-bg: transparent !important;
    background-color: transparent !important;
    color: #cbd5e1;
}

.table th {
    background: rgba(15, 23, 42, 0.6) !important;
    background-color: rgba(15, 23, 42, 0.6) !important;
    color: #94a3b8 !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08) !important;
}

.table td {
    background: transparent !important;
    background-color: transparent !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.table-hover tbody tr:hover td {
    background-color: rgba(255, 255, 255, 0.03) !important;
}

/* Shell Layout: Full Height & Side-by-side */
.shell-page {
    height: 100vh;
    width: 100vw;
    margin: 0;
    padding: 0;
    overflow: hidden;
    background-color: var(--darkbg-900);
    color: #e2e8f0;
}

.shell-container,
.admin-layout {
    display: flex;
    height: 100vh;
    width: 100vw;
    overflow: hidden;
    position: relative;
}

/* Sidebar: Full Height (from top to bottom) */
.admin-sidebar {
    width: 256px;
    min-width: 256px;
    height: 100vh;
    background: var(--darkbg-800);
    border-right: 1px solid rgba(51, 65, 85, 0.7);
    display: flex;
    flex-direction: column;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 25;
    overflow: hidden;
    flex-shrink: 0;
}

.admin-sidebar iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Right Main Wrapper (Header on Top + Main Content Below) */
.shell-main {
    flex: 1;
    min-width: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--darkbg-900);
}

/* Top Navbar on Right */
.admin-navbar {
    height: 64px;
    min-height: 64px;
    background: rgba(17, 24, 39, 0.92) !important;
    border-bottom: 1px solid rgba(51, 65, 85, 0.7);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 20;
    padding: 0 20px;
    flex-shrink: 0;
}

/* Main Content Area */
.admin-content {
    flex: 1;
    min-width: 0;
    height: calc(100vh - 64px);
    background: var(--darkbg-900);
    overflow: hidden;
    position: relative;
}

.admin-content iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Menu Page (inside iframe) */
.menu-page {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--darkbg-800);
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.menu-page .brand-header {
    height: 64px;
    padding: 0 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(51, 65, 85, 0.7);
    flex-shrink: 0;
}

.menu-page .depot-badge-bar {
    padding: 10px 16px;
    background: rgba(15, 23, 42, 0.6);
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: #94a3b8;
    flex-shrink: 0;
}

.menu-page .menu-nav {
    flex: 1;
    overflow-y: auto;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.menu-page .nav-category {
    padding: 10px 12px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64748b;
}

.menu-page .nav-item {
    list-style: none;
}

.menu-page .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    border-radius: 8px;
    color: #94a3b8;
    font-size: 13.5px;
    font-weight: 500;
    text-decoration: none;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.menu-page button.nav-link {
    width: 100%;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
}

.menu-page .nav-link:hover {
    color: #ffffff;
    background: rgba(30, 41, 59, 0.6);
}

.menu-page .nav-link.active,
.menu-page .nav-active {
    background: linear-gradient(
        90deg,
        rgba(16, 185, 129, 0.2) 0%,
        rgba(16, 185, 129, 0.05) 100%
    ) !important;
    border-left: 3px solid #10b981 !important;
    color: #34d399 !important;
    font-weight: 600;
}

.menu-page .nav-link i.menu-icon {
    width: 20px;
    text-align: center;
    margin-right: 10px;
    font-size: 15px;
    transition:
        transform 0.2s ease,
        color 0.2s ease;
}

.menu-page .nav-link:hover i.menu-icon {
    transform: scale(1.1);
}

.menu-page .nav-link.active i.menu-icon {
    color: #34d399;
}

.menu-page .menu-arrow {
    font-size: 11px;
    color: #64748b;
    transition: transform 0.2s ease;
    margin-left: auto;
}

.menu-page [aria-expanded="true"] .menu-arrow {
    transform: rotate(180deg);
}

.menu-page .submenu-list {
    padding: 4px 0 4px 28px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.menu-page .submenu-list .nav-link {
    padding: 6px 12px;
    font-size: 12.5px;
    color: #94a3b8;
}

.menu-page .submenu-list .nav-link:hover {
    color: #34d399;
    background: rgba(30, 41, 59, 0.4);
}

.menu-page .submenu-list .nav-link.active {
    background: rgba(16, 185, 129, 0.12) !important;
    border-left: 2px solid #10b981 !important;
    color: #34d399 !important;
}

.menu-page .bottom-info {
    padding: 12px 16px;
    border-top: 1px solid rgba(51, 65, 85, 0.6);
    font-size: 11px;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

/* Modals Dark Styling */
.modal-backdrop.show {
    opacity: 0.75;
    background-color: #000;
    backdrop-filter: blur(4px);
}

.modal-content {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(51, 65, 85, 0.8);
    border-radius: 16px;
    color: #e2e8f0;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.6);
}

.modal-header {
    border-bottom: 1px solid rgba(51, 65, 85, 0.7);
    padding: 16px 20px;
}

.modal-title {
    font-size: 16px;
    font-weight: 700;
    color: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    border-top: 1px solid rgba(51, 65, 85, 0.7);
    padding: 14px 20px;
}

.modal-content .btn-close {
    filter: invert(1) grayscale(100%) brightness(200%);
    opacity: 0.6;
}

.modal-content .btn-close:hover {
    opacity: 1;
}

/* Warehouse Selector Tree in Modal */
.warehouse-tree-container {
    max-height: 380px;
    overflow-y: auto;
    border: 1px solid rgba(51, 65, 85, 0.6);
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.6);
}

.warehouse-tree-item {
    display: flex;
    align-items: center;
    border-bottom: 1px solid rgba(51, 65, 85, 0.4);
    transition: background 0.15s ease;
}

.warehouse-tree-item:hover {
    background: rgba(30, 41, 59, 0.5);
}

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

.warehouse-tree-btn {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    text-align: left;
    flex-grow: 1;
    padding: 10px 12px;
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: color 0.15s ease;
}

.warehouse-tree-btn:hover {
    color: #34d399;
}

.warehouse-toggle-btn {
    border: 0;
    background: transparent;
    color: #94a3b8;
    padding: 8px 12px;
    cursor: pointer;
    transition: color 0.15s ease;
}

.warehouse-toggle-btn:hover {
    color: #ffffff;
}

/* Toast Notifications */
#toastContainer {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1060;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.custom-toast {
    background: rgba(17, 24, 39, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 12px 18px;
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 13px;
    color: #f1f5f9;
    pointer-events: auto;
    min-width: 260px;
    transform: translateY(12px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.custom-toast.show {
    transform: translateY(0);
    opacity: 1;
}

.custom-toast.info {
    border: 1px solid rgba(6, 182, 212, 0.4);
}
.custom-toast.info i {
    color: #06b6d4;
}

.custom-toast.success {
    border: 1px solid rgba(16, 185, 129, 0.4);
}
.custom-toast.success i {
    color: #10b981;
}

.custom-toast.error {
    border: 1px solid rgba(244, 63, 94, 0.4);
}
.custom-toast.error i {
    color: #f43f5e;
}

/* Subpage Tool & Table Styles (preserving compatibility) */
.iframe-page {
    padding: 20px;
    background: #0b0f19;
    color: #e2e8f0;
}

.iframe-page[data-module="dashboard"] {
    background: #0b0f19;
    color: #fff;
}

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

.page-header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 700;
    color: #ffffff;
}

.tool-panel {
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid rgba(51, 65, 85, 0.7);
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
}

.tool-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid rgba(51, 65, 85, 0.6);
}

.tool-table {
    padding: 0 14px 14px;
    overflow-x: auto;
}

.tool-table table {
    min-width: 760px;
    margin-bottom: 0;
}

.tool-table th {
    white-space: nowrap;
    color: #94a3b8;
    font-size: 0.85rem;
}

.tool-table td {
    vertical-align: middle;
    color: #cbd5e1;
}

.empty-state {
    padding: 42px 16px !important;
    text-align: center;
    color: #64748b;
}

.loading-state {
    display: grid;
    place-items: center;
    min-height: 240px;
    color: #94a3b8;
}

.pagination-bar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    padding: 12px 14px 0;
}

/* Mobile Responsive */
@media (max-width: 991.98px) {
    .admin-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: 256px;
        transform: translateX(-100%);
        box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
    }
    .admin-sidebar.open {
        transform: translateX(0);
    }
}
