/* VNWatch Visualization Styles */

#vnwatch-visualization {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    position: relative;
    overflow: visible;
    min-width: 1380px;
    width: 100%;
}

/* Navigation Menu */
.vnwatch-navigation {
    display: flex;
    flex-wrap: wrap;
    background: #fff;
    border-bottom: 2px solid #e9ecef;
    margin-bottom: 20px;
    padding: 10px 0;
    justify-content: center;
    gap: 5px;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    min-width: 50px;
    text-align: center;
    border: 1px solid transparent;
}

.nav-item:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
    opacity: 1 !important;
}

.nav-item.active {
    background: transparent;
    color: inherit;
    border-color: transparent;
}

.nav-item.active:hover {
    background: transparent;
}

.nav-icon {
    font-size: 20px;
    margin-bottom: 5px;
    line-height: 1;
    background: #e9ecef;
    padding: 8px;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: grayscale(100%);
    transition: all 0.3s ease;
}

.nav-item:hover .nav-icon,
.nav-item.active .nav-icon {
    background: #3498db;
    filter: grayscale(0%);
    color: #fff;
}

.nav-label {
    font-size: 11px;
    font-weight: 500;
    line-height: 1.2;
    text-align: center;
    white-space: pre-line;
    transition: all 0.3s ease;
}

.nav-item:hover .nav-label,
.nav-item.active .nav-label {
    color: #3498db;
    font-weight: 600;
}

@media (max-width: 768px) {
    .vnwatch-navigation {
        padding: 5px;
        gap: 3px;
    }
    
    .nav-item {
        min-width: 60px;
        padding: 8px 6px;
    }
    
    .nav-icon {
        font-size: 16px;
    }
    
    .nav-label {
        font-size: 9px;
    }
}

/* Main Layout - Three column design */
.vnwatch-container {
    display: flex;
    gap: 20px;
    width: 100%;
    padding: 20px;
    box-sizing: border-box;
}

.vnwatch-sidebar {
    width: 270px;
    background: #f8f9fa;
    border-right: 1px solid #ddd;
    padding: 20px;
    min-height: 500px;
    min-width: 270px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.vnwatch-main {
    width: 720px;
    background: #fff;
    padding: 20px;
    min-width: 720px;
    flex-shrink: 0;
    box-sizing: border-box;
}

.vnwatch-info-panel {
    width: 310px;
    background: #f8f9fa;
    border-left: 1px solid #ddd;
    padding: 20px;
    min-height: 500px;
    overflow-y: auto;
    flex-shrink: 0;
    box-sizing: border-box;
    display: none;
    position: relative;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.vnwatch-info-panel.active {
    display: block;
}

.vnwatch-info-panel h3 {
    margin-top: 0;
    margin-bottom: 20px;
    color: #333;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 1px solid #ddd;
    padding-bottom: 10px;
}

.vnwatch-info-panel .close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #666;
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
}

.vnwatch-info-panel .close-button:hover {
    color: #333;
    background-color: #e9ecef;
}

.official-info {
    margin-bottom: 20px;
}

.official-info .field {
    margin-bottom: 8px;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#official-cabinet,
#official-hometown,
#official-position,
#official-school {
    white-space: normal;
    overflow: visible;
    text-overflow: initial;
}

.official-info .field-label {
    font-weight: 600;
    color: #495057;
    font-size: 13px;
    display: inline;
}

.official-info .field-value {
    font-size: 13px;
    color: #333;
    display: inline;
}

.resume-content {
    font-size: 12px;
    line-height: 1.5;
    color: #495057;
    white-space: pre-wrap;
    word-wrap: break-word;
    max-height: 300px;
    overflow-y: auto;
    padding: 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 4px;
}

.filter-section, .info-section {
    margin-bottom: 30px;
}

.filter-section:last-child,
.info-section:last-child {
    margin-bottom: 0;
}

.filter-section h3, .info-section h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
    font-weight: 600;
}

.filter-row {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.filter-row label {
    font-weight: 500;
    color: #555;
    font-size: 13px;
    margin-bottom: 5px;
}

.filter-row select,
.filter-row input[type="text"] {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}

.filter-row select {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-row select option {
    white-space: normal;
    word-wrap: break-word;
    padding: 8px;
    font-size: 13px;
    line-height: 1.3;
}

.filter-row select:focus,
.filter-row input[type="text"]:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.2);
}

#apply-filters, #clear-filters {
    padding: 10px 20px;
    margin: 10px 10px 0 0;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 500;
    transition: background-color 0.2s;
}

#apply-filters {
    background: #007cba;
    color: white;
}

#apply-filters:hover {
    background: #005a87;
}

#clear-filters {
    background: #6c757d;
    color: white;
}

#clear-filters:hover {
    background: #545b62;
}

/* Statistics Section */
.stat {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 5px 0;
}

.stat .label {
    font-weight: 500;
    color: #666;
}

.stat .value {
    font-weight: 600;
    color: #333;
}

/* Visualization Container */
.vnwatch-viz-container {
    position: relative;
    background: #fff;
}

#vnwatch-svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Loading Indicator */
.loading {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    color: #666;
}

.loading p {
    margin: 0;
    font-size: 16px;
}

