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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0a0a0a;
    color: #e0e0e0;
    overflow: hidden;
    height: 100vh;
}

/* Tab Bar */
.tab-bar {
    display: flex;
    background: #141414;
    border-bottom: 1px solid #2a2a2a;
    height: 40px;
    align-items: center;
    padding: 0 10px;
    gap: 2px;
}

.tab {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-bottom: none;
    /* cursor: move; */
    /* Changed from pointer to move */
    transition: all 0.2s;
    border-radius: 4px 4px 0 0;
    max-width: 200px;
    position: relative;
    margin-top: 5px;
}

.tab:hover {
    background: #242424;
}

.tab.active {
    background: #0a0a0a;
    border-color: #3a3a3a;
}

/* Drag and Drop Styles */
.tab.dragging {
    opacity: 0.4;
    cursor: grabbing;
}

.tab.drag-over {
    border-left: 3px solid #4a9eff;
}

.tab-name {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-right: 8px;
    font-size: 13px;
    pointer-events: none;
    /* Prevent text selection during drag */
}

.tab-close {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 3px;
    transition: background 0.2s;
    flex-shrink: 0;
    pointer-events: auto;
    /* Allow close button to work */
}

.tab-close:hover {
    background: rgba(255, 255, 255, 0.1);
}

.add-tab {
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
    margin-left: 4px;
    margin-top: 3px;
}

.add-tab:hover {
    background: #242424;
    border-color: #3a3a3a;
}

.file-info {
    margin-left: auto;
    padding: 8px 12px;
    font-size: 13px;
    color: #aaa;
    cursor: pointer;
}

.file-info:hover {
    color: #fff;
}

.info-button {
    width: 25px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 18px;
    margin-left: 4px;
    margin-top: 3px;
}

.info-button:hover {
    background: #242424;
    border-color: #3a3a3a;
}

/* Main Container */
.container {
    display: flex;
    height: calc(100vh - 40px);
}

/* Preview Section */
.preview-section {
    width: 90%;
    background: #0a0a0a;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.media-container {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.media-item {
    max-width: 90%;
    max-height: 90%;
    object-fit: contain;
    cursor: move;
    transition: transform 0.2s;
    transform-origin: center center;
}

video.media-item {
    background: #000;
    cursor: inherit
}

/* Video Controls */
.video-controls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    opacity: 0;
    transition: opacity 0.3s;
}

.preview-section:hover .video-controls {
    opacity: 1;
}

#progressBar {
    height: 30px;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    display: block;
    padding-top: 20px;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: #fff;
    border-radius: 2px;
    width: 0%;
    position: relative;
}

.progress-bar:hover,
#progressBar:hover .progress-bar {
    height: 6px;
}

/* Thumbnails Section */
.thumbnails-section {
    width: 10%;
    background: #141414;
    border-left: 1px solid #2a2a2a;
    overflow-y: auto;
    padding: 10px;
}

.thumbnail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(81px, 1fr));
    gap: 10px;
}

.thumbnail {
    aspect-ratio: 1;
    background: #1a1a1a;
    border: 2px solid transparent;
    border-radius: 4px;
    cursor: pointer;
    overflow: hidden;
    transition: all 0.2s;
    position: relative;
}

.thumbnail:hover {
    border-color: #3a3a3a;
    transform: scale(1.05);
}

.thumbnail.active {
    border-color: #4a9eff;
}

.thumbnail img,
.thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-indicator {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.8);
    padding: 2px 6px;
    border-radius: 2px;
    font-size: 10px;
    color: #fff;
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #666;
}

.browse-button {
    margin-top: 20px;
    padding: 10px 20px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.browse-button:hover {
    background: #242424;
    border-color: #4a9eff;
}

/* Random Button */
.random-button {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 20px;
    line-height: 0px;
}

.random-button:hover {
    background: #242424;
    border-color: #4a9eff;
    transform: scale(1.1);
}

.random-button.active {
    filter: sepia(1);
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #1a1a1a;
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
    min-width: 400px;
}

.modal-title {
    font-size: 18px;
    margin-bottom: 20px;
}

.modal-body {
    margin-bottom: 20px;
}

.modal-body h3 {
    margin-top: 10px;
    margin-bottom: 10px;
}

.modal-body ul {
    list-style-position: inside;
    padding-left: 10px;
}

.modal-body ul li {
    margin-bottom: 5px;
}

.input-group {
    margin-bottom: 20px;
}

.input-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    color: #aaa;
}

.input-group input {
    width: 100%;
    padding: 8px 12px;
    background: #0a0a0a;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 14px;
}

.modal-buttons {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.modal-button {
    padding: 8px 16px;
    background: #1a1a1a;
    border: 1px solid #3a3a3a;
    color: #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.modal-button:hover {
    background: #242424;
}

.modal-button.primary {
    background: #2a4a7a;
    border-color: #3a5a8a;
}

.modal-button.primary:hover {
    background: #3a5a8a;
}

/* Loading Indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #aaa;
    font-size: 14px;
    background: #1a1a1a;
    padding: 20px 40px;
    border-radius: 8px;
    border: 1px solid #3a3a3a;
    z-index: 2000;
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #0a0a0a;
}

::-webkit-scrollbar-thumb {
    background: #3a3a3a;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #4a4a4a;
}