/* ============================================
   Dashboard Enhancements
   Styling for dynamically-rendered components.
   No !important overrides - specificity-based.
============================================ */

/* DEFCON Level Color Classes */
.metric-value.defcon-1 { color: #ff0000; }
.metric-value.defcon-2 { color: #ff4444; }
.metric-value.defcon-3 { color: #ff9944; }
.metric-value.defcon-4 { color: #44aaff; }
.metric-value.defcon-5 { color: #44ff88; }

/* Trending ATT&CK Items - Clickable */
.trending-item {
    padding: 8px;
    margin: 4px 0;
    border-radius: 3px;
    transition: all 0.2s;
}

.trending-item:hover {
    background: #2e2e2e;
    transform: translateX(3px);
}

.trending-item:focus-visible {
    outline: 2px solid #b85c40;
    outline-offset: 2px;
}

/* Sector and Geo Items - Clickable */
.sector-item,
.geo-item {
    transition: all 0.2s;
    border-left: 2px solid transparent;
    padding-left: 8px;
    cursor: pointer;
    padding-top: 4px;
    padding-bottom: 4px;
}

.sector-item:hover,
.geo-item:hover {
    background: #2e2e2e;
    border-left-color: #9a4c30;
    transform: translateX(3px);
}

.geo-item:focus-visible,
.sector-item:focus-visible {
    outline: 2px solid #b85c40;
    outline-offset: 2px;
}

/* Sector bullet color */
.sector-bullet {
    color: #9a4c30;
}

/* No Data State */
.no-data {
    color: #666;
    font-style: italic;
    padding: 12px;
    text-align: center;
}

/* ATT&CK Tag styling */
.tag-attack {
    background: #2c3e50;
    cursor: pointer;
}

.tag-attack:hover {
    background: #34495e;
    box-shadow: 0 0 8px rgba(154, 76, 48, 0.5);
}

/* Priority Tags */
.tag-priority {
    font-weight: bold;
}

.priority-1 {
    background: #ff4444;
    color: #fff;
}

.priority-2 {
    background: #ff9944;
    color: #fff;
}

.priority-3 {
    background: #44aaff;
    color: #fff;
}

/* Sidebar widget containers */
.trending-attacks,
.sector-list,
.geo-list {
    max-height: 300px;
    overflow-y: auto;
}

/* Scrollbar styling for sidebar widgets */
.trending-attacks::-webkit-scrollbar,
.sector-list::-webkit-scrollbar,
.geo-list::-webkit-scrollbar {
    width: 6px;
}

.trending-attacks::-webkit-scrollbar-track,
.sector-list::-webkit-scrollbar-track,
.geo-list::-webkit-scrollbar-track {
    background: #1a1a1a;
}

.trending-attacks::-webkit-scrollbar-thumb,
.sector-list::-webkit-scrollbar-thumb,
.geo-list::-webkit-scrollbar-thumb {
    background: #9a4c30;
    border-radius: 3px;
}

/* ============================================
   ARTICLE DETAIL OVERLAY
============================================ */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 30px;
    overflow-y: auto;
}

.detail-panel {
    background: #1a1a1a;
    border: 2px solid #9a4c30;
    max-width: 900px;
    width: 100%;
    max-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), 0 0 20px rgba(154, 76, 48, 0.2);
}

.detail-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: linear-gradient(180deg, #242424 0%, #1a1a1a 100%);
    border-bottom: 1px solid #9a4c30;
    flex-shrink: 0;
}

.detail-header-label {
    color: #9a4c30;
    font-size: 0.85em;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 2px;
}

.detail-close-btn {
    background: #242424;
    border: 1px solid #9a4c30;
    color: #b0b0b0;
    padding: 6px 14px;
    font-family: 'Courier New', monospace;
    font-size: 0.8em;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: all 0.3s;
}

.detail-close-btn:hover {
    background: #9a4c30;
    color: #fff;
}

.detail-close-btn:focus-visible {
    outline: 2px solid #b85c40;
    outline-offset: 2px;
}

.detail-content {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.detail-title {
    font-size: 1.4em;
    font-weight: bold;
    color: #e0e0e0;
    margin-bottom: 16px;
    line-height: 1.4;
}

.detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.detail-meta-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
    background: #0d0d0d;
    border-left: 3px solid #9a4c30;
    margin-bottom: 24px;
}

.detail-meta-item {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.detail-meta-label {
    color: #9a4c30;
    font-size: 0.75em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.detail-meta-value {
    color: #e0e0e0;
    font-size: 0.9em;
}

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

.detail-section-title {
    color: #9a4c30;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding-bottom: 8px;
    border-bottom: 1px solid #333;
    margin-bottom: 12px;
}

.detail-summary-text {
    color: #b0b0b0;
    line-height: 1.8;
    font-size: 0.95em;
}

/* ATT&CK Techniques */
.detail-technique-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.detail-technique-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: #0d0d0d;
    border-left: 3px solid #2c3e50;
}

.detail-technique-id {
    color: #00ff41;
    font-weight: bold;
    font-size: 0.9em;
    min-width: 70px;
}

.detail-technique-name {
    flex: 1;
    color: #b0b0b0;
    font-size: 0.9em;
}

.detail-technique-link {
    color: #9a4c30;
    text-decoration: none;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    transition: color 0.2s;
}

.detail-technique-link:hover {
    color: #b85c40;
    text-shadow: 0 0 8px rgba(154, 76, 48, 0.5);
}

/* IOCs */
.detail-ioc-grid {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.detail-ioc-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: #0d0d0d;
    border-left: 3px solid #ff4444;
}

.detail-ioc-type {
    color: #ff4444;
    font-weight: bold;
    font-size: 0.8em;
    text-transform: uppercase;
    min-width: 60px;
}

.detail-ioc-value {
    color: #00ff41;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

/* Enrichment */
.detail-enrich-item {
    padding: 10px 12px;
    background: #0d0d0d;
    border-left: 3px solid #4fc3f7;
    margin-bottom: 6px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-enrich-sources {
    color: #999;
    font-size: 0.85em;
}

.detail-enrich-malicious {
    color: #ff4444;
    font-weight: bold;
    font-size: 0.85em;
}

/* Related Articles */
.detail-related-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: #0d0d0d;
    margin-bottom: 4px;
    cursor: pointer;
    border-left: 2px solid transparent;
    transition: all 0.2s;
}

.detail-related-item:hover {
    background: #242424;
    border-left-color: #9a4c30;
    transform: translateX(3px);
}

.detail-related-title {
    flex: 1;
    color: #e0e0e0;
    font-size: 0.9em;
}

.detail-related-meta {
    color: #666;
    font-size: 0.8em;
}

/* External Link */
.detail-ext-section {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid #333;
}

.detail-ext-link {
    display: inline-block;
    padding: 10px 24px;
    background: #9a4c30;
    color: #fff;
    text-decoration: none;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 1px;
    transition: all 0.3s;
}

.detail-ext-link:hover {
    background: #b85c40;
    box-shadow: 0 0 16px rgba(154, 76, 48, 0.5);
    transform: translateY(-1px);
}

@media (max-width: 768px) {
    .detail-overlay {
        padding: 10px;
    }
    .detail-meta-grid {
        grid-template-columns: 1fr;
    }
    .detail-technique-item {
        flex-wrap: wrap;
    }
}

/* ============================================
   GRAPH VIEW
============================================ */
.graph-view-wrapper {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.graph-canvas {
    width: 100%;
    border: 1px solid #333;
    cursor: pointer;
    background: #0d0d0d;
}

.graph-legend {
    display: flex;
    gap: 16px;
    padding: 10px 12px;
    background: #242424;
    border-left: 3px solid #9a4c30;
    flex-wrap: wrap;
}

.graph-legend-item {
    font-size: 0.8em;
    color: #b0b0b0;
    padding-left: 18px;
    position: relative;
}

.graph-legend-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.graph-legend-article::before { background: #9a4c30; }
.graph-legend-technique::before { background: #2c3e50; }
.graph-legend-category::before { background: #4fc3f7; }
.graph-legend-geo::before { background: #44ff88; }

/* ============================================
   ANALYTICS DASHBOARD
============================================ */
.analytics-panel {
    max-width: 1000px;
}

.analytics-stats-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 24px;
}

.analytics-stat {
    flex: 1;
    min-width: 100px;
    padding: 14px 16px;
    background: #0d0d0d;
    border-left: 3px solid #9a4c30;
    text-align: center;
}

.analytics-stat-value {
    font-size: 1.6em;
    font-weight: bold;
}

.analytics-stat-label {
    font-size: 0.7em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-top: 4px;
}

.analytics-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 24px;
}

.analytics-chart-section {
    background: #0d0d0d;
    padding: 16px;
    border-left: 3px solid #9a4c30;
}

.analytics-chart-canvas {
    width: 100%;
    height: 200px;
}

.analytics-bar-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.analytics-bar-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.analytics-bar-label {
    min-width: 120px;
    font-size: 0.85em;
    color: #b0b0b0;
    text-align: right;
}

.analytics-bar-track {
    flex: 1;
    height: 16px;
    background: #0d0d0d;
    border: 1px solid #333;
}

.analytics-bar-fill {
    height: 100%;
    transition: width 0.5s ease;
}

.analytics-bar-value {
    min-width: 30px;
    font-size: 0.85em;
    color: #e0e0e0;
    font-weight: bold;
}

@media (max-width: 768px) {
    .analytics-charts-row {
        grid-template-columns: 1fr;
    }
    .analytics-stats-row {
        flex-direction: column;
    }
}

/* ============================================
   ADD INTEL FORM
============================================ */
.add-intel-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    color: #9a4c30;
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: bold;
}

.form-input {
    background: #0d0d0d;
    border: 1px solid #333;
    color: #e0e0e0;
    padding: 10px 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    transition: border-color 0.3s;
}

.form-input:focus {
    outline: none;
    border-color: #9a4c30;
    box-shadow: 0 0 8px rgba(154, 76, 48, 0.3);
}

.form-input::placeholder {
    color: #666;
}

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

select.form-input {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%239a4c30' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 30px;
}

select.form-input option {
    background: #1a1a1a;
    color: #e0e0e0;
}

/* ============================================
   SEARCH HINTS / COMMAND PALETTE
============================================ */
.search-hints {
    background: #1a1a1a;
    border: 1px solid #9a4c30;
    border-top: none;
    padding: 8px 0;
    margin-bottom: 15px;
    max-height: 300px;
    overflow-y: auto;
}

.search-hint-label {
    color: #9a4c30;
    font-size: 0.7em;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    padding: 6px 12px;
    font-weight: bold;
}

.search-hint-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s;
}

.search-hint-item:hover {
    background: #242424;
}

.search-hint-source {
    color: #00ff41;
    font-weight: bold;
    font-size: 0.85em;
    min-width: 100px;
}

.search-hint-desc {
    color: #b0b0b0;
    font-size: 0.85em;
}

.search-hint-cmd code {
    color: #4fc3f7;
    font-size: 0.9em;
    min-width: 80px;
    display: inline-block;
}

/* Fieldset reset for sidebar filters */
.sidebar fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

.sidebar legend {
    width: 100%;
}