/* Tooltip */
.vnwatch-tooltip {
    position: absolute;
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 10px 12px;
    border-radius: 4px;
    font-size: 14px;
    pointer-events: none;
    z-index: 1000;
    max-width: 300px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.2s;
}

/* Relationship Tooltip */
.relationship-tooltip {
    min-width: 250px;
}

.relationship-tooltip .relationship-names {
    font-size: 14px;
    margin-bottom: 8px;
    color: #ffd700;
}

.relationship-tooltip .relationship-description {
    font-size: 13px;
    margin-bottom: 6px;
    color: #e8e8e8;
}

.relationship-tooltip .relationship-type {
    font-size: 12px;
    color: #bbb;
    font-style: italic;
}

.vnwatch-tooltip.visible {
    opacity: 1;
}

.vnwatch-tooltip .name {
    font-weight: bold;
    margin-bottom: 5px;
    color: #ffd700;
}

.vnwatch-tooltip .position {
    margin-bottom: 3px;
}

.vnwatch-tooltip .cabinet {
    font-size: 12px;
    color: #ccc;
}

/* Relationship Lines */
.relationship-links {
    z-index: 1;
}

.relationship-line {
    cursor: pointer;
    transition: all 0.3s ease;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.relationship-line:hover {
    filter: drop-shadow(0 0 2px rgba(52, 152, 219, 0.3));
}

/* Network Visualization Styles */
.node {
    cursor: pointer;
    stroke: #fff;
    stroke-width: 2px;
    transition: all 0.2s;
    z-index: 10;
}

.node:hover {
    stroke-width: 3px;
    filter: brightness(1.2);
}

.node.selected {
    stroke: #ffd700;
    stroke-width: 4px;
}

.link {
    stroke: #999;
    stroke-opacity: 0.3;
    transition: all 0.2s;
}

.link:hover {
    stroke-opacity: 0.8;
    stroke-width: 2px;
}

.link.same_cabinet {
    stroke: #007cba;
}

.link.same_ministry {
    stroke: #dc3545;
}

.link.same_school {
    stroke: #28a745;
}

.link.same_hometown {
    stroke: #ffc107;
}

/* Text Labels */
.node-label {
    font-size: 11px;
    font-family: sans-serif;
    pointer-events: none;
    text-anchor: middle;
    fill: #333;
    opacity: 0;
    transition: opacity 0.3s;
}

.node-label.visible {
    opacity: 1;
}

/* List Display Styles */
.vnwatch-list {
    padding: 0;
    max-height: 600px;
    overflow-y: auto;
    border: 1px solid #ddd;
    background: #fff;
    border-radius: 4px;
}

.official-item {
    border-bottom: 1px solid #eee;
    padding: 15px 20px;
    margin-bottom: 0;
    transition: background-color 0.2s;
}

.official-item:hover {
    background: #f8f9fa;
}

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

.official-name {
    font-weight: bold;
    color: #333;
    font-size: 16px;
    margin-bottom: 5px;
}

.official-position {
    color: #666;
    margin-bottom: 5px;
    line-height: 1.4;
}

.official-meta {
    font-size: 12px;
    color: #888;
    margin-top: 5px;
}


/* Responsive Design */
@media (max-width: 1280px) {
    #vnwatch-visualization {
        min-width: auto;
        overflow-x: auto;
    }
}

@media (max-width: 768px) {
    .vnwatch-container {
        flex-direction: column;
        gap: 0;
        padding: 10px;
    }
    
    .vnwatch-sidebar {
        width: 100%;
        min-width: auto;
        border-right: none;
        border-bottom: 1px solid #ddd;
        order: 1;
        padding: 15px;
    }
    
    .vnwatch-main {
        width: 100%;
        min-width: auto;
        order: 2;
        padding: 15px;
    }
    
    .filter-row {
        margin-bottom: 12px;
    }
    
    .filter-row select,
    .filter-row input[type="text"] {
        font-size: 16px;
    }
}

/* Color Scheme for Different Cabinet Periods */
.cabinet-1945 { fill: #8B4513; }
.cabinet-1946 { fill: #A0522D; }
.cabinet-1960 { fill: #2F4F4F; }
.cabinet-1975 { fill: #483D8B; }
.cabinet-1981 { fill: #B22222; }
.cabinet-1987 { fill: #FF4500; }
.cabinet-1992 { fill: #FF8C00; }
.cabinet-1997 { fill: #FFD700; }
.cabinet-2002 { fill: #ADFF2F; }
.cabinet-2007 { fill: #00CED1; }
.cabinet-2011 { fill: #4169E1; }
.cabinet-2016 { fill: #8A2BE2; }
.cabinet-2021 { fill: #DC143C; }

/* Default node color */
.node {
    fill: #69b3a2;
}

/* Ministry-based colors */
.ministry-noi-vu { fill: #e74c3c; }
.ministry-quoc-phong { fill: #2c3e50; }
.ministry-ngoai-giao { fill: #3498db; }
.ministry-tai-chinh { fill: #f39c12; }
.ministry-giao-duc { fill: #9b59b6; }
.ministry-y-te { fill: #1abc9c; }
.ministry-giao-thong { fill: #34495e; }
.ministry-cong-thuong { fill: #e67e22; }