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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.controls {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-bottom: 20px;
}

.input-group {
    display: flex;
    gap: 20px;
    align-items: end;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.input-field {
    flex: 1;
    min-width: 250px;
}

.input-field label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #555;
}

.input-field input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}

.input-field select {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.3s ease;
    background: white;
}

.input-field input:focus,
.input-field select:focus {
    outline: none;
    border-color: #667eea;
}

/* Autocomplete styles */
.autocomplete-container {
    position: relative;
}

.autocomplete-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    border: 2px solid #e1e5e9;
    border-top: none;
    border-radius: 0 0 8px 8px;
    max-height: 200px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.autocomplete-dropdown.show {
    display: block;
}

.autocomplete-item {
    padding: 12px 15px;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s ease;
    display: flex;
    align-items: center;
    gap: 10px;
}

.autocomplete-item:hover {
    background-color: #f8f9fa;
}

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

.autocomplete-item.highlighted {
    background-color: #667eea;
    color: white;
}

.actor-info {
    flex: 1;
}

.actor-name {
    font-weight: 500;
    font-size: 14px;
}

.actor-popularity {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.autocomplete-item.highlighted .actor-popularity {
    color: rgba(255, 255, 255, 0.8);
}

.actor-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    background-color: #e1e5e9;
    border: 1px solid #ddd;
}

.no-results {
    padding: 12px 15px;
    color: #666;
    font-style: italic;
    text-align: center;
}

.loading-results {
    padding: 12px 15px;
    color: #666;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loading-results::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 2px solid #e1e5e9;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

#searchBtn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    min-width: 150px;
}

#searchBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

#searchBtn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.path-selector {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
}

.path-selector label {
    font-weight: 600;
    color: #555;
}

.path-selector select {
    padding: 8px 12px;
    border: 2px solid #e1e5e9;
    border-radius: 6px;
    font-size: 14px;
    min-width: 250px;
}

.status {
    padding: 12px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    font-weight: 500;
}

.status.error {
    background: #fee;
    border-left-color: #e74c3c;
    color: #c0392b;
}

.status.success {
    background: #efe;
    border-left-color: #27ae60;
    color: #27ae60;
}

.progress-container {
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 500;
}

.progress-bar {
    width: 100%;
    height: 20px;
    background: #e9ecef;
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease;
}

.progress-details {
    font-size: 13px;
    color: #6c757d;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.progress-details span {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 4px;
}

.path-list-container {
    background: white;
    padding: 25px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    margin-top: 20px;
}

.path-list-container h3 {
    margin-bottom: 20px;
    color: #333;
    border-bottom: 2px solid #667eea;
    padding-bottom: 10px;
}

.path-item {
    background: #f8f9fa;
    padding: 15px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #667eea;
    cursor: pointer;
    transition: all 0.3s ease;
}

.path-item:hover {
    background: #e9ecef;
    transform: translateX(5px);
}

.path-item.selected {
    background: #667eea;
    color: white;
}

.path-degree {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 8px;
}

.path-item.selected .path-degree {
    color: white;
}

.path-route {
    font-family: 'Courier New', monospace;
    line-height: 1.6;
    word-wrap: break-word;
}

.path-actor {
    color: #e74c3c;
    font-weight: bold;
}

.path-movie {
    color: #3498db;
    font-weight: bold;
}

.path-arrow {
    color: #95a5a6;
    margin: 0 8px;
}

.visualization-container {
    position: relative;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
    overflow: hidden;
    height: 70vh;
}

.visualization-controls {
    position: absolute;
    top: 20px;
    left: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 10;
}

.viz-control-btn {
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #667eea;
    color: #667eea;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    white-space: nowrap;
}

.viz-control-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

.viz-control-btn:active {
    transform: translateY(0);
}

.viz-control-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

#graph {
    width: 100%;
    height: 100%;
    cursor: grab;
}

#graph:active {
    cursor: grabbing;
}

.legend {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 15px;
    border-radius: 10px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
}

.legend h3 {
    margin-bottom: 12px;
    font-size: 14px;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.legend-item {
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    font-size: 13px;
}

.legend-color {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    margin-right: 10px;
    border: 2px solid rgba(255,255,255,0.8);
}

.legend-color.search-actor {
    background: #e74c3c;
}

.legend-color.movie {
    background: #3498db;
}

.legend-color.cast-member {
    background: #2ecc71;
}

/* Node styles */
.node {
    stroke: #fff;
    stroke-width: 2px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.node.search-actor {
    fill: #e74c3c;
}

.node.movie {
    fill: #3498db;
}

.node.cast-member {
    fill: #2ecc71;
}

.node:hover {
    stroke-width: 3px;
    r: 12;
}

.node.highlighted {
    stroke: #f39c12;
    stroke-width: 4px;
    fill: #f39c12;
}

/* Link styles */
.link {
    stroke: #95a5a6;
    stroke-width: 2px;
    stroke-opacity: 0.6;
    transition: all 0.3s ease;
}

.link.highlighted {
    stroke: #f39c12;
    stroke-width: 4px;
    stroke-opacity: 1;
}

/* Text styles */
.node-label {
    font-family: Arial, sans-serif;
    font-size: 11px;
    fill: #2c3e50;
    text-anchor: middle;
    pointer-events: none;
    dominant-baseline: central;
}

.node-label.highlighted {
    font-weight: bold;
    font-size: 12px;
    fill: #f39c12;
}

/* Loading animation */
.loading {
    display: flex;
    align-items: center;
    gap: 10px;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #e1e5e9;
    border-top: 2px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive design */
@media (max-width: 768px) {
    .input-group {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-field {
        min-width: auto;
    }
    
    #searchBtn {
        min-width: auto;
        width: 100%;
        margin: 5px 0;
    }
    
    .path-selector {
        flex-direction: column;
        align-items: stretch;
    }
    
    .path-selector select {
        min-width: auto;
    }
    
    .visualization-container {
        height: 60vh;
    }
    
    .visualization-controls {
        top: 10px;
        left: 10px;
        gap: 8px;
    }
    
    .viz-control-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
    
    .legend {
        position: relative;
        top: auto;
        right: auto;
        margin: 15px;
    }
}

/* Path List Styles */
#pathListContainer {
    margin-top: 20px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 8px;
    padding: 15px;
    display: none;
}

#pathListContainer h3 {
    margin: 0 0 15px 0;
    color: #333;
    font-size: 16px;
}

#pathList {
    max-height: 300px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.path-item {
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.path-item:hover {
    background: #f8f9fa;
    border-color: #007bff;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.path-item.selected {
    background: #e3f2fd;
    border-color: #2196f3;
    box-shadow: 0 2px 8px rgba(33, 150, 243, 0.2);
}

.path-degree {
    font-weight: bold;
    color: #666;
    font-size: 12px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.path-route {
    font-size: 14px;
    line-height: 1.4;
}

.path-actor {
    color: #2196f3;
    font-weight: 500;
}

.path-movie {
    color: #4caf50;
    font-style: italic;
}

.path-arrow {
    color: #666;
    margin: 0 8px;
    font-weight: bold;
}
