/* ═══════════════════════════════════════════════════════════════
   Backlink Monitor — Premium Dark UI
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

/* ─── CSS Variables ───────────────────────────────────────────── */
:root {
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: rgba(255, 255, 255, 0.9);
    --bg-card-hover: rgba(248, 250, 252, 1);
    --bg-glass: rgba(0, 0, 0, 0.02);
    --bg-input: #ffffff;
    --bg-modal: rgba(255, 255, 255, 0.98);

    --border-color: #e2e8f0;
    --border-focus: rgba(99, 102, 241, 0.5);

    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #94a3b8;

    --accent: #4f46e5;
    --accent-hover: #4338ca;
    --accent-glow: rgba(79, 70, 229, 0.2);

    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.1);
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.1);
    --danger: #ef4444;
    --danger-bg: rgba(239, 68, 68, 0.1);
    --info: #3b82f6;
    --info-bg: rgba(59, 130, 246, 0.1);

    --gradient-1: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    --gradient-2: linear-gradient(135deg, #10b981 0%, #06b6d4 100%);
    --gradient-3: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-glow: 0 0 15px var(--accent-glow);

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition: all 0.2s ease;
    --transition-slow: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ─── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0; padding: 0; box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

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

/* Background glow effect */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.03) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(139, 92, 246, 0.02) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--accent); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--accent-hover); }

