/**
 * AUTOCORE360 Admin Panel - Dashboard Page
 * Dashboard layout, stats, activity feed, system status
 */

/* Dashboard Container */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

/* Welcome Banner */
.welcome-banner {
    background: var(--primary-gradient);
    border-radius: var(--radius-xl);
    padding: 28px 32px;
    position: relative;
    overflow: hidden;
}

.welcome-banner::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(255,255,255,0.15) 0%, transparent 70%);
    pointer-events: none;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: 30%;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
}

.welcome-content {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 20px;
}

.welcome-text h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 6px 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.welcome-text h1 i {
    font-size: 1.5rem;
    opacity: 0.9;
}

.welcome-text p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.8);
    margin: 0;
}

.welcome-actions {
    display: flex;
    gap: 12px;
}

.welcome-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    text-decoration: none;
}

.welcome-btn--primary {
    background: #fff;
    color: var(--primary);
}

.welcome-btn--primary:hover {
    background: rgba(255,255,255,0.9);
    transform: translateY(-2px);
}

.welcome-btn--secondary {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.25);
}

.welcome-btn--secondary:hover {
    background: rgba(255,255,255,0.25);
}

/* Stats Grid */
.stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

@media (max-width: 1200px) {
    .stats-row {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 600px) {
    .stats-row {
        grid-template-columns: 1fr;
    }
}

.stat-tile {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    display: block;
}

.stat-tile:hover {
    border-color: var(--primary);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stat-tile__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.stat-tile__icon {
    width: 44px;
    height: 44px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.125rem;
}

.stat-tile__icon--blue {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.stat-tile__icon--green {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.stat-tile__icon--amber {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.stat-tile__icon--cyan {
    background: rgba(6, 182, 212, 0.1);
    color: #06b6d4;
}

.stat-tile__icon--purple {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.stat-tile__icon--rose {
    background: rgba(244, 63, 94, 0.1);
    color: #f43f5e;
}

[data-theme="dark"] .stat-tile__icon--blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

[data-theme="dark"] .stat-tile__icon--green {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
}

[data-theme="dark"] .stat-tile__icon--amber {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
}

[data-theme="dark"] .stat-tile__icon--cyan {
    background: rgba(6, 182, 212, 0.15);
    color: #22d3ee;
}

[data-theme="dark"] .stat-tile__icon--purple {
    background: rgba(139, 92, 246, 0.15);
    color: #a78bfa;
}

[data-theme="dark"] .stat-tile__icon--rose {
    background: rgba(244, 63, 94, 0.15);
    color: #fb7185;
}

.stat-tile__badge {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #ef4444;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--radius-full);
    display: none;
    align-items: center;
    justify-content: center;
    animation: pulse-badge 2s infinite;
}

.stat-tile__badge.show {
    display: flex;
}

@keyframes pulse-badge {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.stat-tile__value {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1;
    margin-bottom: 4px;
}

.stat-tile__label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-tile__arrow {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.75rem;
    transition: all 0.2s ease;
    background: var(--surface-hover);
}

.stat-tile:hover .stat-tile__arrow {
    color: var(--primary);
    transform: translateX(3px);
}

/* Quick Actions */
.quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.action-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
}

.action-chip:hover {
    border-color: var(--primary);
    background: var(--surface-hover);
    color: var(--primary);
}

.action-chip i {
    font-size: 0.9375rem;
    opacity: 0.8;
}

.action-chip:hover i {
    opacity: 1;
}

/* Grid Layout */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 992px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

.dashboard-grid--full {
    grid-template-columns: 1fr;
}

/* Panel Card */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.panel__header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.panel__title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
}

.panel__title i {
    color: var(--primary);
    font-size: 1rem;
}

.panel__action {
    font-size: 0.8125rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: color 0.2s ease;
}

.panel__action:hover {
    color: var(--primary-dark);
}

.panel__body {
    padding: 0;
}

.panel__body--padded {
    padding: 20px;
}

/* Activity Feed - Clean List Design */
.activity-feed {
    max-height: 380px;
    overflow-y: auto;
}

.activity-feed::-webkit-scrollbar {
    width: 4px;
}

.activity-feed::-webkit-scrollbar-track {
    background: transparent;
}

.activity-feed::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 2px;
}

.activity-row {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 0.875rem 1.25rem;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s ease;
}

.activity-row:last-child {
    border-bottom: none;
}

.activity-row:hover {
    background: var(--surface-hover);
}

.activity-row__icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    flex-shrink: 0;
}

.activity-row__icon--sale {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    color: white;
}

.activity-row__icon--activation {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
}

.activity-row__icon--ticket {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
}

.activity-row__icon--user {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    color: white;
}

.activity-row__icon--product {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
    color: white;
}

.activity-row__icon--token {
    background: linear-gradient(135deg, #f97316, #ea580c);
    color: white;
}

.activity-row__icon--default {
    background: linear-gradient(135deg, #64748b, #475569);
    color: white;
}

.activity-row__content {
    flex: 1;
    min-width: 0;
    padding-top: 0.125rem;
}

.activity-row__text {
    font-size: 0.875rem;
    color: var(--text);
    line-height: 1.5;
    margin-bottom: 0.25rem;
}

.activity-row__text strong {
    font-weight: 600;
    color: var(--text);
}

.activity-row__meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.activity-row__time {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.activity-row__time i {
    font-size: 0.625rem;
}

.activity-row__badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    font-size: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.025em;
    border-radius: 1rem;
    background: var(--primary);
    color: white;
}

.activity-row__badge--success {
    background: linear-gradient(135deg, #22c55e, #16a34a);
}

.activity-row__badge--warning {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.activity-row__badge--info {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.activity-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 3rem 1.5rem;
    text-align: center;
    min-height: 200px;
}

.activity-empty i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.2;
    color: var(--text-muted);
}

.activity-empty h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 0.375rem;
}

.activity-empty p {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin: 0;
    max-width: 280px;
}

/* System Status */
.status-grid {
    padding: 8px 0;
}

.status-row {
    padding: 14px 20px;
    border-bottom: 1px solid var(--border);
}

.status-row:last-child {
    border-bottom: none;
}

.status-row__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.status-row__info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.status-row__icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
}

.status-row__icon--online {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-row__icon--offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-row__icon--checking {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.status-row__name {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
}

.status-tag {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: var(--radius-full);
}

.status-tag--online {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-tag--offline {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.status-tag--checking {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.status-row__bar {
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.status-row__progress {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.status-row__progress--success {
    background: linear-gradient(90deg, #22c55e 0%, #4ade80 100%);
}

.status-row__progress--warning {
    background: linear-gradient(90deg, #f59e0b 0%, #fbbf24 100%);
}

.status-row__progress--error {
    background: linear-gradient(90deg, #ef4444 0%, #f87171 100%);
}

/* Tickets Preview Table */
.tickets-preview {
    width: 100%;
    border-collapse: collapse;
}

.tickets-preview th {
    padding: 12px 20px;
    text-align: left;
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--surface-hover);
    border-bottom: 1px solid var(--border);
}

.tickets-preview td {
    padding: 14px 20px;
    font-size: 0.8125rem;
    color: var(--text);
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}

.tickets-preview tbody tr {
    transition: background 0.15s ease;
}

.tickets-preview tbody tr:hover {
    background: var(--surface-hover);
}

.tickets-preview tbody tr:last-child td {
    border-bottom: none;
}

.ticket-subject-cell {
    font-weight: 500;
    max-width: 220px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-user-cell {
    color: var(--text-secondary);
}

.priority-tag {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: var(--radius-full);
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.priority-tag--high {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.priority-tag--medium {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

.priority-tag--low,
.priority-tag--normal {
    background: rgba(34, 197, 94, 0.1);
    color: #22c55e;
}

.status-tag--open {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.status-tag--answered {
    background: rgba(139, 92, 246, 0.1);
    color: #8b5cf6;
}

.status-tag--closed {
    background: rgba(100, 116, 139, 0.1);
    color: #64748b;
}

.ticket-time-cell {
    color: var(--text-muted);
    font-size: 0.75rem;
}

.ticket-view-btn {
    padding: 6px 12px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ticket-view-btn:hover {
    background: var(--primary-dark);
}

/* Empty States */
.tickets-empty {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
}

.tickets-empty i {
    font-size: 2.5rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.tickets-empty h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 4px 0;
}

.tickets-empty p {
    font-size: 0.8125rem;
    margin: 0;
}

/* Dashboard Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--border) 25%, var(--surface-hover) 50%, var(--border) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-xs);
}

.skeleton--text {
    height: 14px;
    display: block;
}

.skeleton--circle {
    border-radius: 50%;
}

@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .welcome-banner {
        padding: 20px;
    }

    .welcome-text h1 {
        font-size: 1.375rem;
    }

    .welcome-actions {
        width: 100%;
    }

    .welcome-btn {
        flex: 1;
        justify-content: center;
    }

    .stat-tile {
        padding: 16px;
    }

    .stat-tile__value {
        font-size: 1.5rem;
    }
}
