/*
==============================================
Arrows TV Styles
==============================================
*/

/* Theme Variables */
:root {
    /* Shadcn/Tailwind dark color palette */
    --background: hsl(240 10% 3.9%);
    --foreground: hsl(0 0% 98%);
    --card: hsl(240 10% 3.9%);
    --card-foreground: hsl(0 0% 98%);
    --popover: hsl(240 10% 3.9%);
    --popover-foreground: hsl(0 0% 98%);
    --primary: hsl(0 0% 98%);
    --primary-foreground: hsl(240 5.9% 10%);
    --secondary: hsl(240 3.7% 15.9%);
    --secondary-foreground: hsl(0 0% 98%);
    --muted: hsl(240 3.7% 15.9%);
    --muted-foreground: hsl(240 5% 64.9%);
    --accent: hsl(240 3.7% 15.9%);
    --accent-foreground: hsl(0 0% 98%);
    --destructive: hsl(0 62.8% 30.6%);
    --destructive-foreground: hsl(0 0% 98%);
    --border: hsl(240 3.7% 15.9%);
    --input: hsl(240 3.7% 15.9%);
    --ring: hsl(240 4.9% 83.9%);
    --radius: 0.75rem;
    --sidebar-width: 300px;
    --gradient-start: #ff9a9e;
    --gradient-end: #fad0c4;
}

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

/* Base Typography */
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* Main Container */
.container {
    width: 100%;
    margin: 0;
    padding-top: 4.5rem; /* Match header height */
    padding-left: 10px;
    padding-right: 10px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.tv-container {
    width: 100%;
    max-width: 100vw;
    height: calc(100vh - 12rem); /* Increased space to account for control panel height + padding */
    margin: 0 auto;
    position: relative;
}

.main-title {
    display: none;
}

.player-frame {
    aspect-ratio: 16/9;
    width: 100%;
    height: 100%;
    max-height: 100%;
    background: var(--card);
    border-radius: var(--radius);
    overflow: hidden;
    margin-bottom: 0; /* Removed margin-bottom since we accounted for it in container height */
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
}

.player-frame #player {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.control-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--background/95);
    backdrop-filter: blur(8px);
    padding: 0.75rem 0;
    box-shadow: 0 -4px 6px -1px rgba(0, 0, 0, 0.1);
    z-index: 45;
}

.control-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1rem;
    margin-bottom: 0.75rem;
}

.time-indicator {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin: 0;
}

.video-title {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    margin-left: 1rem;
    flex: 1;
    text-align: left;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.control-grid {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0 1rem;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.control-group.left {
    margin-right: auto;
}

.control-group.center {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.control-group.right {
    position: absolute;
    right: 1rem;
}

.control-grid .btn {
    width: 42px;
    height: 42px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    border: 1px solid var(--border);
    cursor: pointer;
}

.control-grid .btn svg {
    width: 20px;
    height: 20px;
    transition: transform 0.2s ease;
}

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

.control-grid .btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.control-grid .btn-secondary {
    background: var(--secondary);
    color: var(--foreground);
}

.control-grid .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

@media (max-width: 768px) {
    .control-grid {
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem;
    }

    .control-group.center {
        position: relative;
        left: 0;
        transform: none;
        order: 1;
        width: 100%;
        justify-content: center;
        margin: 0.5rem 0;
    }

    .control-group.left {
        order: 2;
    }

    .control-group.right {
        order: 3;
    }

    /* Hide volume up/down buttons on mobile */
    #volumeUpButton,
    #volumeDownButton {
        display: none;
    }
}

@media (max-width: 640px) {
    .control-grid {
        gap: 0.5rem;
        padding: 0.25rem;
    }

    .control-grid .btn {
        width: 36px;
        height: 36px;
    }

    .control-grid .btn svg {
        width: 18px;
        height: 18px;
    }

    .control-group {
        gap: 0.5rem;
    }
}

.progress-bar {
    position: relative;
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    margin-bottom: 0.75rem;
    border-radius: 2px;
    cursor: pointer;
    transition: height 0.2s ease;
}

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

.progress-bar .progress {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 0;
    background: white;
    border-radius: 2px;
    transition: width 0.1s linear;
}

.progress-bar::before {
    content: none;
}

.playlist-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 320px;
    background-color: var(--background);
    border-left: 1px solid var(--border);
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
}

.playlist-sidebar.hidden {
    transform: translateX(100%);
}

.playlist-sidebar.visible {
    transform: translateX(0);
}

.playlist-content {
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
}

.sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header .section-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
}

