:root {
    --primary-color: #9d4edd;
    --primary-dark: #7b2cbf;
    --background-dark: #121212;
    --background-darker: #0a0a0a;
    --card-bg: #1e1e1e;
    --card-hover: #252525;
    --text-light: #ffffff;
    --text-gray: #b8b8b8;
    --text-dark-gray: #8a8a8a;
    --success-color: #00ff7f;
    --warning-color: #ffa500;
    --error-color: #ff6b6b;
    --border-color: rgba(255, 255, 255, 0.1);
    --sidebar-width: 350px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--background-dark);
    color: var(--text-light);
    line-height: 1.6;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background-color: rgba(10, 10, 10, 0.8);
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.logo {
    display: flex;
    align-items: center;
    margin-left: 20px;
}

.header-logo {
    width: 24px;
    height: 24px;
    margin-right: 8px;
}

.logo-text {
    color: var(--text-light);
    font-weight: 700;
    font-size: 1.2rem;
}

/* Main Layout */
main.logs-section {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.main-container {
    display: flex;
    flex: 1;
    gap: 0;
    min-height: calc(100vh - 80px);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    height: 100%;
    background-color: var(--card-bg);
    border-right: 1px solid var(--border-color);
    position: sticky;
    top: 80px;
    height: calc(100vh - 80px);
    overflow-y: auto;
    flex-shrink: 0;
}

.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: var(--background-darker);
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 3px;
}

.search-container {
    padding: 2rem 1.5rem;
}

.search-container h2 {
    color: var(--text-light);
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    text-align: center;
}

.input-group {
    margin-bottom: 1.5rem;
}

.input-group:last-of-type {
    margin-bottom: 2rem;
}

.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-gray);
    font-weight: 600;
    font-size: 0.9rem;
}

/* Improved Blob Input Styling */
.blob-input-wrapper {
    background-color: rgba(255, 255, 255, 0.05);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    transition: all 0.3s ease;
    min-height: 3rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.blob-input-wrapper:focus-within {
    border-color: var(--primary-color);
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 3px rgba(157, 78, 221, 0.1);
}

.blob-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    min-height: 0;
}

.blob-tags:empty {
    display: none;
}

.blob-tag {
    display: inline-flex;
    align-items: center;
    background-color: var(--primary-color);
    color: white;
    padding: 0.3rem 0.6rem;
    border-radius: 16px;
    font-size: 0.8rem;
    font-weight: 500;
    gap: 0.4rem;
    animation: slideIn 0.2s ease;
    max-width: 100%;
}

.blob-tag span:first-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.blob-tag .remove-tag {
    cursor: pointer;
    font-weight: bold;
    opacity: 0.7;
    transition: opacity 0.2s;
    font-size: 0.9rem;
    line-height: 1;
    padding: 0.1rem;
    border-radius: 50%;
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.blob-tag .remove-tag:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.2);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.search-input {
    border: none;
    background: transparent;
    color: var(--text-light);
    font-size: 0.9rem;
    padding: 0.3rem 0;
    outline: none;
    width: 100%;
}

.search-input::placeholder {
    color: var(--text-dark-gray);
    opacity: 0.8;
}

.btn-search {
    width: 100%;
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(157, 78, 221, 0.4);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-search:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(157, 78, 221, 0.6);
}

.btn-search:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Export All Container in Sidebar */
.export-all-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.export-btn {
    background-color: var(--success-color);
    color: var(--background-dark);
    padding: 0.6rem 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.export-btn:hover {
    background-color: #00e070;
    transform: translateY(-1px);
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
    background-color: var(--background-dark);
}

/* Welcome Message */
.welcome-message {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-gray);
}

.welcome-message i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    color: var(--primary-color);
    opacity: 0.7;
}

.welcome-message h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-light);
}

.welcome-message p {
    font-size: 1rem;
    max-width: 500px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Video Sections */
.logs-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.video-section {
    background-color: var(--card-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    transition: all 0.3s ease;
    animation: fadeInUp 0.4s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.video-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: rgba(255, 255, 255, 0.02);
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid var(--border-color);
}

.video-header:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.video-info h3 {
    color: var(--text-light);
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
}

.message-count {
    color: var(--primary-color);
    font-size: 0.85rem;
    font-weight: 600;
}

.video-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.video-actions .export-btn {
    font-size: 0.75rem;
    padding: 0.4rem 0.8rem;
}

.toggle-icon {
    color: var(--text-gray);
    font-size: 1rem;
    transition: transform 0.3s ease;
    margin-left: 0.5rem;
}

/* Video Loading State */
.video-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background-color: var(--background-darker);
    color: var(--text-gray);
    gap: 1rem;
}

.video-loading .spinner {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(157, 78, 221, 0.3);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Improved Message Section */
.video-messages {
    display: block;
    background-color: var(--background-darker);
}

.message-item {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: background-color 0.2s ease;
    animation: messageSlideIn 0.3s ease;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.message-item:hover {
    background-color: rgba(157, 78, 221, 0.05);
}

.log-message {
    display: flex;
    align-items: flex-start;
    padding: 0.75rem 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    gap: 1rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.log-message:last-child {
    border-bottom: none;
}

.message-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 120px;
    gap: 0.2rem;
}

.log-message-time {
    color: var(--text-dark-gray);
    font-size: 0.75rem;
    white-space: nowrap;
}

.log-message-offset {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.8rem;
    white-space: nowrap;
    background-color: rgba(157, 78, 221, 0.1);
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
}

.message-content {
    flex: 1;
    min-width: 0;
}

.log-message-username {
    font-weight: 600;
    margin-right: 0.5rem;
    display: inline;
}

.log-message-text {
    color: var(--text-light);
    word-wrap: break-word;
    display: inline;
}

/* Footer */
footer {
    background-color: var(--background-darker);
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    margin-top: auto;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-bottom: 1rem;
}

.social-links a {
    color: var(--text-gray);
    font-size: 1.2rem;
    transition: color 0.3s;
}

.social-links a:hover {
    color: var(--primary-color);
}

footer p {
    color: var(--text-gray);
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .main-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        position: static;
        height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .content-area {
        padding: 1.5rem;
    }
}

@media (max-width: 768px) {
    .search-container {
        padding: 1.5rem 1rem;
    }

    .video-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }

    .video-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .log-message {
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
    }

    .message-meta {
        flex-direction: row;
        align-items: center;
        min-width: auto;
        gap: 1rem;
    }

    .message-content {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .content-area {
        padding: 1rem;
    }

    .log-message {
        padding: 0.6rem 1rem;
        font-size: 0.85rem;
    }

    .blob-tag {
        font-size: 0.75rem;
        padding: 0.2rem 0.5rem;
    }
}

/* Animation for collapsing */
.video-messages {
    transition: all 0.3s ease;
}

.video-messages[style*="display: none"] {
    display: none !important;
}

/* Utility classes */
.hidden {
    display: none !important;
}

.visible {
    display: block !important;
}