/* Fallback background gradient */
body {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    margin: 0;
    padding: 0;
}

#bg-video {
    filter: brightness(0.8);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

/* Notion-style Editor Customization */
.resizable-notes {
    width: 24rem;
    min-width: 200px;
    max-width: 80vw;
    overflow: hidden;
    flex: 0 0 auto;
    position: relative;
    box-sizing: border-box;
}

.resize-handle-left {
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    cursor: ew-resize;
    background: transparent;
    z-index: 20;
    user-select: none;
    transition: background-color 0.2s;
}

.resize-handle-left:hover {
    background: rgba(59, 130, 246, 0.5);
}

.resize-handle-left:active {
    background: rgba(59, 130, 246, 0.8);
}

#editor-container {
    background-color: #111827;
    color: white;
}

#notes-textarea {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 20px;
    line-height: 1.6;
    word-break: break-word;
    padding-left: 0.5rem;
}

#notes-textarea h1,
#notes-textarea h2,
#notes-textarea h3 {
    display: block;
    margin: 0.5em 0;
}

#notes-textarea h1 {
    font-size: 2em;
    font-weight: bold;
}

#notes-textarea h2 {
    font-size: 1.5em;
    font-weight: bold;
}

#notes-textarea h3 {
    font-size: 1.25em;
    font-weight: bold;
}

#notes-textarea strong {
    font-weight: bold;
}

#notes-textarea em {
    font-style: italic;
}

/* Checkbox styling */
#notes-textarea input[type="checkbox"] {
    width: 20px;
    height: 20px;
    border: 1.5px solid #d1d5db;
    border-radius: 4px;
    background-color: transparent;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    margin: 0;
    flex-shrink: 0;
    position: relative;
}

#notes-textarea input[type="checkbox"]:checked {
    background-color: #2563eb;
    border-color: #2563eb;
}

#notes-textarea input[type="checkbox"]:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

#notes-textarea:empty:before {
    content: attr(data-placeholder);
    color: #6b7280;
    pointer-events: none;
}

/* Format Menu Styling */
#format-menu {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#format-menu-items {
    max-height: 300px;
    overflow-y: auto;
}

/* Emoji menu */
#emoji-menu {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

#emoji-search {
    font-size: 14px;
}

#emoji-search::placeholder {
    color: #9ca3af;
}

#emoji-options {
    max-height: 300px;
    overflow-y: auto;
}

#emoji-options button {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1f2937;
    border: 1px solid #374151;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

#emoji-options button:hover {
    background: #374151;
    transform: scale(1.1);
}

#emoji-remove {
    font-size: 13px;
    font-weight: 500;
}

/* Custom scrollbar for editor */
#editor-container::-webkit-scrollbar {
    width: 8px;
}

#editor-container::-webkit-scrollbar-track {
    background: #1f2937;
}

#editor-container::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 4px;
}

#editor-container::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Custom scrollbar for menus */
#block-menu::-webkit-scrollbar,
#emoji-menu::-webkit-scrollbar {
    width: 6px;
}

#block-menu::-webkit-scrollbar-track,
#emoji-menu::-webkit-scrollbar-track {
    background: #1f2937;
}

#block-menu::-webkit-scrollbar-thumb,
#emoji-menu::-webkit-scrollbar-thumb {
    background: #4b5563;
    border-radius: 3px;
}

#block-menu::-webkit-scrollbar-thumb:hover,
#emoji-menu::-webkit-scrollbar-thumb:hover {
    background: #6b7280;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    body > div {
        flex-direction: column;
    }
    
    body > div > div:first-child {
        height: 50vh;
    }
    
    body > div > div:last-child {
        width: 100%;
        height: 50vh;
    }
}

/* Improve button touch targets on mobile */
@media (max-width: 768px) {
    button {
        min-height: 44px;
        min-width: 44px;
    }
}

/* Smooth scrolling */
html {
    scroll-behavior: smooth;
}

/* Spotify Player Styling */
.spotify-control-btn {
    background: transparent;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.spotify-control-btn:hover {
    transform: scale(1.1);
}

.spotify-control-btn:active {
    transform: scale(0.95);
}

.spotify-play-pause-btn {
    width: 48px;
    height: 48px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    position: relative;
}

.spotify-play-pause-btn:hover:not(:active) {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.spotify-play-pause-btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
}

/* Smooth icon transitions */
#play-icon,
#pause-icon {
    transition: opacity 0.15s ease;
    position: absolute;
}

#play-icon.hidden,
#pause-icon.hidden {
    opacity: 0;
    pointer-events: none;
}

#spotify-shuffle.active,
#spotify-repeat.active {
    color: #1db954;
}

#spotify-shuffle.active:hover,
#spotify-repeat.active:hover {
    color: #1ed760;
}

/* Progress Bar Styling */
#spotify-player-container #progress-container {
    position: relative;
    height: calc(4px * var(--scale, 1));
    background-color: #4a4a4a;
    border-radius: calc(2px * var(--scale, 1));
    cursor: pointer;
}

#spotify-player-container #progress-container:hover {
    height: calc(6px * var(--scale, 1));
}

