/* Magic Extension Dashboard Styles */
:root {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-card: #242442;
    --text-primary: #ffffff;
    --text-secondary: #a0a0b0;
    --accent-blue: #4f8cff;
    --accent-green: #4caf50;
    --accent-purple: #9c27b0;
    --accent-orange: #ff9800;
    --accent-red: #f44336;
    --border-color: #3a3a5a;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 24px;
}

.back-button {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.back-button:hover {
    color: var(--text-primary);
    background: var(--bg-card);
}

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

.logo i {
    font-size: 28px;
    color: var(--accent-purple);
}

.logo h1 {
    font-size: 24px;
    font-weight: 600;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.user-id-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 14px;
    color: var(--text-secondary);
}

.user-id-display i {
    color: var(--accent-blue);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: #3d7ae8;
    transform: translateY(-1px);
}

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

.btn-secondary:hover {
    background: var(--border-color);
}

.btn-danger {
    background: var(--accent-red);
    color: white;
}

.btn-danger:hover {
    background: #d32f2f;
}

.btn-small {
    padding: 6px 12px;
    font-size: 12px;
}

.btn-active {
    background: var(--accent-blue);
    color: white;
}

/* Connection Panel */
.connection-panel {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 60px;
    text-align: center;
    box-shadow: var(--shadow);
}

.panel-icon {
    font-size: 64px;
    color: var(--accent-purple);
    margin-bottom: 24px;
}

.connection-panel h2 {
    font-size: 28px;
    margin-bottom: 12px;
}

.connection-panel p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.input-group {
    display: flex;
    gap: 12px;
    justify-content: center;
    max-width: 500px;
    margin: 0 auto 16px;
}

.input-field {
    flex: 1;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 14px;
}

.input-field:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.hint {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Download Section */
.download-section {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, #1e1e3a 100%);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

.download-content {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 32px;
    align-items: center;
}

.download-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #4285f4 0%, #34a853 50%, #fbbc05 75%, #ea4335 100%);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 40px;
    color: white;
}

.download-info h2 {
    font-size: 24px;
    margin-bottom: 8px;
}

.download-info p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.download-buttons {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.btn-large {
    padding: 14px 28px;
    font-size: 16px;
}

.install-steps {
    background: var(--bg-card);
    padding: 20px;
    border-radius: var(--radius-sm);
    min-width: 280px;
}

.install-steps h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--accent-blue);
    display: flex;
    align-items: center;
    gap: 8px;
}

.install-steps ol {
    list-style: none;
    counter-reset: steps;
}

.install-steps li {
    counter-increment: steps;
    font-size: 13px;
    color: var(--text-secondary);
    padding: 6px 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.install-steps li::before {
    content: counter(steps);
    width: 22px;
    height: 22px;
    background: var(--accent-purple);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
}

.install-steps code {
    background: var(--bg-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
    color: var(--accent-blue);
}

.install-steps strong {
    color: var(--text-primary);
}

/* VS Code Section Variant */
.vscode-section {
    background: linear-gradient(135deg, #1e1e2e 0%, #252540 100%);
}

/* Download Grid - Compact Layout */
.download-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-top: 24px;
    margin-bottom: 24px;
}

.download-section.compact {
    padding: 20px;
    margin-bottom: 0;
}

.download-section.compact .download-content {
    grid-template-columns: auto 1fr;
    gap: 16px;
}

.download-section.compact .download-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    font-size: 22px;
}

.download-section.compact .download-info h3 {
    font-size: 16px;
    margin-bottom: 4px;
}

.download-section.compact .download-info p {
    font-size: 13px;
    margin-bottom: 12px;
    color: var(--text-secondary);
}

.download-section.compact .download-buttons {
    gap: 8px;
}

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

.vscode-icon {
    background: linear-gradient(135deg, #007ACC 0%, #0098FF 100%);
}

/* VS Code Stats Section */
.vscode-stats-section {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    border-left: 4px solid #007ACC;
}

.section-title {
    font-size: 20px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title i {
    color: #007ACC;
}

.vscode-summary {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 24px;
}

.stat-icon.vscode-blue {
    background: rgba(0, 122, 204, 0.15);
    color: #007ACC;
}

.stat-icon.vscode-purple {
    background: rgba(156, 39, 176, 0.15);
    color: var(--accent-purple);
}

.vscode-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.vscode-languages,
.vscode-projects {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    padding: 20px;
}

.vscode-languages h3,
.vscode-projects h3 {
    font-size: 14px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-secondary);
}

.vscode-languages h3 i {
    color: #007ACC;
}

.vscode-projects h3 i {
    color: var(--accent-orange);
}

.languages-list,
.projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.language-item,
.project-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.language-item .name,
.project-item .name {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.language-badge {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

.language-item .time,
.project-item .time {
    font-size: 13px;
    color: var(--accent-green);
    font-weight: 500;
}

.empty-state {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-style: italic;
}

/* Language color badges */
.lang-javascript { background: #f7df1e; }
.lang-typescript { background: #3178c6; }
.lang-python { background: #3776ab; }
.lang-ruby { background: #cc342d; }
.lang-html { background: #e34c26; }
.lang-css { background: #264de4; }
.lang-json { background: #292929; }
.lang-markdown { background: #083fa1; }
.lang-java { background: #b07219; }
.lang-go { background: #00add8; }
.lang-rust { background: #dea584; }
.lang-php { background: #777bb4; }
.lang-unknown { background: #6e6e6e; }

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

/* Filter Bar */
.filter-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-secondary);
    padding: 16px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.date-range {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-range label {
    color: var(--text-secondary);
    font-size: 14px;
}

.date-input {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
}

.date-input:focus {
    outline: none;
    border-color: var(--accent-blue);
}

.quick-filters {
    display: flex;
    gap: 8px;
}

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

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 20px;
    box-shadow: var(--shadow);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.stat-icon.blue { background: rgba(79, 140, 255, 0.15); color: var(--accent-blue); }
.stat-icon.green { background: rgba(76, 175, 80, 0.15); color: var(--accent-green); }
.stat-icon.purple { background: rgba(156, 39, 176, 0.15); color: var(--accent-purple); }
.stat-icon.orange { background: rgba(255, 152, 0, 0.15); color: var(--accent-orange); }

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

.stat-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Charts */
.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
}

.chart-container {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chart-wrapper {
    position: relative;
    height: 280px;
    width: 100%;
    flex-shrink: 0;
}

.chart-wrapper canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100% !important;
    height: 100% !important;
}

.chart-container h3 {
    font-size: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chart-container h3 i {
    color: var(--accent-blue);
}

/* Details Section */
.details-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.top-domains,
.recent-activity {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
    min-width: 0;
    overflow: hidden;
}

.top-domains h3,
.recent-activity h3 {
    font-size: 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-domains h3 i {
    color: var(--accent-orange);
}

.recent-activity h3 i {
    color: var(--accent-purple);
}

.domains-list,
.activity-list {
    max-height: 400px;
    overflow-y: auto;
}

.domain-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.domain-rank {
    width: 28px;
    height: 28px;
    background: var(--accent-blue);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
}

.domain-rank.gold { background: #ffd700; color: #000; }
.domain-rank.silver { background: #c0c0c0; color: #000; }
.domain-rank.bronze { background: #cd7f32; color: #fff; }

.domain-info {
    flex: 1;
}

.domain-name {
    font-weight: 500;
    margin-bottom: 2px;
}

.domain-stats {
    font-size: 12px;
    color: var(--text-secondary);
}

.domain-time {
    font-size: 14px;
    color: var(--accent-green);
    font-weight: 500;
}

.activity-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.activity-icon {
    width: 32px;
    height: 32px;
    background: rgba(79, 140, 255, 0.15);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--accent-blue);
}

.activity-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.activity-title {
    font-weight: 500;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.activity-domain {
    font-size: 12px;
    color: var(--accent-blue);
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Danger Zone */
.danger-zone {
    background: var(--bg-secondary);
    border: 1px solid var(--accent-red);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow);
}

.danger-zone h3 {
    color: var(--accent-red);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.danger-zone p {
    color: var(--text-secondary);
    margin-bottom: 16px;
}

/* Footer */
.footer {
    text-align: center;
    padding: 24px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 16px 24px;
    background: var(--accent-green);
    color: white;
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: var(--shadow);
    transform: translateY(100px);
    opacity: 0;
    transition: all 0.3s;
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    background: var(--accent-red);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 32px;
    border-radius: var(--radius);
    max-width: 400px;
    text-align: center;
}

.modal-content h3 {
    color: var(--accent-red);
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Loading */
.loading {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-card);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

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

    .charts-section {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 992px) {
    .download-content {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .download-icon {
        margin: 0 auto;
    }

    .download-buttons {
        justify-content: center;
    }

    .install-steps {
        min-width: auto;
    }
}

@media (max-width: 768px) {
    .header {
        flex-direction: column;
        gap: 16px;
    }

    .header-left,
    .header-right {
        width: 100%;
        justify-content: center;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .details-section {
        grid-template-columns: 1fr;
    }

    .filter-bar {
        flex-direction: column;
        gap: 16px;
    }

    .date-range {
        flex-wrap: wrap;
        justify-content: center;
    }

    .input-group {
        flex-direction: column;
    }

    .download-section {
        padding: 24px;
    }

    .download-buttons {
        flex-direction: column;
    }

    .download-buttons .btn {
        width: 100%;
        justify-content: center;
    }

    .vscode-summary {
        grid-template-columns: 1fr;
    }

    .vscode-details {
        grid-template-columns: 1fr;
    }
}
