/* ===== IPTV Player — iptv.hostnet.space ===== */

:root {
    --bg-primary: #f0f4f8;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --bg-card-hover: #f0f7ff;
    --bg-elevated: #f8fafc;
    --bg-glass: rgba(255, 255, 255, 0.95);

    --text-primary: #1a202c;
    --text-secondary: #4a5568;
    --text-muted: #718096;

    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --accent-light: #2563eb;
    --accent-gradient: linear-gradient(135deg, #3b82f6, #6366f1);

    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    --border: #e2e8f0;
    --border-hover: #cbd5e1;

    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --shadow: 0 2px 8px rgba(0, 0, 0, 0.06), 0 1px 3px rgba(0,0,0,0.04);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.1);

    --transition: 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-spring: 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ===== Reset & Base ===== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 300px;
    background: linear-gradient(180deg, rgba(59, 130, 246, 0.06) 0%, transparent 100%);
    pointer-events: none;
    z-index: 0;
}

a {
    text-decoration: none;
    color: inherit;
}

input, button {
    font-family: inherit;
    border: none;
    outline: none;
}

.hidden {
    display: none !important;
}

/* ===== Scrollbar ===== */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: #f1f5f9;
}
::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ===== Header ===== */
#main-header {
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 1px 8px rgba(0,0,0,0.06);
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 700;
    cursor: pointer;
}

.logo-icon {
    font-size: 1.6rem;
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.4));
    animation: float 3s ease-in-out infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0); filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.4)); }
    50% { transform: translateY(-3px); filter: drop-shadow(0 0 12px rgba(59, 130, 246, 0.7)); }
}

.logo-text {
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-dot {
    color: var(--accent);
    -webkit-text-fill-color: var(--accent);
}

.header-nav {
    display: flex;
    gap: 4px;
    align-items: center;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
}

.nav-link:hover {
    color: var(--text-primary);
    background: rgba(59, 130, 246, 0.08);
}

.nav-link.active {
    color: var(--accent);
    background: var(--accent-glow);
}

/* ===== Main Content ===== */
#main-content {
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 24px;
    width: 100%;
    position: relative;
    z-index: 1;
}

/* ===== Section Header ===== */
.section-header {
    text-align: center;
    margin-bottom: 32px;
}

.section-header h1 {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-primary) 30%, var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 8px;
}

.section-subtitle {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

/* ===== Upload Area ===== */
.upload-area {
    margin-bottom: 40px;
}

.upload-dropzone {
    border: 2px dashed var(--border-hover);
    border-radius: var(--radius-xl);
    padding: 40px;
    text-align: center;
    transition: var(--transition);
    background: var(--bg-card);
    cursor: default;
    box-shadow: var(--shadow);
}

.upload-dropzone.drag-over {
    border-color: var(--accent);
    background: rgba(59, 130, 246, 0.04);
    box-shadow: 0 0 40px var(--accent-glow);
}

.upload-dropzone svg {
    color: #94a3b8;
    margin-bottom: 16px;
}

.upload-dropzone p {
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.upload-dropzone span {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.upload-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 10px 28px;
    background: var(--accent-gradient);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 16px var(--accent-glow);
}

.upload-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(59,130,246,0.25);
}

.upload-url-block {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}

.upload-url-block span {
    display: block;
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.url-input-row {
    display: flex;
    gap: 8px;
    max-width: 500px;
    margin: 0 auto;
}

.url-input-row input {
    flex: 1;
    padding: 10px 16px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: var(--transition);
}

.url-input-row input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #fff;
}

.btn-primary {
    padding: 10px 20px;
    background: var(--accent-gradient);
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.88rem;
    color: #fff;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    border: none;
    box-shadow: 0 2px 8px rgba(59,130,246,0.2);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(59,130,246,0.3);
}

/* ===== Playlists Grid ===== */
.playlists-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 16px;
}

.playlist-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.playlist-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: var(--transition);
}

.playlist-card:hover {
    background: var(--bg-card-hover);
    border-color: rgba(59,130,246,0.3);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.playlist-card:hover::before {
    opacity: 1;
}

.playlist-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    font-size: 1.5rem;
}

.playlist-card-name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.playlist-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    margin-bottom: 16px;
}

.playlist-card-meta span {
    display: flex;
    align-items: center;
    gap: 4px;
}

.playlist-card-link {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--accent);
    background: var(--accent-glow);
    padding: 6px 12px;
    border-radius: 8px;
    width: fit-content;
}

.playlist-card-link code {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
}