#spotify-player-container #progress-container:hover #progress-handle {
    opacity: 1 !important;
}

#spotify-player-container #progress-bar {
    height: 100%;
    background-color: #ffffff;
    border-radius: calc(2px * var(--scale, 1));
    transition: width 0.1s linear;
}

#spotify-player-container #progress-handle {
    width: calc(12px * var(--scale, 1));
    height: calc(12px * var(--scale, 1));
    background-color: #ffffff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: opacity 0.2s ease, left 0.1s linear;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    pointer-events: none;
}

#spotify-player-container #progress-container:hover #progress-bar {
    background-color: #1db954;
}

/* Spotify Player Container - Draggable (Fixed Size) */
#spotify-player-container {
    position: absolute;
    user-select: none;
    --scale-factor: 1;
    font-size: calc(1rem * var(--scale-factor));
    overflow: hidden;
    box-sizing: border-box;
    width: 600px !important;
    min-width: 600px !important;
    max-width: 600px !important;
}

/* Calculate scale factor based on container width (600px is base) */
#spotify-player-container {
    --base-width: 600;
    --current-width: 600;
    --scale: 1;
}

#spotify-player-container:active {
    cursor: move;
}

#spotify-drag-handle {
    z-index: 10;
    pointer-events: auto;
}

#spotify-resize-handle {
    z-index: 10;
    pointer-events: auto;
    background: linear-gradient(135deg, transparent 0%, transparent 50%, rgba(255,255,255,0.1) 50%);
}

#spotify-player-container button,
#spotify-player-container input,
#spotify-player-container #progress-container {
    pointer-events: auto;
}

/* Responsive scaling for Spotify player content */
#spotify-player-container {
    --scale: 1;
}

#spotify-player-container img#album-art {
    width: calc(5rem * var(--scale, 1));
    height: calc(5rem * var(--scale, 1));
    min-width: calc(5rem * var(--scale, 1));
    min-height: calc(5rem * var(--scale, 1));
    flex-shrink: 0;
    max-width: calc(5rem * var(--scale, 1));
    max-height: calc(5rem * var(--scale, 1));
    object-fit: cover;
}

#spotify-player-container #song-title {
    font-size: calc(1.125rem * var(--scale, 1));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    line-height: 1.2;
}

#spotify-player-container #song-artist {
    font-size: calc(0.875rem * var(--scale, 1));
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    line-height: 1.2;
}

#spotify-player-container .spotify-control-btn {
    padding: calc(0.375rem * var(--scale, 1));
    width: calc(2rem * var(--scale, 1));
    height: calc(2rem * var(--scale, 1));
    min-width: calc(2rem * var(--scale, 1));
    min-height: calc(2rem * var(--scale, 1));
    flex-shrink: 0;
}

#spotify-player-container .spotify-control-btn svg {
    width: calc(1.25rem * var(--scale, 1));
    height: calc(1.25rem * var(--scale, 1));
}

#spotify-player-container #spotify-shuffle svg,
#spotify-player-container #spotify-repeat svg {
    width: calc(1.25rem * var(--scale, 1));
    height: calc(1.25rem * var(--scale, 1));
}

#spotify-player-container .spotify-play-pause-btn {
    width: calc(2.5rem * var(--scale, 1));
    height: calc(2.5rem * var(--scale, 1));
    min-width: calc(2.5rem * var(--scale, 1));
    min-height: calc(2.5rem * var(--scale, 1));
    flex-shrink: 0;
}

#spotify-player-container .spotify-play-pause-btn svg {
    width: calc(1.25rem * var(--scale, 1));
    height: calc(1.25rem * var(--scale, 1));
}

#spotify-player-container #current-time,
#spotify-player-container #total-time {
    font-size: calc(0.875rem * var(--scale, 1));
    min-width: calc(2.5rem * var(--scale, 1));
    max-width: calc(3rem * var(--scale, 1));
    line-height: 1;
    flex-shrink: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#spotify-player-container .gap-6 {
    gap: calc(0.75rem * var(--scale, 1));
}

#spotify-player-container .gap-2 {
    gap: calc(0.5rem * var(--scale, 1));
}

#spotify-player-container .gap-3 {
    gap: calc(0.75rem * var(--scale, 1));
}

#spotify-player-container .gap-4 {
    gap: calc(0.5rem * var(--scale, 1));
}

#spotify-player-container .p-6 {
    padding: calc(0.75rem * var(--scale, 1));
}

/* Ensure all content fits within container */
#spotify-player-container > div {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

#spotify-player-container .flex {
    max-width: 100%;
    box-sizing: border-box;
}

/* Make sure text containers don't overflow */
#spotify-player-container .text-left {
    max-width: 100%;
    overflow: hidden;
}

/* Selection box for right-click drag */
.selection-box {
    position: fixed;
    border: 2px solid #3b82f6;
    background-color: rgba(59, 130, 246, 0.2);
    pointer-events: none;
    z-index: 1000;
    box-sizing: border-box;
    border-radius: 2px;
    display: none;
}

/* Highlighted blocks within selection box */
.block-item.box-selected {
    background-color: rgba(59, 130, 246, 0.3) !important;
    border-radius: 4px;
}

