/**
 * Dashboard CSS - Charts, Cards, Tables, and Responsive Design
 * Supports Dark Mode via design-tokens.css
 *
 * Note: All color/theme variables are defined in design-tokens.css
 * This file uses those tokens for consistent theming.
 */

/* === Dashboard Layout - Bold Analytics Experience === */
.dashboard {
    padding: 3rem 0;
}

.dashboard-header {
    margin-bottom: 3rem;
    position: relative;
    padding-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.dashboard-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-cyan), transparent);
}

.dashboard-header h1 {
    font-size: 3.5rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1;
    letter-spacing: -0.04em;
    font-family: 'Epilogue', sans-serif;
    text-transform: uppercase;
    position: relative;
    display: inline-block;
}

.dashboard-header h1::before {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: linear-gradient(135deg, rgba(255, 51, 102, 0.1), rgba(99, 102, 241, 0.1));
    z-index: -1;
    transform: skew(-2deg);
}

.dashboard-header p {
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

/* === Grid System === */
.grid {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

/* === Cards - Bold Container Design === */
.card {
    background: var(--bg-card);
    border: 4px solid var(--border-light);
    border-radius: 0;
    padding: 2rem;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-purple));
}

.card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 12px 12px 0px rgba(0, 0, 0, 0.2);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 3px solid var(--border-light);
    position: relative;
}

.card-header::after {
    content: '';
    position: absolute;
    bottom: -3px;
    left: 0;
    width: 80px;
    height: 3px;
    background: var(--primary-color);
}

.card-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    font-family: 'Epilogue', sans-serif;
}

.card-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-weight: 600;
}

.card-body {
    color: var(--text-primary);
}

.card-footer {
    margin-top: 1.5rem;
    padding-top: 1rem;
    border-top: 2px solid var(--border-light);
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 600;
}

/* === Metric Cards - Neo-Brutalist Data Display === */
.metric-card {
    background: var(--bg-card);
    border: 4px solid var(--border-light);
    border-radius: 0;
    padding: 2rem;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.15);
    position: relative;
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.metric-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-yellow));
}

.metric-card:hover {
    transform: translate(-4px, -4px) rotate(-1deg);
    box-shadow: 12px 12px 0px rgba(0, 0, 0, 0.2);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 1rem;
    font-weight: 800;
}

.metric-value {
    font-size: 3rem;
    font-weight: 900;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    line-height: 1;
    letter-spacing: -0.04em;
    font-family: 'Epilogue', sans-serif;
}

.metric-change {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 800;
    padding: 0.375rem 0.75rem;
    border-radius: 0;
    border: 2px solid currentColor;
}

.metric-change.positive {
    color: var(--color-success);
    background: rgba(0, 230, 118, 0.1);
}

.metric-change.negative {
    color: var(--color-danger);
    background: rgba(255, 51, 102, 0.1);
}

.metric-change.neutral {
    color: var(--text-secondary);
    background: rgba(115, 115, 115, 0.1);
}

.metric-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    margin-bottom: 1.5rem;
    border: 3px solid;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
}

.metric-icon.blue {
    background: rgba(99, 102, 241, 0.15);
    color: #6366F1;
    border-color: #6366F1;
}

.metric-icon.green {
    background: rgba(0, 230, 118, 0.15);
    color: #00E676;
    border-color: #00E676;
}

.metric-icon.purple {
    background: rgba(157, 78, 221, 0.15);
    color: #9D4EDD;
    border-color: #9D4EDD;
}

.metric-icon.orange {
    background: rgba(255, 190, 11, 0.15);
    color: #FFBE0B;
    border-color: #FFBE0B;
}

/* === Tables === */
.table-container {
    overflow-x: auto;
    margin-top: 1rem;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead {
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border-light);
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.data-table th.sortable {
    cursor: pointer;
    user-select: none;
    transition: color 0.2s;
}

.data-table th.sortable:hover {
    color: var(--color-info);
}

.data-table th.sortable::after {
    content: "↕";
    margin-left: 0.5rem;
    opacity: 0.3;
}

.data-table th.sorted-asc::after {
    content: "↑";
    opacity: 1;
}

.data-table th.sorted-desc::after {
    content: "↓";
    opacity: 1;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--border-light);
    transition: background-color 0.2s;
}