.playlist-container {
    flex: 1;
    overflow-y: auto;
    padding-right: 0.5rem;
    margin-right: -0.5rem;
}

.playlist-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--card);
    border-radius: var(--radius);
    transition: all 0.2s ease;
    cursor: pointer;
    position: relative;
    width: 100%;
    max-width: calc(var(--sidebar-width) - 3rem);
}

.playlist-item .video-info {
    flex: 1;
    min-width: 0; /* This is crucial for text truncation */
    margin-right: 0.5rem;
}

.playlist-item .video-title {
    display: block;
    width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--foreground);
}

.playlist-item:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    border-color: var(--ring);
}

.playlist-item button {
    opacity: 0;
    transition: opacity 0.2s ease;
    padding: 0.25rem;
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
}

.playlist-item:hover button {
    opacity: 1;
}

.playlist-item.now-playing {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
    padding-left: 1.5rem;
}

.playlist-item.now-playing::before {
    content: '';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    background: currentColor;
    border-radius: 50%;
    animation: glow 1.5s ease-in-out infinite;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 0.5rem;
}

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

::-webkit-scrollbar-thumb {
    background: var(--muted-foreground);
    border-radius: var(--radius);
}

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

@keyframes glow {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.playlist-controls {
    margin-top: 15px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toggle-playlist {
    position: absolute;
    left: -40px;
    top: 20px;
    width: 40px;
    height: 40px;
    background: rgba(0, 0, 0, 0.9);
    border: 2px solid #ffffff;
    border-right: none;
    color: #ffffff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.playlist-container {
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

.playlist-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
}

.playlist-item span {
    flex: 1;
    margin-right: 10px;
    word-break: break-word;
}

.playlist-item button {
    background: none;
    border: none;
    color: #ff0000;
    font-size: 20px;
    cursor: pointer;
    padding: 0 5px;
}


/* Add scrollbar styling */
.playlist-container::-webkit-scrollbar {
    width: 6px;
}

.playlist-container::-webkit-scrollbar-track {
    background: var(--background);
}

.playlist-container::-webkit-scrollbar-thumb {
    background: #5833ED;
    border-radius: var(--radius);
}

.playlist-container::-webkit-scrollbar-thumb:hover {
    background: #4628c8;
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    margin-top: 10px;
}

.control-grid .retro-button {
    width: 100%;
    min-height: 40px;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.sidebar-header {
    padding: 0 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.btn-icon-small {
    padding: 0.5rem;
    height: 2rem;
    width: 2rem;
    background: var(--secondary);
    border: 1px solid var(--border);
    color: var(--foreground);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 1.25rem;
    line-height: 1;
}

.btn-icon-small:hover {
    background: var(--accent);
    color: var(--accent-foreground);
    transform: scale(1.05);
}

.btn-icon-small:active {
    transform: scale(0.95);
}

.playlist-sidebar.visible ~ #togglePlaylist {
    display: none;
}

.playlist-content {
    height: 100%;
    padding: 1.5rem;
    overflow-y: auto;
}

.playlist-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(to bottom, var(--background), var(--card));
    border-left: 1px solid var(--border);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100;
    box-shadow: -4px 0 15px rgba(0, 0, 0, 0.1);
}

.playlist-sidebar.visible {
    transform: translateX(0);
}

/* Hide section titles in control panel */
.control-panel .section-title {
    display: none;
}

/* Add volume slider container */
.volume-controls {
    display: flex;
    gap: 0.25rem;
    align-items: center;
}

.volume-controls .btn {
    padding: 0.25rem;
    min-width: 32px;
    height: 32px;
}

/* Slide-out Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--background);
    width: 400px;
    max-width: 100%;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
    animation: slideIn 0.3s ease-out;
}

.modal-overlay.visible .modal {
    transform: translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
    width: 100%;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--background);
    position: sticky;
    top: 0;
    z-index: 10;
}

.modal-header h2 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 0;
}

.modal-header .btn-icon-small {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    line-height: 1;
    border: none;
    background: transparent;
    color: var(--foreground);
    opacity: 0.7;
    transition: all 0.2s ease;
}

.modal-header .btn-icon-small:hover {
    opacity: 1;
    transform: scale(1.1);
    background: var(--accent);
}

.modal-header .btn-icon-small:active {
    transform: scale(0.95);
}

/* Ensure modal content doesn't overflow */
.modal-content {
    padding: 1.5rem;
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

.channel-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
    max-width: 100%;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.form-group .hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.form-actions button {
    flex: 1;
}

@media (max-width: 640px) {
    .modal {
        width: 100%;
    }
}

/* Toast notifications */
.toast-container {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 1000;
    pointer-events: none;
}

.toast {
    background: rgba(0, 0, 0, 0.9);
    color: white;
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transform: translateX(100%);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: auto;
}

.toast.show {
    transform: translateX(0);
    opacity: 1;
}

.toast svg {
    stroke: white;
}

.toast.success {
    border-left: 4px solid #10b981;
}

.toast.error {
    border-left: 4px solid #ef4444;
}

.toast.info {
    border-left: 4px solid #3b82f6;
}

.search-results {
    max-height: 300px;
    overflow-y: auto;
    margin: 1rem 0;
    border-radius: var(--radius);
    background: var(--card);
    border: 1px solid var(--border);
}

.search-result {
    display: flex;
    align-items: center;
    padding: 0.75rem;
    gap: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border);
}

.search-result:last-child {
    border-bottom: none;
}

.search-result:hover {
    background: var(--accent);
}

.search-result img {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: calc(var(--radius) - 2px);
    background: var(--muted);
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.25rem;
    color: var(--foreground);
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.result-channel {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

.video-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.input-group {
    margin-bottom: 1rem;
    width: 100%;
}

.input {
    width: 100%;
    height: 2.75rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    transition: all 0.2s ease;
}

.input:hover {
    border-color: var(--ring);
}

.input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--ring/15);
    transform: translateY(-1px);
}

.btn {
    cursor: pointer;
}

.btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
    border: 1px solid var(--primary);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.search-spinner {
    width: 24px;
    height: 24px;
    border: 2px solid var(--secondary);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 1rem auto;
    animation: spinner 0.6s linear infinite;
}

.search-spinner.hidden {
    display: none;
}

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

/* Auth styles */
.user-menu {
    position: relative;
}

.user-menu .btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all 0.2s ease;
}

.user-menu .btn:hover {
    background: var(--accent);
    border-color: var(--ring);
}

.dropdown-menu {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 220px;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1);
    z-index: 50;
}

