/* ============================================================
   FREA Admin Dashboard Styles
   ============================================================ */

/* --------- Page Header --------- */
.dash-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
}
.admin-main-content {
    overflow-x: hidden; /* ADD THIS */
    max-width: 100%; /* ADD THIS */
}

.dashboard-body {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden; /* Prevent horizontal overflow */
}

.dash-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: 0.3px;
}

.dash-header .dash-date {
    font-size: 13px;
    color: var(--text-secondary);
}



.carousel-btn {
    background: var(--bg-modal, #1a202c);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: var(--text-primary, #fff);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    z-index: 10;
    transition: all 0.2s;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.carousel-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.05);
}

.carousel-btn.prev-btn {
    left: 0; /* CHANGED from -15px */
}

.carousel-btn.next-btn { /* FIXED the typo */
    right: 0; /* CHANGED from -15px */
}

/* --------- Stat Cards Row --------- */
.stat-cards-carousel-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 24px;
    width: 100%; /* This is fine on the parent */
    overflow: hidden; /* Hides overflow on the wrapper */
    padding: 0 50px; /* Space for arrows */
}

.stat-cards-row {
    display: flex;
    gap: 16px;
    overflow-x: auto; /* Changed back to overflow-x: auto for scrolling */
    scroll-behavior: smooth;
    padding: 10px 4px;
    flex: 1; /* This makes it take available space */
    min-width: 0; /* This allows it to shrink below content size */
    align-items: center;
    scrollbar-width: none;
    /* NO width property needed! */
}

.stat-cards-row::-webkit-scrollbar {
    display: none;
}

.dash-stat-card {
    display: flex;
    min-width: 270px;
    background: var(--bg-modal);
    border-radius: 12px;
    padding: 15px 12px;
    border: 1px solid rgba(252, 252, 252, 0.08);
    transition: transform 0.25s, box-shadow 0.25s;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    
    align-items: center;
    gap: 10px;
    flex-shrink: 0; /* ADD THIS - prevents cards from shrinking */
   
}

.dash-stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 14px 30px rgba(0,0,0,0.35);
}

.dash-stat-card .card-icon-wrap {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0;
    flex-shrink: 0;
}

.dash-stat-card .card-icon-wrap svg {
    width: 18px;
    height: 18px;
    color: #ffffff;
    stroke-width: 2px;
}

.dash-stat-info {
    display: flex;
    flex-direction: column;
}

.dash-stat-card .card-label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
}