.data-table tbody tr:hover {
    background: var(--bg-secondary);
}

.data-table td {
    padding: 1rem;
    color: var(--text-primary);
}

.data-table td.rank {
    font-weight: 700;
    color: var(--text-secondary);
    width: 3rem;
}

.data-table .creator-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.creator-avatar {
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 50%;
    object-fit: cover;
    background: var(--bg-secondary);
}

.creator-name {
    font-weight: 600;
    color: var(--text-primary);
}

.creator-username {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

/* === Platform Badges === */
.platform-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.platform-badge.tiktok {
    background: rgba(0, 0, 0, 0.1);
    color: #000000;
}

[data-theme="dark"] .platform-badge.tiktok {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.platform-badge.instagram {
    background: linear-gradient(45deg, #f09433 0%, #e6683c 25%, #dc2743 50%, #cc2366 75%, #bc1888 100%);
    color: white;
}

.platform-badge.youtube {
    background: #ff0000;
    color: white;
}

/* === Charts === */
.chart-container {
    position: relative;
    height: 300px;
    margin-top: 1rem;
}

.chart-container.large {
    height: 400px;
}

.chart-container.small {
    height: 200px;
}

/* === Filters === */
.filters {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 8px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.filter-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.filter-group select,
.filter-group input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border-light);
    border-radius: 6px;
    background: var(--bg-card);
    color: var(--text-primary);
    font-size: 0.875rem;
    min-width: 150px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: var(--color-info);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* === Tabs === */
.tabs {
    display: flex;
    gap: 0.5rem;
    border-bottom: 2px solid var(--border-light);
    margin-bottom: 1.5rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: -2px;
}

.tab:hover {
    color: var(--text-primary);
}

.tab.active {
    color: var(--color-info);
    border-bottom-color: var(--color-info);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* === Buttons === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: var(--color-info);
    color: white;
}

.btn-primary:hover {
    background: var(--color-info-hover);
}

.btn-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-card);
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

.btn-icon {
    padding: 0.5rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* === Loading States - Bold Spinner === */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    gap: 1.5rem;
    color: var(--text-secondary);
}

.spinner {
    width: 3rem;
    height: 3rem;
    border: 4px solid var(--border-light);
    border-top-color: var(--primary-color);
    border-right-color: var(--accent-cyan);
    border-radius: 0;
    animation: spinSquare 1.2s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
}

@keyframes spinSquare {
    0% {
        transform: rotate(0deg) scale(1);
        border-radius: 0;
    }
    25% {
        transform: rotate(90deg) scale(1.1);
        border-radius: 20%;
    }
    50% {
        transform: rotate(180deg) scale(1);
        border-radius: 50%;
    }
    75% {
        transform: rotate(270deg) scale(1.1);
        border-radius: 20%;
    }
    100% {
        transform: rotate(360deg) scale(1);
        border-radius: 0;
    }
}

/* === Empty States - Distinctive Placeholder === */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    position: relative;
    background: linear-gradient(135deg, rgba(255, 51, 102, 0.03), rgba(99, 102, 241, 0.03));
    border: 3px dashed var(--border-light);
}

.empty-state::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        repeating-linear-gradient(45deg, transparent, transparent 10px, rgba(0, 0, 0, 0.02) 10px, rgba(0, 0, 0, 0.02) 20px);
    pointer-events: none;
}

.empty-state-icon {
    font-size: 4rem;
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    filter: grayscale(50%);
    opacity: 0.6;
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: -0.02em;
    font-family: 'Epilogue', sans-serif;
}

.empty-state-text {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 600;
}

/* === App Launcher Section === */
.app-launcher {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.app-launcher-card {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1.5rem 2rem;
    background: var(--bg-card);
    border: 4px solid var(--border-light);
    border-radius: 0;
    box-shadow: 8px 8px 0px rgba(0, 0, 0, 0.15);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
}

.app-launcher-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 6px;
}