/* ===== Player Section ===== */
.player-top-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.btn-back {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 16px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 0.88rem;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.btn-back:hover {
    background: var(--bg-card-hover);
    color: var(--accent);
    border-color: rgba(59,130,246,0.3);
}

.playlist-title {
    font-size: 1.2rem;
    font-weight: 700;
    flex: 1;
    color: var(--text-primary);
}

.channel-count {
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-card);
    padding: 6px 14px;
    border-radius: 20px;
    border: 1.5px solid var(--border);
    box-shadow: var(--shadow);
}

/* ===== Player Layout ===== */
.player-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 20px;
    height: calc(100vh - 220px);
    min-height: 500px;
}

/* ===== Video Container ===== */
.video-container {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
}

.video-wrapper {
    position: relative;
    background: #0f172a;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    overflow: hidden;
    flex: 1;
    min-height: 300px;
    box-shadow: var(--shadow-lg);
}

.video-wrapper video {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    object-fit: contain;
    background: #000;
}

.video-overlay, .video-loading, .video-error {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.9);
    z-index: 5;
}

.overlay-content {
    text-align: center;
    color: rgba(255,255,255,0.5);
}

.overlay-content svg {
    margin-bottom: 16px;
    opacity: 0.4;
}

.overlay-content p {
    font-size: 0.95rem;
}

.video-loading {
    flex-direction: column;
    gap: 16px;
    color: rgba(255,255,255,0.6);
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(255,255,255,0.1);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.video-error {
    flex-direction: column;
    gap: 12px;
    color: #fc8181;
}

.video-error p {
    font-size: 0.9rem;
    color: rgba(255,255,255,0.5);
}

/* ===== Now Playing ===== */
.now-playing {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.now-playing-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.now-playing-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--bg-elevated);
    display: none;
    border: 1px solid var(--border);
}

.now-playing-logo.visible {
    display: block;
}

.now-playing-name {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.now-playing-group {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.live-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ef4444;
    letter-spacing: 1px;
    border: 1px solid rgba(239,68,68,0.2);
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #ef4444;
    border-radius: 50%;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

/* ===== Channel Sidebar ===== */
.channel-sidebar {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    min-height: 0;
    box-shadow: var(--shadow);
}

.sidebar-search {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-elevated);
}

.sidebar-search svg {
    color: var(--text-muted);
    flex-shrink: 0;
}

.sidebar-search input {
    flex: 1;
    background: none;
    color: var(--text-primary);
    font-size: 0.88rem;
}

.sidebar-search input::placeholder {
    color: var(--text-muted);
}

/* ===== Proxy Bar ===== */
.proxy-bar {
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: space-between;
    background: var(--bg-elevated);
}

.proxy-bar span {
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Toggle Switch */
.switch {
    position: relative;
    display: inline-block;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #cbd5e1;
    transition: .3s;
    border-radius: 20px;
}

.slider::before {
    position: absolute;
    content: '';
    height: 14px;
    width: 14px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .3s;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

input:checked + .slider {
    background-color: var(--accent);
}

input:checked + .slider::before {
    transform: translateX(16px);
}

/* ===== Group Filter ===== */
.group-filter {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
    overflow-x: auto;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
    background: var(--bg-elevated);
}

.group-filter::-webkit-scrollbar {
    height: 3px;
}

.group-btn {
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--bg-card);
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
    flex-shrink: 0;
    border: 1.5px solid var(--border);
}

.group-btn:hover {
    color: var(--accent);
    border-color: rgba(59,130,246,0.3);
    background: var(--accent-glow);
}

.group-btn.active {
    color: #fff;
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 2px 8px rgba(59,130,246,0.25);
}

/* ===== Channel List ===== */
.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.channel-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}

.channel-item:hover {
    background: var(--bg-elevated);
    border-color: var(--border);
}

.channel-item.active {
    background: var(--accent-glow);
    border-color: rgba(59, 130, 246, 0.25);
}

.channel-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.channel-logo-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: linear-gradient(135deg, #dbeafe, #ede9fe);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--accent);
}

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

.channel-name {
    font-size: 0.88rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--text-primary);
}

.channel-group {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-play-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--accent-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: scale(0.8);
    transition: var(--transition);
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
}

.channel-item:hover .channel-play-icon,
.channel-item.active .channel-play-icon {
    opacity: 1;
    transform: scale(1);
}

.channel-play-icon svg {
    width: 12px;
    height: 12px;
    fill: #fff;
    stroke: none;
    margin-left: 2px;
}

.no-channels {
    padding: 40px 20px;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== Footer ===== */
#main-footer {
    position: relative;
    z-index: 1;
    border-top: 1px solid var(--border);
    background: var(--bg-card);
}

.footer-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

.disclaimer {
    display: flex;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(59, 130, 246, 0.04);
    border: 1px solid rgba(59, 130, 246, 0.12);
    border-radius: var(--radius);
    margin-bottom: 16px;
}

