/* Industry Monitor - Dashboard Styles */

:root {
    --primary: #667eea;
    --primary-dark: #5a67d8;
    --success: #48bb78;
    --warning: #ed8936;
    --error: #f56565;
    --text: #2d3748;
    --text-muted: #718096;
    --bg: #f7fafc;
    --card-bg: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-sm: 4px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Navbar */
.navbar {
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    padding: 0 24px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-brand a {
    font-size: 20px;
    font-weight: 600;
    color: var(--text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 8px;
}

.nav-links a {
    padding: 8px 16px;
    color: var(--text-muted);
    text-decoration: none;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
}

.nav-links a:hover {
    color: var(--text);
    background: var(--bg);
}

.nav-links a.active {
    color: var(--primary);
    background: #eef2ff;
}

/* Container */
.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    flex: 1;
}

/* Cards */
.card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

.card h2 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text);
}

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

.card-header h2 {
    margin-bottom: 0;
}

.card-actions {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    text-align: center;
}

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

.stat-label {
    font-size: 14px;
    color: var(--text-muted);
    margin-top: 4px;
}

.stat-warning .stat-value {
    color: var(--error);
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 24px;
}

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

/* Category Groups */
.category-group {
    margin-bottom: 24px;
}

.category-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Source Grid */
.source-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
}

.source-card {
    display: block;
    padding: 16px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    text-decoration: none;
    color: inherit;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.source-card:hover {
    background: #eef2ff;
    border-color: var(--primary);
}

.source-card.disabled {
    opacity: 0.5;
}

.source-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.source-name {
    font-weight: 500;
}

.source-meta {
    font-size: 12px;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-success, .status-ok {
    background: #c6f6d5;
    color: #22543d;
}

.status-error {
    background: #fed7d7;
    color: #822727;
}

.status-changed {
    background: #feebc8;
    color: #7b341e;
}

.status-pending, .status-unknown {
    background: #e2e8f0;
    color: #4a5568;
}

.status-disabled {
    background: #e2e8f0;
    color: #718096;
}

/* Badges */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.badge-competitor {
    background: #e3f2fd;
    color: #1565c0;
}

.badge-camera {
    background: #fff3e0;
    color: #ef6c00;
}

.badge-dnp {
    background: #f3e5f5;
    color: #7b1fa2;
}

.badge-social {
    background: #e0f7fa;
    color: #00838f;
}

.badge-new {
    background: #e8f5e9;
    color: #2e7d32;
}

.badge-modified {
    background: #fff8e1;
    color: #f57f17;
}

/* Changes List */
.changes-list {
    display: flex;
    flex-direction: column;
}

.change-item {
    display: flex;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.change-item:last-child {
    border-bottom: none;
}

.change-icon {
    font-size: 20px;
    width: 32px;
    text-align: center;
}

.change-content {
    flex: 1;
    min-width: 0;
}

.change-source {
    font-weight: 500;
    margin-bottom: 4px;
}

.change-meta {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}

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

.change-description {
    font-size: 13px;
    color: var(--text-muted);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

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

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

.btn-sm {
    padding: 4px 12px;
    font-size: 13px;
}

/* Forms */
.filter-form {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-muted);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    min-width: 150px;
}

/* Tables */
.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

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

.table .nowrap {
    white-space: nowrap;
}

.table .row-error {
    background: #fff5f5;
}

.table .row-changed {
    background: #fffaf0;
}

.error-cell .error-message {
    color: var(--error);
    font-size: 13px;
}

.details-cell {
    max-width: 400px;
}

.details-cell details {
    margin-top: 8px;
}

.details-cell summary {
    cursor: pointer;
    color: var(--primary);
    font-size: 13px;
}

.details-cell pre {
    margin-top: 8px;
    padding: 8px;
    background: var(--bg);
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 200px;
    overflow: auto;
}

/* Detail Page */
.page-header {
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 28px;
    font-weight: 600;
}

.back-link {
    display: inline-block;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 8px;
    font-size: 14px;
}

.back-link:hover {
    text-decoration: underline;
}

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}

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

.info-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 16px;
}

.info-list dt {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 13px;
}

.info-list dd {
    font-size: 14px;
}

.info-list pre {
    background: var(--bg);
    padding: 8px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    overflow: auto;
}

.preview-box {
    background: var(--bg);
    padding: 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    white-space: pre-wrap;
    max-height: 300px;
    overflow: auto;
}

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

.empty-state p {
    margin-bottom: 8px;
}

.text-muted {
    color: var(--text-muted);
    font-size: 13px;
}

/* Footer */
.footer {
    background: var(--card-bg);
    border-top: 1px solid var(--border);
    padding: 16px 24px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
}

/* Code */
code {
    background: var(--bg);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-family: 'SF Mono', Monaco, Consolas, monospace;
    font-size: 13px;
}