/* ─── Scrollbar ───────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ─── Login Page ──────────────────────────────────────────────── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.login-card {
    background: var(--bg-card);
    backdrop-filter: blur(20px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease;
}

.login-card h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 8px;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-card p {
    color: var(--text-secondary);
    margin-bottom: 32px;
}

.login-error {
    background: var(--danger-bg);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    margin-bottom: 16px;
    font-size: 0.875rem;
    display: none;
}

/* ─── App Layout ──────────────────────────────────────────────── */
.app-layout {
    display: flex;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

.sidebar {
    width: 260px;
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 100;
    transition: var(--transition-slow);
}

.sidebar-logo {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo h2 {
    font-size: 1.25rem;
    font-weight: 700;
    background: var(--gradient-1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-logo h2 .logo-icon {
    width: 32px;
    height: 32px;
    background: var(--gradient-1);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    overflow-y: auto;
}

.nav-section {
    margin-bottom: 24px;
}

.nav-section-title {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    padding: 0 12px;
    margin-bottom: 8px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 0.9rem;
    font-weight: 500;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover {
    background: var(--bg-glass);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--accent);
}

.nav-item .nav-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-item .nav-icon svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--accent);
    color: white;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    min-width: 22px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px 12px;
    border-top: 1px solid var(--border-color);
}

.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 24px 32px;
    min-height: 100vh;
}

/* ─── Page Header ─────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.page-header h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
}

.page-header p {
    color: var(--text-secondary);
    margin-top: 4px;
    font-size: 0.9rem;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

/* ─── Buttons ─────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
    white-space: nowrap;
}

.btn-primary {
    background: var(--gradient-1);
    color: white;
    border: none;
    box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 0 30px var(--accent-glow);
}

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

.btn-secondary:hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
}

.btn-danger {
    background: var(--danger-bg);
    color: var(--danger);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}

.btn-sm {
    padding: 6px 14px;
    font-size: 0.8rem;
}

.btn-icon {
    padding: 8px;
    width: 36px;
    height: 36px;
    justify-content: center;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

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

.stat-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: 3px 3px 0 0;
}

.stat-card.accent::before { background: var(--gradient-1); }
.stat-card.success::before { background: var(--gradient-2); }
.stat-card.warning::before { background: var(--gradient-3); }
.stat-card.info::before { background: linear-gradient(135deg, #3b82f6, #06b6d4); }

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--accent);
}
.stat-card.clickable {
    cursor: pointer;
}

.stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    margin-bottom: 14px;
}

.stat-card.accent .stat-icon { background: rgba(99, 102, 241, 0.15); color: var(--accent); }
.stat-card.success .stat-icon { background: var(--success-bg); color: var(--success); }
.stat-card.warning .stat-icon { background: var(--warning-bg); color: var(--warning); }
.stat-card.info .stat-icon { background: var(--info-bg); color: var(--info); }

.stat-card .stat-value {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 4px;
    line-height: 1;
}

.stat-card .stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ─── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: var(--accent);
}

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

.card-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.card-body {
    padding: 20px;
}

/* ─── Table ───────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    min-height: 250px;
}

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

thead th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    transition: var(--transition);
}

thead th:hover { color: var(--text-secondary); }
thead th.sorted { color: var(--accent); }

tbody tr {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

tbody tr:hover { background: var(--bg-glass); }

tbody td {
    padding: 5px 16px;
    font-size: 0.875rem;
    vertical-align: middle;
}

.url-cell {
    max-width: 300px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.url-cell a {
    color: var(--text-primary);
}

.url-cell a:hover {
    color: var(--accent);
}

/* ─── Status Badges ───────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge-ok { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-error, .badge-http_error { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); }
.badge-link_not_found { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-pending { background: var(--info-bg); color: var(--info); border: 1px solid rgba(59, 130, 246, 0.2); }
.badge-dofollow { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.2); }
.badge-nofollow { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.2); }
.badge-anchor-warn { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.2); font-weight: bold; padding: 2px 6px; }
.badge-project { background: var(--bg-glass); color: var(--text-secondary); border: 1px solid var(--border-color); }

/* ─── Forms ───────────────────────────────────────────────────── */
.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: flex;
    gap: 16px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

input[type="text"],
input[type="url"],
input[type="password"],
input[type="search"],
textarea,
select {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.875rem;
    transition: var(--transition);
    outline: none;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

input::placeholder, textarea::placeholder {
    color: var(--text-muted);
}

/* Fix input borders for light theme */
input[type="text"], input[type="url"], input[type="password"], input[type="search"], textarea, select {
    border: 1px solid #cbd5e1;
}

textarea {
    min-height: 80px;
    resize: vertical;
}

select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%2394a3b8'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 20px;
    padding-right: 36px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

/* ─── Modal ───────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    transform: translateY(20px) scale(0.95);
    transition: var(--transition-slow);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

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

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: none;
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    font-size: 1.1rem;
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ─── Pagination ──────────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 16px;
}

.pagination button {
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-color);
    background: var(--bg-input);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    font-family: inherit;
    font-size: 0.8rem;
}

.pagination button:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.pagination button.active {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-info {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin: 0 12px;
}

/* ─── Search & Filters ────────────────────────────────────────── */
.filters-bar {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input {
    flex: 1;
    min-width: 200px;
    position: relative;
}

.search-input input {
    padding-left: 36px;
}

.search-input .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1;
    color: var(--text-muted);
    display: flex;
}

.filter-select {
    min-width: 140px;
}

.filter-select select {
    width: 100%;
}

/* ─── Project Cards ───────────────────────────────────────────── */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.project-card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.project-card .project-stats {
    display: flex;
    gap: 16px;
    margin-top: auto;
}

.project-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.project-card h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.project-card .project-desc {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 16px;
    line-height: 1.5;
}

.project-card .project-stat {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.project-card .project-stat .dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.project-card .project-stat .dot.green { background: var(--success); }
.project-card .project-stat .dot.red { background: var(--danger); }
.project-card .project-stat .dot.gray { background: var(--text-muted); }

.project-card .project-actions {
    position: absolute;
    top: 16px;
    right: 16px;
    display: flex;
    gap: 4px;
    opacity: 0;
    transition: var(--transition);
}

.project-card:hover .project-actions {
    opacity: 1;
}

/* ─── History Timeline ────────────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 24px;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border-color);
}

.timeline-item {
    position: relative;
    padding-bottom: 20px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -20px;
    top: 6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: 2px solid var(--border-color);
    background: var(--bg-secondary);
}

.timeline-item.status-ok::before { border-color: var(--success); background: var(--success); }
.timeline-item.status-error::before, .timeline-item.status-http_error::before { border-color: var(--danger); background: var(--danger); }
.timeline-item.status-link_not_found::before { border-color: var(--warning); background: var(--warning); }

.timeline-item .timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-item .timeline-content {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ─── Toast Notifications ─────────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 300px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideInRight 0.3s ease;
    font-size: 0.875rem;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--info); }

/* ─── Loading Spinner ─────────────────────────────────────────── */
.spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--border-color);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 23, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: inherit;
    z-index: 10;
}

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

.empty-state .empty-icon {
    font-size: 3rem;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.1rem;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 400px;
    margin: 0 auto 20px;
}

/* ─── Charts Area ─────────────────────────────────────────────── */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.chart-container {
    padding: 20px;
    position: relative;
    min-height: 200px;
}

.donut-chart {
    width: 160px;
    height: 160px;
    margin: 0 auto;
    position: relative;
}

.donut-chart svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.donut-chart .center-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.donut-chart .center-text .value {
    font-size: 1.5rem;
    font-weight: 700;
}

.donut-chart .center-text .label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
    margin-top: 16px;
}