.disclaimer svg {
    flex-shrink: 0;
    color: var(--accent);
    margin-top: 2px;
}

.disclaimer p {
    font-size: 0.82rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.footer-sep {
    opacity: 0.4;
}

/* ===== Animations ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-in {
    animation: fadeIn 0.35s ease-out;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .player-layout {
        grid-template-columns: 1fr;
        height: auto;
    }

    .video-wrapper {
        min-height: 220px;
        aspect-ratio: 16/9;
        position: sticky;
        top: 56px;
        z-index: 50;
    }

    .now-playing {
        position: sticky;
        top: calc(56px + 220px);
        z-index: 50;
        border-radius: 0;
        border-bottom: 2px solid var(--border);
    }

    .channel-sidebar {
        max-height: 400px;
    }

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

    .header-inner {
        padding: 0 16px;
    }

    #main-content {
        padding: 20px 16px;
    }

    .section-header h1 {
        font-size: 1.5rem;
    }

    .upload-dropzone {
        padding: 24px 16px;
    }
}

@media (max-width: 480px) {
    .header-inner {
        height: 56px;
    }

    .nav-link span {
        display: none;
    }

    .nav-link {
        padding: 8px 12px;
    }

    .url-input-row {
        flex-direction: column;
    }

    .player-top-bar {
        gap: 8px;
    }

    .playlist-title {
        font-size: 1rem;
        order: 3;
        flex-basis: 100%;
    }
}

/* ===== Admin Styles (shared) ===== */
.admin-container {
    max-width: 960px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

.login-card {
    max-width: 400px;
    margin: 80px auto;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 40px;
    text-align: center;
    box-shadow: var(--shadow-lg);
}

.login-card h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.login-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 24px;
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg-elevated);
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.88rem;
    transition: var(--transition);
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
    background: #fff;
}

.form-btn {
    width: 100%;
    padding: 11px;
    background: var(--accent-gradient);
    border: none;
    border-radius: 10px;
    color: #fff;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    box-shadow: 0 4px 12px rgba(59,130,246,0.25);
}

.form-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(59,130,246,0.35);
}

.form-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: 8px;
    border: 1px solid #fecaca;
}

/* ===== Admin Panel ===== */
.admin-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    flex-wrap: wrap;
    gap: 16px;
}

.admin-header h2 {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.btn-logout {
    padding: 8px 16px;
    background: rgba(239, 68, 68, 0.08);
    border: 1.5px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: var(--danger);
    font-size: 0.85rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-logout:hover {
    background: rgba(239, 68, 68, 0.15);
}

/* Admin Add Form */
.admin-add-form,
.admin-builder-form {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.admin-add-form h3 {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-add-form .form-btn {
    margin-top: 16px;
}

/* Admin Playlist Table */
.admin-table-wrap {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
}

.admin-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--bg-elevated);
    border-bottom: 1.5px solid var(--border);
}

.admin-table td {
    padding: 13px 16px;
    font-size: 0.88rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    color: var(--text-primary);
}

.admin-table tr:last-child td {
    border-bottom: none;
}

.admin-table tr:hover td {
    background: var(--bg-elevated);
}

.short-link-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--accent-glow);
    border-radius: 6px;
    font-size: 0.8rem;
    color: var(--accent);
    font-family: 'SF Mono', 'Fira Code', monospace;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid rgba(59,130,246,0.15);
}

.short-link-badge:hover {
    background: rgba(59, 130, 246, 0.15);
}

.btn-delete {
    padding: 5px 12px;
    background: rgba(239, 68, 68, 0.07);
    border: 1.5px solid rgba(239, 68, 68, 0.15);
    border-radius: 8px;
    color: var(--danger);
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-delete:hover {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.3);
}

.btn-warning {
    padding: 5px 12px;
    background: rgba(245, 158, 11, 0.08);
    border: 1.5px solid rgba(245, 158, 11, 0.2);
    border-radius: 8px;
    color: #b45309;
    font-size: 0.8rem;
    cursor: pointer;
    transition: var(--transition);
}

.btn-warning:hover {
    background: rgba(245, 158, 11, 0.15);
}

.empty-state {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-muted);
}

.empty-state svg {
    margin-bottom: 12px;
    opacity: 0.3;
}

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

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    padding: 14px 20px;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.88rem;
    box-shadow: var(--shadow-lg);
    z-index: 2000;
    animation: toastIn 0.3s ease-out;
}

.toast.success {
    border-color: rgba(16, 185, 129, 0.35);
    background: #f0fdf4;
    color: #065f46;
}

