/* ============================================
   ADMIN DASHBOARD CSS
   ============================================ */

/* Welcome Header */
.dashboard-welcome {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding: 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 20px;
    color: white;
}

.welcome-text h2 {
    font-size: 1.3rem;
    margin: 0 0 0.25rem;
}

.welcome-text p {
    font-size: 0.85rem;
    opacity: 0.9;
    margin: 0;
}

.welcome-stats {
    display: flex;
    gap: 2rem;
}

.welcome-stat {
    text-align: center;
}

.welcome-stat .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    display: block;
}

/* Top Performing Businesses - Stats Below Avatar */
.dashboard-chart-card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.chart-header {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-header p {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0;
}

.chart-body {
    padding: 1rem;
}

.top-businesses-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Business Item Container */
.top-business-item {
    display: flex;
    align-items: stretch;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.top-business-item:hover {
    transform: translateX(4px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

/* Rank Number */
.rank {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    flex-shrink: 0;
    align-self: center;
}

/* Left Column Container */
.business-left-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
    width: 100px;
}

/* Business Avatar */
.business-avatar {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    overflow: hidden;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
}

.business-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

/* Stats Below Avatar */
.business-stats-below {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.business-stats-below .stat-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 20px;
    font-size: 0.7rem;
    background: var(--bg-secondary);
    width: 100%;
}

.business-stats-below .stat-item i {
    font-size: 0.7rem;
}

.business-stats-below .views-stat i { color: #6366f1; }
.business-stats-below .clicks-stat i { color: #f59e0b; }

.business-stats-below .stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.business-stats-below .stat-label {
    color: var(--text-muted);
}

.business-stats-below .rating-stat {
    background: rgba(245, 158, 11, 0.1);
}

.business-stats-below .stars {
    display: inline-flex;
    gap: 2px;
}

.business-stats-below .stars i {
    font-size: 0.65rem;
    color: #fbbf24;
    width: auto;
}

.business-stats-below .rating-value {
    font-size: 0.65rem;
    color: var(--text-muted);
}

/* Right Column - Stacked Info Layers */
.business-info-stack {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    justify-content: center;
}

/* Info Layers */
.info-layer {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.6rem 0.8rem;
    border-radius: 10px;
    font-size: 0.75rem;
    transition: all 0.2s;
    width: 100%;
}

/* Layer 1 - Red (Top): Business Name */
.layer-top-red {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid #ef4444;
}

.layer-top-red i {
    color: #ef4444;
    width: 18px;
}

.layer-top-red .name {
    font-weight: 600;
    color: var(--text-primary);
}

/* Layer 2 - Green (Middle): Category */
.layer-middle-green {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid #10b981;
}

.layer-middle-green i {
    color: #10b981;
    width: 18px;
}

.layer-middle-green .category {
    color: var(--text-secondary);
}

/* Layer 3 - Blue (Bottom): Location */
.layer-bottom-blue {
    background: rgba(59, 130, 246, 0.1);
    border-left: 3px solid #3b82f6;
}

.layer-bottom-blue i {
    color: #3b82f6;
    width: 18px;
}

.layer-bottom-blue .city {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

/* Empty State */
.empty-activity {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-activity i {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    display: block;
}

/* Responsive Design */
@media (max-width: 768px) {
    .top-business-item {
        flex-wrap: wrap;
    }
    
    .business-left-column {
        flex-direction: row;
        width: 100%;
        justify-content: space-between;
        align-items: center;
        padding-bottom: 0.75rem;
        border-bottom: 1px solid var(--border);
    }
    
    .business-stats-below {
        flex-direction: row;
        width: auto;
    }
    
    .business-stats-below .stat-item {
        width: auto;
        padding: 0.25rem 0.6rem;
    }
    
    .business-info-stack {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .top-business-item {
        flex-direction: column;
    }
    
    .business-left-column {
        flex-direction: column;
    }
    
    .business-stats-below {
        flex-direction: column;
        width: 100%;
    }
    
    .business-stats-below .stat-item {
        width: 100%;
        justify-content: center;
    }
    
    .info-layer {
        justify-content: center;
    }
}

/* Dark Mode Support */
body.dark-mode .top-business-item {
    background: var(--bg-card);
}

body.dark-mode .business-stats-below .stat-item {
    background: var(--bg-primary);
}

body.dark-mode .info-layer {
    background: rgba(255, 255, 255, 0.05);
}

.welcome-stat .stat-label {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* Period Selector */
.dashboard-period-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.period-buttons {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.period-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.period-btn.active {
    background: var(--primary);
    color: white;
}

.refresh-dashboard {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border);
    background: var(--bg-card);
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.refresh-dashboard:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Stats Cards Grid */
.dashboard-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dashboard-stat-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    border: 1px solid var(--border);
    transition: all 0.3s ease;
    cursor: pointer;
}

.dashboard-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
}

.card-icon {
    width: 55px;
    height: 55px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
}

.card-info {
    flex: 1;
}

.card-info h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: var(--text-primary);
}

.card-info p {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin: 0 0 0.5rem;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.7rem;
}

.card-subtext {
    color: var(--text-muted);
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    padding: 0.2rem 0.4rem;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
}

.trend-up {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.trend-down {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.trend-neutral {
    background: rgba(100, 116, 139, 0.15);
    color: #64748b;
}

/* Charts Row */
.dashboard-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.dashboard-chart-card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    overflow: hidden;
}

.dashboard-chart-card.large {
    grid-column: span 1;
}

.chart-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.chart-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.chart-header h3 i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.chart-header p {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin: 0.25rem 0 0;
}

.chart-total {
    text-align: right;
}

.total-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    display: block;
}

.total-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--success);
}

/* ============================================
   CHART CONTAINER - FIXED HEIGHT
   ============================================ */

.chart-body {
    padding: 1.25rem;
    min-height: 320px;
    position: relative;
}

.chart-body canvas {
    max-height: 280px;
    width: 100% !important;
}

/* Prevent chart from growing endlessly */
.dashboard-chart-card {
    overflow: hidden;
}

.dashboard-chart-card .chart-body {
    overflow-x: auto;
    overflow-y: hidden;
}

/* Responsive chart sizes */
@media (max-width: 768px) {
    .chart-body canvas {
        max-height: 220px;
    }
}

/* Top Businesses List */
.top-businesses-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.top-business-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-primary);
    border-radius: 12px;
    transition: all 0.2s;
}

.top-business-item:hover {
    background: var(--bg-hover);
}

.rank {
    width: 28px;
    height: 28px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.8rem;
}

.business-avatar {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--bg-secondary);
}

.business-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.avatar-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    font-weight: 600;
    font-size: 1rem;
}

.business-info {
    flex: 1;
}

.business-info .name {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.business-info .category {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.business-stats {
    display: flex;
    gap: 0.75rem;
}

.business-stats span {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.business-stats i {
    margin-right: 0.2rem;
}

.rating {
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.rating i {
    font-size: 0.7rem;
    color: #f59e0b;
}

.rating-value {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-left: 0.2rem;
}

/* Activity Timeline */
.dashboard-activity-card {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
    overflow: hidden;
}

.activity-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.activity-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--text-primary);
}

.activity-header h3 i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.view-all-btn {
    background: none;
    border: none;
    color: var(--primary);
    cursor: pointer;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.activity-timeline {
    padding: 1.25rem 1.5rem;
    max-height: 400px;
    overflow-y: auto;
}

.timeline-item {
    display: flex;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
    border-bottom: none;
}

.timeline-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    flex-shrink: 0;
}

.timeline-icon.business { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.timeline-icon.user { background: rgba(236, 72, 153, 0.1); color: #ec4899; }
.timeline-icon.payment { background: rgba(16, 185, 129, 0.1); color: #10b981; }
.timeline-icon.listing { background: rgba(139, 92, 246, 0.1); color: #8b5cf6; }
.timeline-icon.verification { background: rgba(16, 185, 129, 0.1); color: #10b981; }

.timeline-content {
    flex: 1;
}

.timeline-content p {
    margin: 0 0 0.25rem;
    font-size: 0.85rem;
    color: var(--text-primary);
}

.timeline-content small {
    font-size: 0.65rem;
    color: var(--text-muted);
}

.empty-activity {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.empty-activity i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
    opacity: 0.5;
}

/* Quick Actions */
.dashboard-quick-actions {
    background: var(--bg-card);
    border-radius: 20px;
    border: 1px solid var(--border);
    padding: 1.25rem 1.5rem;
}

.dashboard-quick-actions h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 1rem;
    color: var(--text-primary);
}

.dashboard-quick-actions h3 i {
    color: var(--primary);
    margin-right: 0.5rem;
}

.actions-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: var(--bg-primary);
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
}

.quick-action:hover {
    transform: translateY(-2px);
    background: var(--primary-light);
}

.quick-action i {
    font-size: 1.5rem;
    color: var(--primary);
}

.quick-action span {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* Responsive */
@media (max-width: 1200px) {
    .dashboard-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-charts-row {
        grid-template-columns: 1fr;
    }
    .actions-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .dashboard-welcome {
        flex-direction: column;
        text-align: center;
    }
    
    .welcome-stats {
        justify-content: center;
    }
    
    .dashboard-stats-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-header {
        flex-direction: column;
        text-align: center;
    }
    
    .chart-total {
        text-align: center;
    }
    
    .top-business-item {
        flex-wrap: wrap;
    }
    
    .actions-grid {
        grid-template-columns: 1fr;
    }
    
    .period-buttons {
        width: 100%;
        justify-content: center;
    }
}
/* ============================================
   PERIOD SELECTOR BUTTONS - FIXED VISIBILITY
   ============================================ */

.dashboard-period-selector {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.period-buttons {
    display: flex;
    gap: 0.5rem;
    background: var(--bg-card);
    padding: 0.25rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.period-btn {
    padding: 0.5rem 1.25rem;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
}

.period-btn:hover {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* FIXED: Active button styling - always visible */
.period-btn.active {
    background: var(--primary) !important;
    color: white !important;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

/* Dark mode fix */
body.dark-mode .period-btn.active {
    background: var(--primary) !important;
    color: white !important;
}

/* Light mode fix */
.period-btn.active {
    background: var(--primary) !important;
    color: white !important;
}
/* No Data Message in Charts */
.no-data-message {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.no-data-message i {
    font-size: 2rem;
    opacity: 0.5;
}

.no-data-message p {
    font-size: 0.85rem;
    margin: 0;
}