/* ============================================
   BACKEND MODERN STYLES
   Dashboard, KPI cards, status grid, charts
   ============================================ */

/* Animations */
@keyframes shimmer {
    0% { background-position: -1000px 0; }
    100% { background-position: 1000px 0; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes countUp {
    from { opacity: 0; transform: scale(0.5); }
    to { opacity: 1; transform: scale(1); }
}
@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes slideDown {
    from { opacity: 0; max-height: 0; }
    to { opacity: 1; max-height: 500px; }
}

/* Shimmer Loader */
.shimmer-line {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 2000px 100%;
    animation: shimmer 2s infinite linear;
    border-radius: 6px;
}

/* KPI Cards */
.kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}
@media (max-width: 1200px) { .kpi-row { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 576px) { .kpi-row { grid-template-columns: 1fr; } }

.kpi-card {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 15px rgba(0,0,0,0.04), 0 1px 6px rgba(0,0,0,0.04);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid rgba(0,0,0,0.04);
}
.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
}
.kpi-card .kpi-icon {
    width: 48px; height: 48px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: #fff; margin-bottom: 16px;
}
.kpi-card .kpi-value {
    font-size: 28px; font-weight: 700; color: #1e1e2d;
    line-height: 1.2; margin-bottom: 4px;
}
.kpi-card .kpi-label {
    font-size: 13px; color: #a1a5b7; font-weight: 500; margin-bottom: 12px;
}
.kpi-card .kpi-trend {
    display: inline-flex; align-items: center;
    font-size: 12px; font-weight: 600; padding: 4px 8px;
    border-radius: 6px; gap: 4px;
}
.kpi-trend.up { background: #e8fff3; color: #50cd89; }
.kpi-trend.down { background: #fff5f8; color: #f1416c; }
.kpi-trend.neutral { background: #f9f9f9; color: #a1a5b7; }
.kpi-card .kpi-decoration {
    position: absolute; right: -20px; bottom: -20px;
    font-size: 100px; opacity: 0.04; color: #000; pointer-events: none;
}

/* KPI Shimmer */
.kpi-card .shimmer-value { width: 80px; height: 32px; margin-bottom: 8px; }
.kpi-card .shimmer-label { width: 120px; height: 14px; margin-bottom: 14px; }
.kpi-card .shimmer-trend { width: 60px; height: 24px; }
.kpi-card .shimmer-icon { width: 48px; height: 48px; border-radius: 12px; margin-bottom: 16px; }

/* Dash Box */
.dash-box {
    background: #fff; border-radius: 12px;
    box-shadow: 0 1px 15px rgba(0,0,0,0.04), 0 1px 6px rgba(0,0,0,0.04);
    border: 1px solid rgba(0,0,0,0.04); margin-bottom: 24px; overflow: hidden;
}
.dash-box-header {
    padding: 20px 24px; border-bottom: 1px solid #f1f1f2;
    display: flex; align-items: center; justify-content: space-between;
}
.dash-box-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: #1e1e2d; }
.dash-box-header .header-badge {
    background: #f1faff; color: #009ef7;
    font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 6px;
}
.dash-box-body { padding: 24px; }

/* Status Grid */
.status-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px;
}
.status-item {
    border-radius: 10px; padding: 16px; text-align: center;
    transition: all 0.3s ease; cursor: default; position: relative; overflow: hidden;
}
.status-item:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(0,0,0,0.08); }
.status-item .status-count { font-size: 26px; font-weight: 700; line-height: 1.2; margin-bottom: 4px; }
.status-item .status-name { font-size: 12px; font-weight: 500; opacity: 0.85; }
.status-item .status-dot {
    width: 8px; height: 8px; border-radius: 50%;
    display: inline-block; margin-right: 4px; vertical-align: middle;
}
.status-item .shimmer-count { width: 50px; height: 28px; margin: 0 auto 6px; }
.status-item .shimmer-name { width: 80px; height: 12px; margin: 0 auto; }

/* Chart Area */
.chart-wrapper { position: relative; height: 300px; width: 100%; }
.chart-wrapper .shimmer-chart { width: 100%; height: 100%; border-radius: 8px; }

/* Mini Stats */
.mini-stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
@media (max-width: 768px) { .mini-stats-row { grid-template-columns: 1fr; } }
.mini-stat {
    display: flex; align-items: center; gap: 14px; padding: 16px;
    background: #f9f9f9; border-radius: 10px; transition: background 0.2s;
}
.mini-stat:hover { background: #f1f1f2; }
.mini-stat .mini-icon {
    width: 44px; height: 44px; border-radius: 10px;
    display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.mini-stat .mini-info .mini-value { font-size: 18px; font-weight: 700; color: #1e1e2d; }
.mini-stat .mini-info .mini-label { font-size: 12px; color: #a1a5b7; font-weight: 500; }

/* Refresh Button */
.btn-refresh {
    background: transparent; border: 1px solid #e4e6ef; color: #a1a5b7;
    padding: 6px 12px; border-radius: 8px; font-size: 13px; cursor: pointer;
    transition: all 0.2s; display: inline-flex; align-items: center; gap: 6px;
}
.btn-refresh:hover { border-color: #009ef7; color: #009ef7; }
.btn-refresh.loading i { animation: spin 1s linear infinite; }

/* Last Updated */
.last-updated { font-size: 12px; color: #b5b5c3; display: flex; align-items: center; gap: 6px; }
.last-updated .dot-live {
    width: 6px; height: 6px; background: #50cd89;
    border-radius: 50%; display: inline-block; animation: pulse 2s infinite;
}

/* Chart Legend */
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.chart-legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #5e6278; }
.chart-legend-item .legend-dot { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

/* Animated Entrance */
.animate-in { animation: fadeInUp 0.5s ease forwards; }
.animate-in:nth-child(1) { animation-delay: 0.05s; }
.animate-in:nth-child(2) { animation-delay: 0.1s; }
.animate-in:nth-child(3) { animation-delay: 0.15s; }
.animate-in:nth-child(4) { animation-delay: 0.2s; }

/* Delivery Rate Circle */
.rate-circle { width: 120px; height: 120px; position: relative; margin: 0 auto; }
.rate-circle svg { transform: rotate(-90deg); }
.rate-circle .rate-text {
    position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
    font-size: 24px; font-weight: 700; color: #1e1e2d;
}
.rate-circle .rate-label { text-align: center; font-size: 12px; color: #a1a5b7; margin-top: 8px; font-weight: 500; }

/* ============================================
   GLOBAL MODERNIZATION OVERRIDES
   ============================================ */

/* Softer AdminLTE boxes */
.box { border-radius: 8px; border-top: none; box-shadow: 0 1px 10px rgba(0,0,0,0.06); }
.box-header { border-radius: 8px 8px 0 0; }
.box-primary { border-top: 3px solid #009ef7; }
.box-info { border-top: 3px solid #00b2ff; }
.box-success { border-top: 3px solid #50cd89; }
.box-warning { border-top: 3px solid #ffc700; }
.box-danger { border-top: 3px solid #f1416c; }

/* Softer info-boxes */
.info-box { border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.08); }

/* Better nav-tabs */
.nav-tabs-custom { border-radius: 8px; box-shadow: 0 1px 10px rgba(0,0,0,0.06); }
.nav-tabs-custom > .nav-tabs > li.active > a { border-top-color: #009ef7; }

/* Better tables */
.table > thead > tr > th {
    font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px;
    color: #a1a5b7; font-weight: 600; border-bottom: 2px solid #f1f1f2;
}

/* Better content-header */
.content-header > h1 { font-size: 22px; font-weight: 600; color: #1e1e2d; }