.dropdown-menu .btn {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    color: var(--foreground);
    background: transparent;
    text-align: left;
    justify-content: flex-start;
    transition: all 0.2s ease;
    text-decoration: none;
    border: none;
}

.dropdown-menu .btn:hover {
    background: var(--accent);
}

.dropdown-menu div[style*="padding"] {
    text-align: left;
}

.dropdown-separator {
    height: 1px;
    background: var(--border);
    margin: 0.5rem 0;
}

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.auth-tab {
    padding: 0.5rem 1rem;
    border: none;
    background: none;
    color: var(--text);
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.auth-tab.active {
    border-bottom-color: var(--primary);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group input {
    height: 2.75rem;
    padding: 0 0.875rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    width: 100%;
}

.form-group input:hover {
    border-color: var(--ring);
}

.form-group input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--ring/10);
    transform: translateY(-1px);
}

/* Auth Container */
.auth-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: linear-gradient(to bottom right, var(--background), var(--card));
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 20px 25px -5px rgba(0, 0, 0, 0.05);
    padding: 2.5rem;
}

.auth-header {
    text-align: center;
    margin-bottom: 2rem;
}

.auth-title {
    font-size: 1.875rem;
    font-weight: 700;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.auth-description {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.auth-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1rem;
}

.auth-tab {
    flex: 1;
    padding: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--muted-foreground);
    background: none;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.auth-tab:hover {
    color: var(--foreground);
    background: var(--accent);
}

.auth-tab.active {
    color: var(--foreground);
    background: var(--accent);
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.form-group input {
    height: 2.75rem;
    padding: 0 0.875rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--foreground);
    font-size: 0.875rem;
    transition: all 0.2s ease;
    width: 100%;
}

.form-group input:hover {
    border-color: var(--ring);
}

.form-group input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--ring/10);
    transform: translateY(-1px);
}