.app-launcher-card.story-shorts::before {
    background: linear-gradient(90deg, var(--accent-cyan), var(--accent-purple, #9D4EDD));
}

.app-launcher-card.ugc-pipeline::before {
    background: linear-gradient(90deg, var(--accent-yellow, #FFBE0B), var(--primary-color));
}

.app-launcher-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 12px 12px 0px rgba(0, 0, 0, 0.2);
    text-decoration: none;
    color: inherit;
}

.app-launcher-card:active {
    transform: translate(0, 0);
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.15);
}

.app-launcher-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    border: 3px solid;
    box-shadow: 4px 4px 0px rgba(0, 0, 0, 0.2);
    flex-shrink: 0;
}

.app-launcher-card.story-shorts .app-launcher-icon {
    background: rgba(0, 245, 255, 0.15);
    color: var(--accent-cyan);
    border-color: var(--accent-cyan);
}

.app-launcher-card.ugc-pipeline .app-launcher-icon {
    background: rgba(255, 190, 11, 0.15);
    color: var(--accent-yellow, #FFBE0B);
    border-color: var(--accent-yellow, #FFBE0B);
}

.app-launcher-info {
    flex: 1;
    min-width: 0;
}

.app-launcher-title {
    font-size: 1.125rem;
    font-weight: 800;
    color: var(--text-primary);
    text-transform: uppercase;
    letter-spacing: -0.02em;
    font-family: 'Epilogue', sans-serif;
    margin-bottom: 0.25rem;
}

.app-launcher-desc {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.app-launcher-arrow {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-secondary);
    transition: transform 0.3s ease, color 0.3s ease;
    flex-shrink: 0;
}

.app-launcher-card:hover .app-launcher-arrow {
    transform: translateX(4px);
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .app-launcher {
        grid-template-columns: 1fr;
    }

    .app-launcher-card {
        padding: 1.25rem;
    }

    .app-launcher-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.25rem;
    }
}

/* === Stats Grid === */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* === Big Movers Widget === */
.movers-widget {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mover-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 6px;
    transition: background-color 0.2s;
}

.mover-item:hover {
    background: var(--border-light);
}

.mover-rank {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 2rem;
    text-align: center;
}

.mover-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--bg-card);
}

.mover-info {
    flex: 1;
}

.mover-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.mover-platform {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.mover-change {
    text-align: right;
}

.mover-value {
    font-size: 1.25rem;
    font-weight: 700;
}

.mover-value.gain {
    color: var(--color-success);
}

.mover-value.loss {
    color: var(--color-danger);
}

.mover-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* === Alert Badges === */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: rgba(16, 185, 129, 0.1); color: var(--color-success); }
.badge-danger { background: rgba(239, 68, 68, 0.1); color: var(--color-danger); }
.badge-warning { background: rgba(245, 158, 11, 0.1); color: var(--color-warning); }
.badge-info { background: rgba(59, 130, 246, 0.1); color: var(--color-info); }

/* === Responsive Design === */
@media (max-width: 1024px) {
    .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .dashboard {
        padding: 1rem 0;
    }

    .dashboard-header h1 {
        font-size: 1.5rem;
    }

    .grid-cols-2,
    .grid-cols-3,
    .grid-cols-4 {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 1rem;
    }

    .filters {
        flex-direction: column;
    }

    .filter-group select,
    .filter-group input {
        width: 100%;
        min-width: auto;
    }

    .metric-value {
        font-size: 1.5rem;
    }

    .chart-container {
        height: 250px;
    }

    .data-table {
        font-size: 0.875rem;
    }

    .data-table th,
    .data-table td {
        padding: 0.5rem;
    }

    .creator-avatar {
        width: 2rem;
        height: 2rem;
    }
}

/* === Print Styles === */
@media print {
    .filters,
    .btn,
    .tab {
        display: none;
    }

    .card {
        break-inside: avoid;
    }
}

/* === Utility Classes === */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }

.text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-medium { font-weight: 500; }

.text-muted { color: var(--text-secondary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
