:root {
    --bg-color: #0f172a;
    --bg-secondary: #1e293b;
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-color: #6366f1;
    /* Indigo 500 */
    --accent-glow: rgba(99, 102, 241, 0.5);
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --nav-height: 60px;
    --header-height: 60px;
    --border-radius: 16px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    /* App-like feel */
}

#app {
    display: flex;
    flex-direction: column;
    height: 100%;
}

/* Header */
.app-header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    background: var(--bg-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    background: linear-gradient(135deg, #fff 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.25rem;
    padding: 8px;
    cursor: pointer;
}

/* Main Content */
#main-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(var(--nav-height) + 20px);
}

/* Bottom Nav */
.bottom-nav {
    height: var(--nav-height);
    background: var(--glass-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    width: 100%;
    z-index: 20;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: color 0.3s ease;
}

.nav-item i {
    font-size: 1.5rem;
    margin-bottom: 4px;
}

.nav-item.active {
    color: var(--accent-color);
}

/* Player Overlay */
.player-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
    z-index: 50;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s cubic-bezier(0.4, 0.0, 0.2, 1);
}

.player-overlay.hidden {
    transform: translateY(100%);
}

.player-header {
    height: var(--header-height);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
}

.player-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.video-container {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
    border-radius: var(--border-radius);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
}

.media-info {
    text-align: center;
    margin-bottom: 30px;
}

.media-info h2 {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

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

/* Controls */
.main-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin: 20px 0;
}

.control-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.control-btn.sm {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.control-btn.lg {
    width: 70px;
    height: 70px;
    background: var(--accent-color);
    border-radius: 50%;
    font-size: 2.5rem;
    box-shadow: 0 0 20px var(--accent-glow);
}

.secondary-controls {
    display: flex;
    justify-content: space-around;
    margin-top: auto;
}

.action-btn {
    background: var(--bg-secondary);
    border: none;
    color: var(--text-primary);
    padding: 10px 20px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    font-size: 0.8rem;
    cursor: pointer;
}

.action-btn i {
    font-size: 1.2rem;
}

/* Range Slider */
input[type=range] {
    width: 100%;
    height: 4px;
    background: var(--bg-secondary);
    border-radius: 2px;
    -webkit-appearance: none;
    margin-bottom: 10px;
}

input[type=range]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px var(--accent-glow);
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* Loading Spinner */
.loading-spinner {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 200px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bg-secondary);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

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

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-secondary);
    padding: 25px;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 400px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    margin-bottom: 15px;
}

.modal-content p {
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-size: 0.9rem;
}

.input-field {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-primary);
    font-family: inherit;
}

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

.action-btn.primary {
    background: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
}

/* Player Layout Updates */
.player-content-wrapper {
    flex: 1;
    display: flex;
    overflow: hidden;
    position: relative;
}

.player-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
    transition: width 0.3s ease;
}

/* Notes Panel */
.notes-panel {
    width: 350px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--glass-border);
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, width 0.3s ease;
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 60;
}

.notes-panel.hidden {
    transform: translateX(100%);
    display: none;
    /* Hide completely when closed to avoid layout issues */
}

/* Mobile Notes - Full Overlay */
@media (max-width: 768px) {
    .notes-panel {
        width: 100%;
        border-left: none;
    }
}

.notes-header {
    padding: 15px;
    border-bottom: 1px solid var(--glass-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.notes-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.notes-list {
    flex: 1;
    overflow-y: auto;
    padding: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.note-item {
    background: var(--bg-color);
    padding: 10px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.note-item:hover {
    border-color: var(--accent-color);
}

.note-time {
    color: var(--accent-color);
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 4px;
    display: block;
}

.note-text {
    font-size: 0.9rem;
    color: var(--text-primary);
    white-space: pre-wrap;
}

.add-note-area {
    padding: 15px;
    border-top: 1px solid var(--glass-border);
    background: var(--bg-secondary);
}

#new-note-text {
    width: 100%;
    height: 80px;
    background: var(--bg-color);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    padding: 10px;
    color: var(--text-primary);
    margin-bottom: 10px;
    resize: none;
    font-family: inherit;
}

/* Active Loop Button */
#loop-btn.active {
    color: var(--accent-color);
    background: rgba(99, 102, 241, 0.1);
    border-radius: 50%;
}

/* Watched Badge on Card */
.watched-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(16, 185, 129, 0.9);
    /* Green */
    color: white;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.7rem;
    display: flex;
    align-items: center;
    gap: 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}