/* Custom styles for BI Management System */

/* Watermark */
.watermark {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
    opacity: 0.04;
}
.watermark-text {
    position: absolute;
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    transform: rotate(-30deg);
    -webkit-user-select: none;
    user-select: none;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #334155;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #475569;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}
@keyframes scaleIn {
    from { transform: scale(0.95); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}
@keyframes scaleOut {
    from { transform: scale(1); opacity: 1; }
    to { transform: scale(0.95); opacity: 0; }
}
@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}
@keyframes slideDown {
    from { transform: translateY(-10px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes pulse-border {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.animate-slide-in {
    animation: slideIn 0.3s ease-out;
}
.animate-fade-out {
    animation: fadeOut 0.3s ease-in forwards;
}
.animate-scale-in {
    animation: scaleIn 0.2s ease-out;
}
.animate-scale-out {
    animation: scaleOut 0.15s ease-in forwards;
}
.animate-slide-down {
    animation: slideDown 0.2s ease-out;
}

/* Modal backdrop */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Custom select styling */
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2394A3B8' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 32px;
}

/* Table cell overflow */
.cell-truncate {
    max-width: 200px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Number font */
.font-mono {
    font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

/* Hover glow effect */
.glow-hover:hover {
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
}

/* Gradient text utility */
.gradient-text {
    background: linear-gradient(135deg, #6366F1, #8B5CF6, #EC4899);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Smooth page transitions */
.page-enter {
    animation: fadeIn 0.3s ease-out, slideDown 0.3s ease-out;
}

/* ===================== Mobile Responsive ===================== */

[x-cloak] { display: none !important; }

/* Sidebar mobile drawer */
@media (max-width: 1023px) {
    .mobile-sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 35;
    }
}

/* Mobile padding */
@media (max-width: 767px) {
    .mobile-main { padding: 0.75rem !important; }
    .mobile-tabs { flex-wrap: wrap; }
    .mobile-tabs > button,
    .mobile-tabs > a {
        padding: 0.5rem 0.75rem !important;
        font-size: 0.75rem !important;
    }
}

/* Table mobile */
@media (max-width: 767px) {
    .mobile-table th,
    .mobile-table td {
        padding: 0.5rem 0.375rem !important;
        font-size: 0.75rem !important;
    }
    .mobile-table .mobile-btn {
        padding: 0.25rem !important;
    }
    .mobile-table .mobile-btn svg {
        width: 0.875rem !important;
        height: 0.875rem !important;
    }
    /* China map height */
    #china-map {
        height: 300px !important;
    }
    /* Chart heights */
    #type-chart, #bar-chart {
        height: 200px !important;
    }
}

/* Modal mobile */
@media (max-width: 767px) {
    .modal-mobile {
        width: 100% !important;
        margin: 0 !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
        height: 100vh !important;
    }
    .modal-mobile-inner {
        padding: 1rem !important;
    }
    .modal-phone {
        width: 100% !important;
        margin: 0 0.5rem !important;
        padding: 1rem !important;
    }
}

/* KPI mobile */
@media (max-width: 767px) {
    .kpi-number { font-size: 1.5rem !important; }
    .kpi-icon {
        padding: 0.375rem !important;
    }
    .kpi-icon svg {
        width: 1rem !important;
        height: 1rem !important;
    }
}
