/* Link Analytics Page Styles - Extracted from templates/pages/link_analytics.html */

.ldr-link-analytics-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.ldr-metrics-header {
    background: var(--gradient-bg);
    color: var(--text-primary);
    padding: 2rem;
    border-radius: 0.75rem;
    margin-bottom: 2rem;
    text-align: center;
    border: 1px solid var(--border-color);
    box-shadow: var(--card-shadow);
}

.ldr-metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.ldr-metric-card {
    background: var(--bg-secondary);
    border-radius: 0.75rem;
    padding: 1.5rem;
    box-shadow: var(--card-shadow);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.ldr-metric-card:hover {
    transform: translateY(-2px);
}

.ldr-metric-card h3 {
    margin-top: 0;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 0.75rem;
    margin-bottom: 1rem;
    font-size: 1.125rem;
}

.ldr-chart-container {
    position: relative;
    height: 300px;
    margin-bottom: 1rem;
}

.ldr-overall-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.ldr-stat-item {
    text-align: center;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.ldr-stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent-primary);
    display: block;
}

.ldr-stat-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ldr-domain-list {
    max-height: 400px;
    overflow-y: auto;
}

.ldr-domain-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    border-bottom: 1px solid var(--border-color);
    transition: background-color 0.2s ease;
}

.ldr-domain-item:hover {
    background-color: var(--bg-tertiary);
}

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

.ldr-domain-name {
    font-weight: 500;
    color: var(--text-primary);
    flex: 1;
}

.ldr-domain-count {
    background: var(--accent-primary);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.ldr-domain-percentage {
    color: var(--text-secondary);
    font-size: 0.875rem;
    margin-left: 0.5rem;
}

.ldr-domain-item-expanded {
    flex-direction: column;
    align-items: stretch;
    padding: 1rem;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    margin-bottom: 0.75rem;
}

.ldr-domain-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ldr-domain-stats {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.ldr-metric-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    border-radius: 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
}

.ldr-metric-badge.ldr-frequency {
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    color: white;
    border: none;
}

.ldr-metric-badge.ldr-diversity {
    background: linear-gradient(135deg, var(--accent-tertiary), var(--accent-tertiary));
    color: white;
    border: none;
}

.ldr-metric-badge.ldr-rank {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.ldr-research-links {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border-color);
}

.ldr-research-links-title {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.ldr-research-link {
    display: inline-block;
    margin: 0.25rem 0.5rem 0.25rem 0;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 0.25rem;
    color: var(--accent-primary);
    text-decoration: none;
    font-size: 0.8125rem;
    transition: all 0.2s;
}

.ldr-research-link:hover {
    background: var(--accent-primary);
    color: white;
    transform: translateY(-1px);
}

.ldr-source-type-bar {
    display: flex;
    align-items: center;
    margin: 0.5rem 0;
    gap: 0.75rem;
}

.ldr-source-type-label {
    min-width: 100px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.ldr-source-type-progress {
    flex: 1;
    height: 20px;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    overflow: hidden;
}

.ldr-source-type-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 0.5rem;
}

.ldr-source-type-fill.ldr-academic {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
}

.ldr-source-type-fill.ldr-news {
    background: linear-gradient(90deg, var(--warning-color), var(--warning-color));
}

.ldr-source-type-fill.ldr-reference {
    background: linear-gradient(90deg, var(--accent-tertiary), var(--accent-tertiary));
}

.ldr-source-type-fill.ldr-general {
    background: linear-gradient(90deg, var(--success-color), var(--success-color));
}

.ldr-source-type-count {
    font-weight: 500;
    min-width: 40px;
    text-align: right;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.ldr-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin: 1rem 0;
}

.ldr-category-card {
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    padding: 1rem;
    text-align: center;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.ldr-category-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.ldr-category-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.ldr-category-count {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.ldr-category-percentage {
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.8;
}

.ldr-period-selector {
    margin-bottom: 1.5rem;
}

.ldr-period-selector label {
    color: var(--text-secondary);
    margin-right: 0.5rem;
    font-weight: 500;
}

.ldr-period-selector select {
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 0.375rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: border-color 0.2s ease;
}

.ldr-period-selector select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(var(--accent-primary-rgb), 0.1);
}

.ldr-loading {
    text-align: center;
    padding: 2.5rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    border-radius: 0.5rem;
    border: 1px solid var(--border-color);
}

.ldr-error {
    background: rgba(var(--error-color-rgb), 0.1);
    color: var(--error-color);
    padding: 1rem;
    border-radius: 0.5rem;
    margin: 1.25rem 0;
    border: 1px solid rgba(var(--error-color-rgb), 0.2);
}

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

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

    .ldr-link-analytics-container {
        padding: 1rem;
    }

    /* Fix period selector overlap on mobile */
    .ldr-period-selector {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 1rem !important;
    }

    .ldr-period-selector > div {
        width: 100%;
    }

    .ldr-period-selector select {
        width: 100%;
    }

    .ldr-period-selector button {
        width: 100%;
    }

    /* Category grid - single column on narrow screens */
    .ldr-category-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    /* Mobile nav spacing */
    .ldr-link-analytics-container {
        padding-bottom: 120px;
    }
}

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

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

    .ldr-metrics-header h1 {
        font-size: 1.25rem;
    }

    .ldr-metrics-header {
        flex-direction: column !important;
        gap: 1rem;
        text-align: center;
    }

    .ldr-metrics-header > div {
        flex-direction: column !important;
        gap: 0.75rem;
    }
}

/* Modal styles for classification dialog */
.ldr-modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
}

.ldr-modal-content {
    position: relative;
    background-color: var(--bg-secondary);
    margin: 5% auto;
    padding: 2rem;
    border-radius: 0.75rem;
    width: 80%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
}

.ldr-modal-header {
    margin-bottom: 1.5rem;
}

.ldr-modal-header h2 {
    margin: 0;
    color: var(--text-primary);
}

.ldr-close-modal {
    position: absolute;
    right: 1.5rem;
    top: 1.5rem;
    font-size: 1.5rem;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.ldr-close-modal:hover {
    color: var(--text-primary);
}

.ldr-progress-bar {
    width: 100%;
    height: 30px;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    overflow: hidden;
    margin: 1rem 0;
}

.ldr-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
    transition: width 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 500;
}

.ldr-classification-log {
    max-height: 300px;
    overflow-y: auto;
    background: var(--bg-tertiary);
    border-radius: 0.5rem;
    padding: 1rem;
    margin-top: 1rem;
    font-size: 0.875rem;
}

.ldr-log-entry {
    padding: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.ldr-log-entry:last-child {
    border-bottom: none;
}

.ldr-log-entry.ldr-success {
    color: var(--success-color);
}

.ldr-log-entry.ldr-error {
    color: var(--error-color);
}

.ldr-classified-badge {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    background: var(--success-color);
    color: white;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    margin-left: 0.5rem;
}
