/* =====================================================
   ASN Data Dashboard Frontend Stylesheet (Responsive Enhanced)
   ===================================================== */

.asndd-frontend-wrap {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    color: #1e293b;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 20px;
    margin: 16px 0;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03);
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.asndd-frontend-wrap *, 
.asndd-frontend-wrap *::before, 
.asndd-frontend-wrap *::after {
    box-sizing: border-box;
}

/* Header */
.asndd-fe-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 2px solid #f1f5f9;
}
.asndd-fe-title-wrap {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}
.asndd-fe-title {
    margin: 0 !important;
    font-size: clamp(18px, 3.5vw, 22px) !important;
    font-weight: 800 !important;
    color: #0f172a !important;
    line-height: 1.3 !important;
}
.asndd-fe-filter-group {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
    max-width: 100%;
}
.asndd-fe-filter-group label {
    font-size: 13px;
    color: #475569;
    white-space: nowrap;
}
.asndd-fe-period-select {
    font-size: 13px !important;
    font-weight: 700 !important;
    color: #1d4ed8 !important;
    background: #ffffff !important;
    border: 1px solid #bfdbfe !important;
    border-radius: 6px !important;
    padding: 4px 10px !important;
    cursor: pointer !important;
    outline: none !important;
}
.asndd-fe-period-select:focus {
    border-color: #2563eb !important;
    box-shadow: 0 0 0 2px rgba(37,99,235,0.2) !important;
}

.asndd-fe-badge {
    background: #eff6ff;
    color: #1d4ed8;
    font-size: 13px;
    font-weight: 700;
    padding: 6px 14px;
    border-radius: 20px;
    border: 1px solid #bfdbfe;
}

/* Filter Hint */
.asndd-fe-filter-hint {
    font-size: 12px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.asndd-fe-filter-hint .dashicons {
    font-size: 16px;
    width: 16px;
    height: 16px;
    color: #2563eb;
}

/* Summary Interactive Cards */
.asndd-fe-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}
.asndd-fe-card {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 14px;
    border-left: 4px solid #3b82f6;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
    transition: all 0.2s ease;
    user-select: none;
    min-width: 0;
}
.asndd-fe-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(0,0,0,0.08);
    background: #ffffff;
}

.asndd-fe-card-pns    { border-left-color: #2563eb; }
.asndd-fe-card-pppk   { border-left-color: #10b981; }
.asndd-fe-card-pppkpw { border-left-color: #f59e0b; }
.asndd-fe-card-total  { border-left-color: #8b5cf6; }

/* Active Card State */
.asndd-fe-card-active {
    background: #ffffff !important;
    box-shadow: 0 4px 14px rgba(0,0,0,0.09) !important;
    border-top: 1px solid #cbd5e1 !important;
    border-right: 1px solid #cbd5e1 !important;
    border-bottom: 1px solid #cbd5e1 !important;
}
.asndd-fe-card-active.asndd-fe-card-pns    { border-left-width: 6px; }
.asndd-fe-card-active.asndd-fe-card-pppk   { border-left-width: 6px; }
.asndd-fe-card-active.asndd-fe-card-pppkpw { border-left-width: 6px; }
.asndd-fe-card-active.asndd-fe-card-total  { border-left-width: 6px; }

.asndd-fe-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.asndd-fe-card-label {
    font-size: 10.5px;
    font-weight: 700;
    text-transform: uppercase;
    color: #64748b;
    letter-spacing: 0.5px;
}
.asndd-fe-active-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: transparent;
    transition: background 0.2s ease;
    flex-shrink: 0;
}
.asndd-fe-card-active .asndd-fe-active-dot {
    background: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,0.25);
}

.asndd-fe-card-val {
    font-size: clamp(18px, 4vw, 24px);
    font-weight: 800;
    color: #0f172a;
    margin: 4px 0;
    line-height: 1.1;
}
.asndd-fe-card-sub {
    font-size: 11px;
    color: #64748b;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Section Header for Charts */
.asndd-fe-section-header {
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px dashed #e2e8f0;
}
.asndd-fe-section-title {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}
.asndd-fe-section-title .dashicons {
    color: #2563eb;
}

/* Tabs */
.asndd-fe-tabs {
    display: flex;
    gap: 6px;
    border-bottom: 2px solid #e2e8f0;
    margin-bottom: 18px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.asndd-fe-tab {
    background: none;
    border: none;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
    flex-shrink: 0;
}
.asndd-fe-tab:hover {
    color: #2563eb;
}
.asndd-fe-tab-active {
    color: #2563eb;
    border-bottom-color: #2563eb;
}

.asndd-fe-tab-body {
    display: none;
}
.asndd-fe-tab-active[data-tab-content] {
    display: block;
}

/* Grids — Fully Responsive */
.asndd-fe-grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
}
.asndd-fe-grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}
.asndd-fe-mt-15 { margin-top: 15px; }

/* Box */
.asndd-fe-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    min-width: 0; /* Prevents grid flex overflow */
}
.asndd-fe-box-title {
    margin: 0 0 12px 0 !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    color: #0f172a !important;
    border-bottom: 2px solid #f1f5f9;
    padding-bottom: 8px;
}

/* Tables — Responsive Scroll Container */
.asndd-fe-table-wrap {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.asndd-fe-table {
    width: 100% !important;
    border-collapse: collapse !important;
    font-size: 13px !important;
    min-width: 320px;
}
.asndd-fe-table th, .asndd-fe-table td {
    padding: 8px 10px !important;
    border-bottom: 1px solid #e2e8f0 !important;
    text-align: left !important;
}
.asndd-fe-table th {
    background: #f8fafc !important;
    color: #475569 !important;
    font-weight: 700 !important;
}
.asndd-fe-table td.num, .asndd-fe-table th.num {
    text-align: center !important;
    width: 70px;
}
.asndd-fe-table td.total, .asndd-fe-table th.total {
    font-weight: 700 !important;
    background: #f1f5f9 !important;
    color: #0f172a !important;
}
.asndd-fe-scroll {
    max-height: 420px;
    overflow-y: auto;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Charts */
.asndd-fe-chart-wrap {
    position: relative;
    height: 280px;
    width: 100%;
    max-width: 100%;
}
.asndd-fe-chart-square {
    height: 240px;
}

/* ── RESPONSIVE MEDIA QUERIES ── */
@media (max-width: 768px) {
    .asndd-frontend-wrap {
        padding: 14px;
        border-radius: 8px;
    }
    .asndd-fe-grid-2, .asndd-fe-grid-3 {
        grid-template-columns: 1fr;
    }
    .asndd-fe-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .asndd-fe-card {
        padding: 12px;
    }
    .asndd-fe-chart-wrap {
        height: 240px;
    }
    .asndd-fe-chart-square {
        height: 210px;
    }
}

@media (max-width: 480px) {
    .asndd-frontend-wrap {
        padding: 10px;
        margin: 10px 0;
    }
    .asndd-fe-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .asndd-fe-card-label {
        font-size: 9.5px;
    }
    .asndd-fe-card-val {
        font-size: 18px;
    }
    .asndd-fe-card-sub {
        font-size: 10px;
    }
    .asndd-fe-chart-wrap {
        height: 220px;
    }
}