.dash-stat-card .card-value {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.dash-stat-card .card-badge {
    position: absolute;
    top: 24px;
    right: 20px;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 20px;
}
.badge-up { background: rgba(46,204,113,0.15); color: #2ecc71; }
.badge-down { background: rgba(231,76,60,0.15); color: #e74c3c; }
.badge-neutral { background: rgba(149,165,166,0.15); color: #95a5a6; }

/* Icon bg colours */
.icon-blue     { background: linear-gradient(135deg,#3b82f6,#1d4ed8); }
.icon-emerald  { background: linear-gradient(135deg,#10b981,#047857); }
.icon-orange   { background: linear-gradient(135deg,#f59e0b,#b45309); }
.icon-purple   { background: linear-gradient(135deg,#8b5cf6,#5b21b6); }
.icon-pink     { background: linear-gradient(135deg,#ec4899,#9d174d); }
.icon-teal     { background: linear-gradient(135deg,#14b8a6,#0f766e); }
.icon-red      { background: linear-gradient(135deg,#ef4444,#b91c1c); }
.icon-green    { background: linear-gradient(135deg,#22c55e,#15803d); }
.icon-yellow   { background: linear-gradient(135deg,#eab308,#a16207); }

/* --------- Two-column middle row --------- */
.dash-middle-row {
    display: flex;
    flex-direction: row;
    gap: 20px;
    margin-bottom: 24px;
    align-items: start;
    padding:5px;
}

/* --------- KPI Ticker (left panel) --------- */
.kpi-ticker-card {
    background: var(--bg-modal);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    padding: 22px;
    height: 340px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    width: 30%;
}
.kpi-ticker-card h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0 0 18px 0;
}
.kpi-ticker-slot {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    position: relative;
}
.kpi-item {
    position: absolute;
    width: 100%;
    text-align: center;
    opacity: 0;
    transition: opacity 0.7s ease;
    padding: 0 10px;
}
.kpi-item.active { opacity: 1; }
.kpi-item.fade-out { opacity: 0; }

.kpi-chart-wrap {
    margin: 0 auto 14px;
    position: relative;
    width: 110px;
    height: 110px;
}
.kpi-chart-wrap canvas {
    width: 110px !important;
    height: 110px !important;
}
.kpi-center-label {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}
.kpi-center-label .val {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}
.kpi-center-label .unit {
    font-size: 11px;
    color: var(--text-secondary);
}
.kpi-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}
.kpi-item-sub {
    font-size: 12px;
    color: var(--text-secondary);
}
.kpi-dots {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 14px;
}
.kpi-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    transition: background 0.3s;
    cursor: pointer;
}
.kpi-dot.active {
    background: var(--orange-2);
    width: 16px;
    border-radius: 3px;
}

/* --------- Activity Chart (right panel) --------- */
.activity-card {
    background: var(--bg-modal);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    padding: 22px;
    height: 340px;
    display: flex;
    flex-direction: column;
    width: 100%;
}
.activity-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 18px;
}
.activity-card-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.period-selector {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: background 0.2s;
}
.period-selector option{
    background: var(--bg-modal);
    color: var(--text-primary);
}
.period-selector:hover { background: rgba(255,255,255,0.1); }
.period-selector svg { width: 14px; height: 14px; }

.activity-chart-wrap {
    flex: 1;
    position: relative;
}

/* --------- Bottom Row --------- */
.dash-bottom-row {
    display: flex;
    flex-direction: row;
    gap:10px;
    
}

.dash-recent-visited{
    margin:20px 5px;
}

/* --------- Table Cards (requests / feedbacks / history) --------- */
.dash-table-card {
    background: var(--bg-modal);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.05);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width:100%;
}
.dash-table-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.dash-table-card-header h3 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.dash-table-card-header a {
    font-size: 12px;
    color: var(--orange-2);
    text-decoration: none;
    font-weight: 500;
    transition: opacity 0.2s;
}
.dash-table-card-header a:hover { opacity: 0.75; }

.dash-list-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}
.dash-list-item:last-child { border: none; padding-bottom: 0; }
.dash-list-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.dash-list-icon svg { width: 16px; height: 16px; color: #fff; stroke-width: 2px; }
.dash-list-body { flex: 1; min-width: 0; }
.dash-list-body .title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}
.dash-list-body .sub {
    font-size: 11px;
    color: var(--text-secondary);
}
.dash-list-meta {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    flex-shrink: 0;
}
.status-pill {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.pill-pending  { background: rgba(241,196,15,0.15); color: #f1c40f; }
.pill-open     { background: rgba(52,152,219,0.15); color: #3498db; }
.pill-done     { background: rgba(46,204,113,0.15); color: #2ecc71; }

/* History card items */
.hist-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    cursor: pointer;
    text-decoration: none;
    transition: opacity 0.2s;
}
.hist-item:hover { opacity: 0.75; }
.hist-item:last-child { border: none; }
.hist-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(243,156,18,0.1);
    flex-shrink: 0;
}
.hist-icon svg { width: 15px; height: 15px; color: var(--orange-2); }
.hist-label {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hist-time {
    font-size: 11px;
    color: var(--text-secondary);
}

/* --------- Empty states --------- */
.dash-empty {
    text-align: center;
    padding: 24px 0;
    color: var(--text-secondary);
    font-size: 13px;
}
.dash-empty svg {
    width: 36px; height: 36px;
    margin-bottom: 8px;
    opacity: 0.3;
}

/* --------- Chart animation in-view --------- */
@keyframes chartFadeUp {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.activity-card.animate-in {
    animation: chartFadeUp 0.6s ease forwards;
}

/* --------- Responsive --------- */
@media (max-width: 1100px) {
    .dash-middle-row { grid-template-columns: 1fr; }
    .dash-bottom-row  { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
    #analyticsChartsGrid { grid-template-columns: 1fr !important; }
    #analyticsChartsGrid > * { grid-column: span 1 !important; }
}
@media (max-width: 720px) {
    .dash-bottom-row  { grid-template-columns: 1fr; }
}

/* --------- Analytics KPI hover --------- */
.analytics-kpi-card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.analytics-kpi-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.25);
}

/* --------- Analytics header hover --------- */
.analytics-header:hover {
    border-color: rgba(255,255,255,0.12) !important;
}

/* --------- Chart Carousel Dots --------- */
.chart-dot {
    background: rgba(255,255,255,0.2);
}
.chart-dot.active {
    background: var(--orange-2, #e67e22);
    transform: scale(1.3);
}

.chart-slide {
    width: 20%; /* 100% / 5 items max = 20% since width is 500% */
}