.toast.error {
    border-color: rgba(239, 68, 68, 0.3);
    background: #fff5f5;
    color: #c53030;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Mobile Admin ===== */
@media (max-width: 700px) {
    .form-row {
        grid-template-columns: 1fr;
    }

    .admin-table th:nth-child(3),
    .admin-table td:nth-child(3) {
        display: none;
    }

    .login-card {
        margin: 40px 16px;
        padding: 24px;
    }
}

/* ===== Builder Channel Row ===== */
.builder-ch-row {
    background: var(--bg-elevated);
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1.5px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: flex-start;
    transition: var(--transition);
}

.builder-ch-row:hover {
    border-color: rgba(59,130,246,0.25);
    background: #f8faff;
}

.builder-ch-arrows {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-top: 2px;
}

.builder-ch-arrows button {
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    border-radius: 5px;
    width: 24px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6rem;
    transition: var(--transition);
}

.builder-ch-arrows button:hover:not(:disabled) {
    background: var(--accent-glow);
    color: var(--accent);
    border-color: rgba(59,130,246,0.3);
}

.builder-ch-arrows button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.builder-ch-fields {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.builder-ch-fields input {
    padding: 7px 10px;
    font-size: 0.82rem;
}

.builder-ch-url {
    grid-column: 1 / -1;
}

.builder-ch-actions {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ===== Test Player Modal ===== */
#test-player-modal {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 380px;
    z-index: 1500;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    border-radius: var(--radius-lg);
    overflow: hidden;
    border: 1.5px solid var(--border);
    background: #0f172a;
}

@media(max-width: 768px) {
    #test-player-modal { width: calc(100% - 40px); }
}

#test-player-modal.hidden { display: none; }

.test-player-box {
    background: #000;
    width: 100%;
    position: relative;
}

.test-player-header {
    background: #1e293b;
    padding: 10px 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.test-player-title {
    color: rgba(255,255,255,0.8);
    font-size: 0.82rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 240px;
}

.test-btn-close {
    background: rgba(255,255,255,0.1);
    border: none;
    color: white;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.8rem;
    transition: var(--transition);
}

.test-btn-close:hover {
    background: rgba(239,68,68,0.8);
}

/* ===== Settings Modal ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeOverlay 0.2s ease-out;
}

@keyframes fadeOverlay {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-overlay.hidden { display: none; }

.modal-box {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 32px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: modalIn 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.92) translateY(20px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.modal-close {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 1rem;
    transition: var(--transition);
}

.modal-close:hover {
    background: #fef2f2;
    color: var(--danger);
    border-color: rgba(239,68,68,0.3);
}

.settings-group {
    margin-bottom: 24px;
}

.settings-group-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: var(--bg-elevated);
    border-radius: 10px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
}

.settings-row-left {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.settings-row-title {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-row-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
}

.settings-select {
    padding: 7px 28px 7px 12px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    transition: var(--transition);
    min-width: 140px;
}

.settings-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.proxy-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.proxy-status.off {
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

.proxy-status.on {
    background: rgba(16,185,129,0.1);
    color: #065f46;
    border: 1px solid rgba(16,185,129,0.25);
}

/* Stats bar in dashboard */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 14px;
}

.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    flex-shrink: 0;
}

.stat-icon.blue { background: linear-gradient(135deg, #dbeafe, #bfdbfe); }
.stat-icon.green { background: linear-gradient(135deg, #d1fae5, #a7f3d0); }
.stat-icon.purple { background: linear-gradient(135deg, #ede9fe, #ddd6fe); }

.stat-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

/* Settings Tabs */
.settings-tab {
    padding: 8px 16px;
    border-radius: 10px 10px 0 0;
    font-size: 0.84rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    border-bottom: 2px solid transparent;
    margin-bottom: -2px;
}

.settings-tab:hover {
    color: var(--accent);
    background: var(--accent-glow);
}

.settings-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    background: var(--accent-glow);
    font-weight: 600;
}

/* Import URL in builder */
.builder-import-bar {

    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    padding: 16px;
    background: var(--bg-elevated);
    border-radius: 10px;
    border: 1px dashed var(--border-hover);
}

/* ===== Mobile Header Fixes ===== */
@media (max-width: 768px) {
    .header-inner {
        flex-direction: column;
        height: auto;
        padding: 12px 16px;
        gap: 12px;
        text-align: center;
    }
    .header-nav {
        flex-wrap: wrap;
        justify-content: center;
        width: 100%;
        gap: 6px;
    }
    .nav-link {
        padding: 6px 12px;
        font-size: 0.82rem;
    }
    .header-nav .btn-back {
        font-size: 0.78rem;
        padding: 5px 10px;
    }
    .player-layout {
        grid-template-columns: 1fr;
    }
    .video-wrapper {
        min-height: 220px;
    }
    .now-playing {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
