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

:root {
    --primary-color: #6366f1;
    --primary-dark: #4f46e5;
    --secondary-color: #8b5cf6;
    --background-color: #f8fafc;
    --surface-color: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1);
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
}

.app-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.header {
    background: var(--surface-color);
    border-bottom: 1px solid var(--border-color);
    padding: 0.5rem 2rem;
    box-shadow: var(--shadow-sm);
    z-index: 100;
    height: 50px;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 100%;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
}

.logo i {
    font-size: 1.75rem;
}

.header-actions {
    display: flex;
    gap: 0.5rem;
}

.panel-toggle-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.panel-toggle-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.panel-toggle-btn.active i {
    transform: rotate(180deg);
}

.upload-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.upload-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.main-content {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.resize-divider {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--border-color);
    cursor: col-resize;
    z-index: 10;
    transition: background-color 0.2s ease;
    display: block;
}

.resize-divider:hover {
    background: var(--primary-color);
}

.resize-divider.dragging {
    background: var(--primary-color);
}

.video-section {
    padding: 1rem;
    overflow-y: auto;
    background: var(--background-color);
    min-width: 300px;
    display: flex;
    flex-direction: column;
}

.video-container {
    max-width: 100%;
}

.video-player-wrapper {
    position: relative;
    background: #000;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    margin-bottom: 1rem;
    width: 100%;
    max-width: 100%;
    transition: all 0.3s ease;
}

.video-player-wrapper:fullscreen {
    border-radius: 0;
    background: #000;
}

.video-player {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
}

.video-player-wrapper:fullscreen .video-player {
    object-fit: contain;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-player-wrapper:hover .video-controls {
    opacity: 1;
}

.controls-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

.control-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.9rem;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
}

.control-btn span {
    font-size: 0.7rem;
    margin-left: 0.25rem;
}

.time-display {
    color: white;
    font-size: 0.9rem;
    font-weight: 500;
    margin-left: auto;
    margin-right: 1rem;
}

.speed-control select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    padding: 0.5rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.speed-control select option {
    background: #333;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#volumeSlider {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    cursor: pointer;
}

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

.progress-filled {
    height: 100%;
    background: var(--primary-color);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s ease;
}

.video-info {
    background: var(--surface-color);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.video-info h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.video-info p {
    color: var(--text-secondary);
}

.video-list {
    background: var(--surface-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
}

.video-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.video-list-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
}

.video-count {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    min-height: 100px;
}

.video-item {
    background: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.video-item:hover {
    background: var(--background-color);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.video-item.active {
    background: rgba(99, 102, 241, 0.1);
    border-color: var(--primary-color);
}

.video-item-title {
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 2rem;
}

.video-item-meta {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.video-remove-btn {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #dc3545;
    border: none;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.2s ease;
}

.video-item:hover .video-remove-btn {
    opacity: 1;
}

.video-remove-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.tools-section {
    background: var(--surface-color);
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    min-width: 250px;
    max-width: 70%;
    position: relative;
    height: 100vh;
    overflow: hidden;
    flex: 1;
}

.tool-selector {
    display: flex;
    border-bottom: 1px solid var(--border-color);
    background: var(--surface-color);
}

.tool-tab {
    flex: 1;
    background: none;
    border: none;
    padding: 0.75rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
}

.tool-tab:hover {
    background: var(--background-color);
    color: var(--text-primary);
}

.tool-tab.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background: rgba(99, 102, 241, 0.05);
}

.notes-tool {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    overflow: hidden;
}

.notes-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.notes-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.notes-toolbar {
    display: flex;
    gap: 0.25rem;
}

.toolbar-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.toolbar-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.toolbar-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.6);
}

.notes-editor {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: var(--background-color);
    border: none;
    outline: none;
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-primary);
    min-height: 200px;
    word-wrap: break-word;
    word-break: break-word;
    width: 100%;
}

.notes-editor:empty:before {
    content: "Start taking notes...";
    color: var(--text-secondary);
    font-style: italic;
}

.notes-editor p {
    margin: 0 0 0.5rem 0;
    padding: 0;
    text-align: left;
}

.notes-editor ul {
    margin-left: 1.5rem;
    margin-bottom: 0.5rem;
}

.notes-editor li {
    margin-bottom: 0.25rem;
}

.notes-editor li::marker {
    color: var(--primary-color);
}

.notes-editor strong {
    font-weight: 600;
    color: var(--text-primary);
}

.ask-tool {
    display: flex;
    flex-direction: column;
    height: 100%;
    flex: 1;
    overflow: hidden;
}

.ask-header {
    display: flex;
    flex-direction: column;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border-color);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.05) 0%, rgba(139, 92, 246, 0.05) 100%);
}

.ask-header h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.5rem 0;
}

.ask-settings {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.api-key-input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 0.8rem;
}

.save-api-btn {
    padding: 0.5rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.2s ease;
}