.chart-legend .legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.chart-legend .legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

/* ─── Animations ──────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideInRight {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.fade-in {
    animation: fadeInUp 0.4s ease;
}

/* ─── Responsive ──────────────────────────────────────────────── */
.sidebar-toggle {
    display: none;
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 16px;
        padding-top: 60px;
    }

    .sidebar-toggle {
        display: flex;
    }

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

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

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

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .filters-bar {
        flex-direction: column;
    }

    .search-input {
        min-width: 100%;
    }
}

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

/* ─── Selection checkbox ──────────────────────────────────────── */
.row-checkbox {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
    cursor: pointer;
}

.bulk-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: rgba(99, 102, 241, 0.1);
    border-radius: var(--radius-md);
    margin-bottom: 12px;
    animation: fadeInUp 0.2s ease;
}

.bulk-actions span {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ─── Checking animation ──────────────────────────────────────── */
.checking-indicator {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--info);
    font-size: 0.8rem;
}

.checking-indicator .spinner {
    width: 14px;
    height: 14px;
}

/* ─── Timeline ────────────────────────────────────────────────── */
.timeline {
    position: relative;
    padding-left: 20px;
    border-left: 2px solid var(--border-color);
    margin-top: 10px;
}

.timeline-item {
    position: relative;
    margin-bottom: 20px;
    padding-left: 15px;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -27px;
    top: 0;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
}

.timeline-item.status-ok::before { border-color: var(--success); background: var(--success); }
.timeline-item.status-error::before, .timeline-item.status-http_error::before { border-color: var(--danger); background: var(--danger); }
.timeline-item.status-link_not_found::before { border-color: var(--warning); background: var(--warning); }

.timeline-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.timeline-content {
    font-size: 0.85rem;
    line-height: 1.5;
    background: var(--bg-glass);
    padding: 10px;
    border-radius: var(--radius-md);
}

/* ─── Link Actions ────────────────────────────────────────────── */
.action-btns {
    display: flex;
    gap: 6px;
}

.ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.ico svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

/* ─── Utility ─────────────────────────────────────────────────── */
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; }
.items-center { align-items: center; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.hidden { display: none !important; }

/* ─── Dropdown ────────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu { display: none; position: absolute; right: 0; background-color: var(--bg-card); min-width: 140px; box-shadow: 0 8px 16px rgba(0,0,0,0.2); z-index: 100; border-radius: var(--radius-md); border: 1px solid var(--border-color); padding: 5px 0; }
.dropdown-menu a { color: var(--text-primary); padding: 8px 12px; text-decoration: none; display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.dropdown-menu a:hover { background-color: var(--bg-hover); }
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu-right { right: 0; left: auto; }
.dropdown-menu-up { top: auto; bottom: 100%; margin-bottom: 5px; }

/* ─── Source Column Styling ───────────────────────────────────── */
.source-title { font-weight: 500; color: var(--accent); font-size: 0.85rem; margin-bottom: 2px; line-height: 1.3; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; word-break: break-word; }
.source-url a { font-size: 0.75rem; color: #10b981; text-decoration: none; word-break: break-all; }
.source-url a:hover { text-decoration: underline; }

/* ─── Purple Stat Card ────────────────────────────────────────── */
.stat-card.purple::before { background: linear-gradient(135deg, #a855f7, #d946ef); }
.stat-card.purple .stat-icon { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