.w-full {
    width: 100%;
}

/* Channels Page Styles */
.channels-container {
    width: 100%;
    max-width: none;
    margin: 0;
    padding: 2rem 2.5rem;
    flex: 1;
}

.channels-header {
    max-width: 100%;
    margin-bottom: 3rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.channels-header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    background: linear-gradient(to right, var(--foreground), var(--muted-foreground));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

#createChannelBtn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    transition: all 0.2s ease;
    background: linear-gradient(to right, var(--primary), var(--ring));
    border: none;
    color: black;
    margin-left: auto;
}

#createChannelBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 20px -8px var(--primary/30);
}

#createChannelBtn:active {
    transform: translateY(0);
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(400px, 1fr));
    gap: 2rem;
    width: 100%;
}

.channel-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-decoration: none;
    display: flex;
    flex-direction: column;
}

.channel-content {
    padding: 2rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.channel-card h3 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0 0 1rem 0;
    line-height: 1.2;
}

.channel-card p {
    color: var(--muted-foreground);
    font-size: 1rem;
    line-height: 1.6;
    margin: 0 0 1.5rem 0;
    flex-grow: 1;
}

.channel-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: auto;
    font-size: 0.875rem;
}

.channel-date {
    color: var(--muted-foreground);
}

.channel-visibility {
    background: var(--primary);
    color: var(--primary-foreground);
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.channel-card:hover {
    transform: translateY(-4px);
    border-color: var(--ring);
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 0 0 1px var(--ring);
}

.channel-card:active {
    transform: translateY(-2px);
}

@media (max-width: 768px) {
    .channels-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .channel-content {
        padding: 1.5rem;
    }
    
    .channel-card h3 {
        font-size: 1.25rem;
    }
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--card);
    border: 2px dashed var(--border);
    border-radius: var(--radius);
    color: var(--muted-foreground);
}

.empty-state svg {
    margin-bottom: 1.5rem;
    color: var(--muted-foreground);
    opacity: 0.7;
}

.empty-state p {
    font-size: 1.125rem;
    margin: 0;
}

/* Toast improvements */
.toast {
    border-radius: var(--radius);
    padding: 1rem 1.5rem;
    margin-bottom: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid var(--primary);
}

.toast.show {
    transform: translateX(0);
}

.toast.success {
    background: var(--success-light);
    border-left-color: var(--success);
}

.toast.error {
    background: var(--error-light);
    border-left-color: var(--error);
}

/* Modal improvements */
.modal {
    max-width: 500px;
    width: 90%;
    border-radius: var(--radius);
    background: var(--background);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.modal-content {
    padding: 1.5rem;
}

.channel-form .input {
    background: var(--input);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.75rem 1rem;
    width: 100%;
    transition: all 0.2s ease;
}

.channel-form .input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary/10);
    outline: none;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .channels-container {
        padding: 1.5rem;
    }

    .channels-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        gap: 1rem;
    }

    .channels-header h1 {
        font-size: 2rem;
    }

    .channels-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .nav-header {
        padding: 0 1.5rem;
    }
}