.save-api-btn:hover {
    background: #4f46e5;
    transform: scale(1.05);
}

.chat-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    background: var(--background-color);
    max-height: 60vh;
}

.message {
    margin-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.message.user {
    align-items: flex-end;
}

.message.assistant {
    align-items: flex-start;
}

.message-bubble {
    max-width: 80%;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.user .message-bubble {
    background: var(--primary-color);
    color: white;
}

.message.assistant .message-bubble {
    background: var(--surface-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.message-time {
    font-size: 0.7rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.chat-input-container {
    display: flex;
    gap: 0.5rem;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    background: var(--surface-color);
}

.chat-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 0.9rem;
    outline: none;
}

.chat-input:focus {
    border-color: var(--primary-color);
}

.send-btn {
    padding: 0.75rem 1rem;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: #4f46e5;
    transform: scale(1.05);
}

.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.75rem;
    background: var(--surface-color);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: var(--text-secondary);
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-10px);
    }
}

.empty-state {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

.empty-state i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.empty-state p {
    font-size: 0.9rem;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: var(--background-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

@media (max-width: 1024px) {
    .video-section {
        min-width: 250px;
    }

    .tools-section {
        min-width: 200px;
    }
}

.pomodoro-nav-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.pomodoro-nav-timer {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pomodoro-nav-display {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 60px;
}

.pomodoro-nav-time {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    font-family: 'Inter', monospace;
}

.pomodoro-nav-mode {
    font-size: 0.7rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 500;
}

.pomodoro-nav-mode.work {
    color: var(--primary-color);
}

.pomodoro-nav-mode.break {
    color: var(--secondary-color);
}

.pomodoro-nav-controls {
    display: flex;
    gap: 0.25rem;
}

.pomodoro-nav-btn {
    background: none;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 28px;
    height: 28px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 0.75rem;
}

.pomodoro-nav-btn:hover {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: scale(1.1);
}

.pomodoro-nav-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pomodoro-nav-settings {
    display: flex;
    gap: 0.25rem;
}

.pomodoro-nav-input {
    width: 35px;
    height: 24px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: var(--background-color);
    color: var(--text-primary);
    font-size: 0.7rem;
    text-align: center;
    outline: none;
    padding: 0;
}

.pomodoro-nav-input:focus {
    border-color: var(--primary-color);
}

@media (max-width: 1024px) {
    .pomodoro-nav-container {
        gap: 0.6rem;
    }
    
    .pomodoro-nav-time {
        font-size: 0.85rem;
    }
    
    .pomodoro-nav-mode {
        font-size: 0.65rem;
    }
    
    .pomodoro-nav-btn {
        width: 26px;
        height: 26px;
        font-size: 0.7rem;
    }
    
    .pomodoro-nav-input {
        width: 32px;
        height: 22px;
        font-size: 0.68rem;
    }
    
    .upload-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
    
    .panel-toggle-btn {
        padding: 0.4rem 0.6rem;
        font-size: 0.8rem;
    }
}

@media (max-width: 768px) {
    .pomodoro-nav-container {
        position: static;
        transform: none;
        gap: 0.5rem;
        margin-left: 0.5rem;
    }
    
    .pomodoro-nav-time {
        font-size: 0.8rem;
    }
    
    .pomodoro-nav-mode {
        font-size: 0.6rem;
    }
    
    .pomodoro-nav-btn {
        width: 24px;
        height: 24px;
        font-size: 0.65rem;
    }
    
    .pomodoro-nav-input {
        width: 30px;
        height: 20px;
        font-size: 0.65rem;
    }
    
    .upload-btn {
        padding: 0.35rem 0.6rem;
        font-size: 0.75rem;
        gap: 0.35rem;
    }
    
    .panel-toggle-btn {
        padding: 0.35rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .upload-btn span {
        display: none;
    }
}

@media (max-width: 480px) {
    .pomodoro-nav-container {
        gap: 0.4rem;
    }
    
    .pomodoro-nav-settings {
        display: none;
    }
    
    .pomodoro-nav-time {
        font-size: 0.75rem;
    }
    
    .pomodoro-nav-mode {
        font-size: 0.55rem;
    }
    
    .pomodoro-nav-btn {
        width: 22px;
        height: 22px;
        font-size: 0.6rem;
    }
    
    .upload-btn {
        padding: 0.3rem 0.5rem;
        font-size: 0.7rem;
        min-width: auto;
    }
    
    .panel-toggle-btn {
        padding: 0.3rem 0.4rem;
        font-size: 0.7rem;
        min-width: auto;
    }
    
    .header-actions {
        gap: 0.35rem;
    }
}

@media (max-width: 360px) {
    .upload-btn span {
        display: none;
    }
    
    .upload-btn {
        padding: 0.25rem 0.4rem;
        font-size: 0.65rem;
    }
    
    .panel-toggle-btn {
        padding: 0.25rem 0.35rem;
        font-size: 0.65rem;
    }
}
