/* Candidate 5.4: Layered Bands Timeline */
/* Events as colored segments in horizontal bands with duration width */

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

body {
    font-family: 'Trebuchet MS', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-attachment: fixed;
    overflow: hidden;
    height: 100vh;
}

.timeline-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    cursor: grab;
}

.timeline-container.dragging {
    cursor: grabbing;
}

#timeline-canvas {
    display: block;
    background: transparent;
}

.tooltip {
    position: fixed;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(240, 147, 251, 0.8);
    border-radius: 12px;
    padding: 12px;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    max-width: 300px;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
}

.tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

.event-title {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 4px;
    font-size: 14px;
}

.event-date {
    color: #764ba2;
    font-size: 12px;
    margin-bottom: 6px;
}

.event-description {
    color: #333;
    font-size: 12px;
    line-height: 1.4;
}

.info-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(10px);
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
    border: 1px solid rgba(240, 147, 251, 0.3);
}

.info-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 14px;
}

.info-item:last-child {
    margin-bottom: 0;
}

.label {
    color: #667eea;
    font-weight: bold;
}

/* Settings Button in Upper Right */
.settings-button {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(240, 147, 251, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
    z-index: 1000;
}

.settings-button:hover {
    transform: scale(1.1);
    background: rgba(240, 147, 251, 0.9);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.settings-button .settings-icon {
    font-size: 20px;
    color: #667eea;
}

.settings-button:hover .settings-icon {
    color: white;
}

.fab-icon {
    font-size: 24px;
    color: white;
    line-height: 1;
}

.fab-menu {
    position: fixed;
    top: 80px;
    right: 30px;
    display: flex;
    flex-direction: column;
    gap: 15px;
    opacity: 0;
    transform: translateY(-20px) scale(0.8);
    transition: all 0.3s ease;
    pointer-events: none;
    z-index: 1002;
}

.fab-menu.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.fab-item {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(240, 147, 251, 0.5);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
    position: relative;
}

.fab-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fab-item:hover {
    transform: scale(1.1);
    background: rgba(240, 147, 251, 0.9);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.4);
}

.fab-item .fab-icon {
    font-size: 20px;
    color: #667eea;
}

.fab-item:hover .fab-icon {
    color: white;
}

.fab-item::after {
    content: attr(title);
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 5px 10px;
    border-radius: 4px;
    font-size: 12px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.fab-item:hover::after {
    opacity: 1;
}

/* Filter Panel */
.filter-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(240, 147, 251, 0.3);
    max-width: 400px;
    width: 90%;
    max-height: 60vh;
    overflow-y: auto;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2000;
}

.filter-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.filter-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.filter-header h3 {
    color: #667eea;
    margin: 0;
    font-size: 18px;
}

.filter-close, .search-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #764ba2;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

.filter-close:hover, .search-close:hover {
    background: rgba(102, 126, 234, 0.1);
}

.filter-search {
    margin-bottom: 15px;
}

.filter-search input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid rgba(102, 126, 234, 0.2);
    border-radius: 8px;
    font-size: 14px;
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.3s ease;
}

.filter-search input:focus {
    outline: none;
    border-color: #667eea;
    background: rgba(255, 255, 255, 1);
}

.filter-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s ease;
}

.filter-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

.filter-item input[type="checkbox"] {
    margin: 0;
}

.filter-item label {
    cursor: pointer;
    flex: 1;
    color: #333;
}

/* Search Panel */
.search-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(15px);
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
    border: 1px solid rgba(240, 147, 251, 0.3);
    max-width: 500px;
    width: 90%;
    max-height: 70vh;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 2000;
}

.search-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, -50%) scale(1);
}

.search-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.search-header h3 {
    color: #667eea;
    margin: 0;
    font-size: 18px;
}

.search-content {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

#search-input {
    padding: 12px 16px;
    border: 2px solid rgba(240, 147, 251, 0.3);
    border-radius: 8px;
    font-size: 16px;
    background: rgba(255, 255, 255, 0.8);
    transition: border-color 0.3s ease;
}

#search-input:focus {
    outline: none;
    border-color: #667eea;
    background: white;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    border-radius: 8px;
}

.search-result-item {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(102, 126, 234, 0.1);
    cursor: pointer;
    transition: background 0.3s ease;
}

.search-result-item:hover {
    background: rgba(102, 126, 234, 0.1);
}

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

.search-result-title {
    font-weight: bold;
    color: #667eea;
    margin-bottom: 4px;
}

.search-result-date {
    color: #764ba2;
    font-size: 14px;
}

/* Layered bands animation */
@keyframes band-pulse {
    0%, 100% { opacity: 0.1; }
    50% { opacity: 0.3; }
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(240, 147, 251, 0.1) 50%,
        rgba(255, 255, 255, 0.1) 100%
    );
    animation: band-pulse 4s ease-in-out infinite;
    pointer-events: none;
    z-index: -1;
}

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

.modal-content {
    background-color: #ffffff;
    margin: 5% auto;
    padding: 0;
    border-radius: 8px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    animation: modal-appear 0.3s ease-out;
}

@keyframes modal-appear {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 8px 8px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.5em;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: white;
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.modal-close:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.modal-body {
    padding: 20px;
    line-height: 1.6;
}

.event-detail {
    margin-bottom: 15px;
}

.event-detail-label {
    font-weight: bold;
    color: #333;
    display: inline-block;
    min-width: 120px;
}

.event-detail-value {
    color: #666;
}

.category-item {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
    padding: 4px 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 0.9em;
}

.category-name {
    font-weight: 500;
    color: #495057;
}

.category-source {
    font-size: 0.8em;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.wiki-source {
    background-color: #007bff;
    color: white;
}

.ai-source {
    background-color: #28a745;
    color: white;
}

.category-confidence {
    font-size: 0.8em;
    color: #6c757d;
    font-style: italic;
}

.debug-info {
    background-color: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    padding: 15px;
    margin-top: 20px;
}

.debug-info h3 {
    margin-top: 0;
    color: #495057;
    font-size: 1.1em;
}

.debug-code {
    background-color: #2d3748;
    color: #e2e8f0;
    padding: 10px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
    overflow-x: auto;
    white-space: pre-wrap;
    word-break: break-all;
}