/* [FIX] FOUC: Hide app until logged in */
body:not(.app-ready) .container {
    display: none !important;
}

/* Ẩn địa chỉ shop trong header — không cần thiết khi dùng nội bộ */
.shop-address-line {
    display: none;
}

/* Mobile Dropdown Styles */
.user-dropdown {
    position: relative;
    display: inline-block;
    margin-right: 0;
}

.user-trigger {
    font-size: 20px;
    cursor: pointer;
    padding: 2px 5px;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    z-index: 9999;
    min-width: 240px;
    overflow: hidden;
    border: 1px solid #eee;
}

.dropdown-content a {
    color: #333;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    font-size: 16px;
    border-bottom: 1px solid #f1f2f6;
    white-space: nowrap;
}

.dropdown-content a:hover {
    background-color: #f8f9fa;
}

.dropdown-content .user-header {
    background: #f1f5f9;
    padding: 10px;
    font-weight: bold;
    color: #1e3a8a;
    text-align: center;
}

.show-dropdown {
    display: block;
}

/* [NEW] Navigation Card Highlighting (Tick in Corner) */
.nav-card {
    position: relative;
    opacity: 0.6;
    transition: all 0.3s ease;
    transform: scale(0.98);
    border: 2px solid transparent;
    /* Base border to prevent shift */
}

.nav-card.active {
    opacity: 1 !important;
    transform: scale(1) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid var(--secondary-color) !important;
    /* Visible border when selected */
}

/* Always light up the history button, inventory stats buttons and debt cards */
.nav-card[data-sale-mode="history"],
.nav-card[data-filter],
.nav-card[data-sub],
.nav-card[data-status],
#kpiDebtCustomer,
#kpiDebtSupplier {
    opacity: 1 !important;
    transform: scale(1) !important;
}

.active-tick {
    display: none;
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--secondary-color);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    align-items: center;
    justify-content: center;
    z-index: 10;
    border: 2px solid white;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-card.active .active-tick {
    display: flex;
}

/* Group buttons for history date filter */
.history-date-filters {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.btn-filter {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    transition: all 0.2s;
}

.btn-filter:hover {
    background: #f1f5f9;
    color: var(--secondary-color);
}

.btn-filter.active {
    background: var(--secondary-color);
    color: white;
    border-color: var(--secondary-color);
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

@media screen and (max-width: 768px) {
    .val-shop-name {
        font-size: 16px !important;
    }

    .val-shop-slogan {
        display: none;
    }

    .user-trigger {
        font-size: 22px;
        padding: 1px 5px;
    }

    .status-group button {
        display: inline-block !important;
    }

    /* Force config button if needed or refined */
}

.pc-only {
    display: inline-block !important;
}

@media screen and (max-width: 768px) {
    .pc-only {
        display: none !important;
    }
}

/* Login Logo Styling */
.logo-login {
    margin-bottom: 25px;
    display: flex;
    justify-content: center;
}

.logo-login img {
    width: 120px;
    height: auto;
    filter: drop-shadow(0 5px 15px rgba(9, 132, 227, 0.2));
    transition: transform 0.3s ease;
}

.logo-login img:hover {
    transform: scale(1.05);
}

/* Reports Tab Styling */
.sub-panel {
    display: none;
}

.sub-panel.active {
    display: flex;
    flex-direction: column;
}


/* Contextual KPI Cards */
.kpi-mini-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px;
    text-align: center;
    transition: all 0.2s ease;
}

.kpi-mini-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.kpi-label {
    font-size: 14px;
    color: #475569;
    font-weight: 700;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 24px;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.2;
}

.kpi-count {
    font-size: 14px;
    color: #64748b;
    margin-top: 5px;
    font-weight: 600;
}

/* Responsive adjustments for mobile */
@media (max-width: 768px) {
    .kpi-mini-card {
        padding: 10px;
    }

    .kpi-value {
        font-size: 20px;
    }

    .kpi-label {
        font-size: 13px;
    }
}

/* Badge for KPI Cards */
.kpi-badge {
    position: absolute;
    top: -12px;
    left: -12px;
    background: #f59e0b;
    color: white;
    font-size: 16px;
    font-weight: 800;
    padding: 5px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    z-index: 10;
    border: 2px solid white;
    min-width: 45px;
    text-align: center;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

/* ── Drag & Drop Cart (SortableJS) ── */
.drag-handle {
    cursor: grab;
    color: #94a3b8;
    font-size: 18px;
    padding: 4px 6px;
    user-select: none;
    touch-action: none;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}

.drag-handle:hover {
    color: #475569;
    background: #f1f5f9;
}

.drag-handle:active {
    cursor: grabbing;
}

/* Row đang được kéo (ghost - placeholder) */
.cart-drag-ghost {
    opacity: 0.35 !important;
    background: #bfdbfe !important;
}

/* Row đang được chọn để kéo */
.cart-drag-chosen {
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.25) !important;
    outline: 2px solid #3b82f6;
    border-radius: 4px;
}

/* Vùng thả hợp lệ khi đang kéo (hover) */
.cart-drag-over {
    background: #f0fdf4 !important;
}


.dot-online {
    background-color: #22c55e !important;
}

.dot-offline {
    background-color: #ef4444 !important;
}

.dot-warning {
    background-color: #f97316 !important;
}

/* Orange for Offline (Saved) */
.dot-connecting {
    background-color: #f59e0b !important;
    animation: pulse-dot 1.5s infinite;
}

.dot-cached {
    background-color: #8b5cf6 !important;
}

.dot-error {
    background-color: #dc2626 !important;
    animation: pulse-dot 0.8s infinite;
}

@keyframes pulse-dot {
    0% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.7);
    }

    70% {
        transform: scale(1.1);
        opacity: 0.8;
        box-shadow: 0 0 0 5px rgba(245, 158, 11, 0);
    }

    100% {
        transform: scale(1);
        opacity: 1;
        box-shadow: 0 0 0 0 rgba(245, 158, 11, 0);
    }
}

/* [NEW] Clickable product name style */
.clickable-name {
    cursor: pointer;
    color: #2563eb;
    transition: all 0.2s;
}

.clickable-name:hover {
    color: #1d4ed8;
    text-decoration: underline;
}
/* Drag and Drop for Image Gallery in Purchase */
.import-img-item.dragging {
    opacity: 0.5;
    border: 2px dashed #3b82f6 !important;
    z-index: 100;
}
.import-img-item.drag-over {
    border: 2px solid #3b82f6 !important;
    transform: scale(1.05);
    background-color: rgba(59, 130, 246, 0.05);
    transition: transform 0.2s ease;
}