@media (max-width: 640px) {
    .channels-container {
        padding: 1rem;
    }

    .nav-header {
        padding: 0 1rem;
    }
}

/* Navigation Header */
.nav-header {
    position: sticky;
    top: 0;
    z-index: 40;
    width: 100%;
    background: var(--background/95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.nav-start {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav-logo {
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.logo-text {
    font-size: 1.5rem;
    font-weight: 600;
    background: linear-gradient(to right, var(--primary), var(--ring));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.02em;
}

.search-wrapper {
    position: relative;
    width: 300px;
}

.search-input {
    width: 100%;
    height: 2.5rem;
    padding: 0.5rem 2.5rem 0.5rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--foreground);
    transition: all 0.2s ease;
}

.search-input:hover {
    border-color: var(--ring);
}

.search-input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px var(--ring/15);
}

.search-icon {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted-foreground);
    pointer-events: none;
}

.nav-end {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.channels-container {
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.channels-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.channel-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s ease;
}

.channel-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px -12px var(--ring/15);
    border-color: var(--ring);
}

.channel-card-content {
    padding: 1.5rem;
    text-decoration: none;
}

.channel-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0 0 0.5rem 0;
    color: var(--foreground);
}

.channel-card p {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 0 0 1rem 0;
}

.channel-stats {
    display: flex;
    gap: 1rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

.channel-stats span {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.channel-card-actions {
    padding: 1rem 1.5rem;
    background: var(--accent/5);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 0.75rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--muted-foreground);
    grid-column: 1/-1;
}

.empty-state svg {
    margin-bottom: 1rem;
    color: var(--muted-foreground);
}

.empty-state h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

/* Settings Page */
.settings-container {
    width: 60%;
    max-width: 1000px;
    margin: 2rem auto;
    padding: 0 2rem;
}

.settings-header {
    margin-bottom: 2rem;
}

.settings-header h1 {
    font-size: 2rem;
    font-weight: 700;
    color: var(--foreground);
}

.settings-content {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 2rem;
}

.settings-form {
    width: 100%;
    max-width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.dropdown-menu div[style*="padding"] {
    text-align: left;
}

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

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

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

/* Channel Page */
.channel-container {
    max-width: 1200px;
    margin: 6rem auto 2rem;
    padding: 0 1.5rem;
}

.channel-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.channel-info h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.channel-info p {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

.playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.playlist-card {
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.2s ease;
}

.playlist-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.playlist-card-content {
    padding: 1.5rem;
}

.playlist-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.playlist-card p {
    color: var(--muted-foreground);
    font-size: 0.875rem;
    margin-bottom: 1rem;
}

.playlist-stats {
    display: flex;
    gap: 1rem;
    color: var(--muted-foreground);
    font-size: 0.75rem;
}

.playlist-stats span {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--muted-foreground);
}

.empty-state svg {
    margin-bottom: 1.5rem;
    color: var(--muted-foreground);
}

.empty-state h2 {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.empty-state p {
    margin-bottom: 1.5rem;
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .channel-container {
        margin-top: 5rem;
        padding: 0 1rem;
    }

    .channel-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }

    .playlists-grid {
        grid-template-columns: 1fr;
    }
}

.playlist-item .video-title {
    display: block;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 0.875rem;
    line-height: 1.25rem;
    color: var(--foreground);
}

.playlist-item:hover .video-title {
    text-decoration: underline;
}

.playlist-item.active {
    background: white;
    color: black;
    border-color: var(--border);
}

.playlist-item.active .video-title {
    color: black;
    font-weight: 500;
}

.playlist-item.active button {
    color: black;
}

/* 3.2 Floating Controls */
.floating-controls {
    position: fixed;
    top: 20px;
    left: 15px;
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 50;
}
.floating-controls .logo-link {
    display: flex;
    align-items: center;
    color: var(--foreground);
    text-decoration: none;
}
.floating-controls .logo-container {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    border-radius: var(--radius);
}

.floating-controls .btn-icon {
    padding: 0.75rem;
    height: 3rem;
    width: 3rem;
    background: var(--card);
    color: var(--foreground);
    border-radius: var(--radius);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.floating-controls .btn-icon:hover {
    background: var(--accent);
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.playlist-container .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1rem;
    height: 100%;
    color: var(--muted-foreground);
}

.playlist-container .empty-state svg {
    margin-bottom: 1rem;
    color: var(--muted-foreground);
    opacity: 0.7;
}

.playlist-container .empty-state h2 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.playlist-container .empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    color: var(--muted-foreground);
}

.playlist-container .empty-state .btn {
    min-width: 150px;
}

/* 4. Player */
/* 4.1 Player Container */
#player-container {
    position: relative;
    width: 100%;
    height: calc(100vh - 170px);
    background: var(--background);
    border-radius: var(--radius);
    overflow: hidden;
}

#player-container .empty-state {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 400px;
    height: auto;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

#player-container .empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 1.5rem;
    color: var(--muted-foreground);
    opacity: 0.7;
}

#player-container .empty-state h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

#player-container .empty-state p {
    font-size: 0.875rem;
    margin-bottom: 1.5rem;
    color: var(--muted-foreground);
    max-width: 280px;
    text-align: center;
}

#player-container .empty-state .btn {
    min-width: 160px;
}

/* 6. Profile */
/* 6.1 Profile Container */
.profile-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 60%;
}

/* 6.2 Profile Header */
.profile-header {
    margin-bottom: 2.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

/* 7. Utilities */
/* 7.1 Text Utilities */
.text-muted {
    color: var(--muted-foreground);
    font-size: 1.1rem;
    margin: 0;
}

/* 7.2 Form Elements */
#channelDescription {
    width: 100%;
    max-width: 100%;
    height: 100px;
    font-family: 'Inter';
    resize: vertical;
    box-sizing: border-box;
}


        /* Privacy Toggle Styles */
        .privacy-toggle {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            cursor: pointer;
        }

        .privacy-toggle input[type="checkbox"] {
            appearance: none;
            -webkit-appearance: none;
            width: 3.5rem;
            height: 2rem;
            background-color: var(--muted);
            border-radius: 1rem;
            position: relative;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .privacy-toggle input[type="checkbox"]::before {
            content: "";
            position: absolute;
            width: 1.5rem;
            height: 1.5rem;
            border-radius: 50%;
            background-color: #000000;
            top: 0.25rem;
            left: 0.25rem;
            transition: transform 0.3s;
        }

        .privacy-toggle input[type="checkbox"]:checked {
            background-color: var(--primary);
        }

        .privacy-toggle input[type="checkbox"]:checked::before {
            transform: translateX(1.5rem);
        }

        .toggle-label {
            font-weight: 500;
            color: var(--foreground);
        }

        .top-nav {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            height: 60px;
            background: rgba(0, 0, 0, 0.8);
            backdrop-filter: blur(10px);
            display: grid;
            grid-template-columns: 1fr auto 1fr;
            align-items: center;
            padding: 0 20px;
            z-index: 100;
        }

        .nav-left {
            display: flex;
            align-items: center;
            justify-content: flex-start;
        }

        .nav-center {
            font-weight: 600;
            font-size: 1.1rem;
            color: white;
            text-align: center;
            padding: 0 20px;
            white-space: nowrap;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        .nav-right {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 8px;
        }

        .logo-link {
            display: flex;
            align-items: center;
            color: white;
            text-decoration: none;
            padding: 8px;
        }

        .logo-link svg {
            transition: transform 0.2s ease;
        }

        .logo-link:hover svg {
            transform: scale(1.05);
        }

        .btn-icon {
            color: white;
            background: transparent;
            border: none;
            cursor: pointer;
            padding: 8px;
            border-radius: 50%;
            transition: background-color 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            width: 40px;
            height: 40px;
        }

        .btn-icon:hover {
            background: rgba(255, 255, 255, 0.1);
        }

        #togglePlaylist, #channelSettings {
            position: relative;
            z-index: 101;
        }

        #channelSettings {
            margin-left: 8px;
        }

        /* Add/update modal styles */
        .modal-overlay {
            position: fixed;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background: rgba(0, 0, 0, 0.5);
            display: none;
            justify-content: flex-end;
            align-items: stretch;
            z-index: 2000;
            backdrop-filter: blur(5px);
        }

        .modal-overlay.visible {
            display: flex;
        }

        .modal {
            background: var(--background);
            width: 400px;
            max-width: 90%;
            height: 100vh;
            overflow-y: auto;
            position: relative;
            box-shadow: -8px 0 32px rgba(0, 0, 0, 0.4);
            animation: slideIn 0.3s ease-out;
        }

        @keyframes slideIn {
            from {
                transform: translateX(100%);
            }
            to {
                transform: translateX(0);
            }
        }

        /* Remove special styles for add video modal - it should match the channel settings modal */
        #addVideoModal .modal {
            width: 400px;
            max-width: 90%;
            height: 100vh;
            margin: 0;
            border-radius: 0;
        }

        #addVideoModal {
            justify-content: flex-end;
            align-items: stretch;
        }

        .danger-zone {
            margin-top: 2rem;
            padding-top: 2rem;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .danger-zone h3 {
            color: #ff4444;
            font-size: 0.9rem;
            font-weight: 600;
            margin-bottom: 0.5rem;
        }

        .danger-zone p {
            font-size: 0.9rem;
            color: rgba(255, 255, 255, 0.7);
            margin-bottom: 1rem;
        }

        .btn-text {
            background: transparent;
            padding: 8px 12px;
            display: flex;
            align-items: center;
            gap: 8px;
            width: 100%;
            justify-content: center;
            font-size: 0.9rem;
        }

        .btn-text svg {
            opacity: 0.8;
        }

        .btn-text:hover {
            background: rgba(255, 68, 68, 0.1);
        }

        .btn-text.btn-danger {
            color: #ff4444;
            border: 1px solid rgba(255, 68, 68, 0.3);
        }

        .btn-text.btn-danger:hover {
            border-color: #ff4444;
        }

        /* Privacy Toggle Styles */
        .privacy-toggle {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            cursor: pointer;
        }

        .privacy-toggle input[type="checkbox"] {
            appearance: none;
            -webkit-appearance: none;
            width: 3.5rem;
            height: 2rem;
            background-color: var(--muted);
            border-radius: 1rem;
            position: relative;
            cursor: pointer;
            transition: background-color 0.3s;
        }

        .privacy-toggle input[type="checkbox"]::before {
            content: "";
            position: absolute;
            width: 1.5rem;
            height: 1.5rem;
            border-radius: 50%;
            background-color: #000000;
            top: 0.25rem;
            left: 0.25rem;
            transition: transform 0.3s;
        }

        .privacy-toggle input[type="checkbox"]:checked {
            background-color: var(--primary);
        }

        .privacy-toggle input[type="checkbox"]:checked::before {
            transform: translateX(1.5rem);
        }

        .toggle-label {
            font-weight: 500;
        }

/* Volume Slider */
.volume-slider-container {
    width: 100px;
    display: flex;
    align-items: center;
    margin: 0 0.5rem;
}

.volume-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.volume-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: white;
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.volume-slider:hover {
    height: 6px;
}

.volume-slider:hover::-webkit-slider-thumb {
    width: 14px;
    height: 14px;
}

.volume-slider:hover::-moz-range-thumb {
    width: 14px;
    height: 14px;
}

@media (max-width: 768px) {
    .volume-slider-container {
        width: 80px;
    }
}