:root {
    --bg-dark: #051e11;
    --bg-gradient: linear-gradient(135deg, #051e11, #0f3d24, #0a2f1c);
    --primary: #00b894;
    --primary-gradient: linear-gradient(135deg, #00b894, #55efc4);
    --accent: #55efc4;
    --danger: #ff7675;
    --success: #00b894;
    --text-main: #dfe6e9;
    --text-muted: #b2bec3;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --radius: 16px;
    --font-main: 'Outfit', sans-serif;
}

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

body {
    font-family: var(--font-main);
    background: var(--bg-gradient);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    letter-spacing: -0.5px;
    color: #fff;
}

a {
    text-decoration: none;
    color: inherit;
    transition: color 0.3s ease;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    flex: 1;
}

/* Glassmorphism */
.glass-container {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: var(--glass-shadow);
}

/* Navbar */
.navbar {
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 1rem;
    z-index: 100;
    margin: 0 1rem;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    background: var(--primary-gradient);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Player Controls */
.video-container {
    position: relative;
    background: black;
    width: 100%;
    max-height: 80vh;
    /* Prevent it from being too tall on desktop */
    aspect-ratio: auto;
    /* Allow natural aspect ratio */
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto;
    /* Center horizontally */
}

video {
    max-height: 80vh;
    width: auto;
    max-width: 100%;
}

.custom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1.5rem 1rem 1rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-container:hover .custom-controls,
.video-container.paused .custom-controls {
    opacity: 1;
}

/* Progress Bar Container */
.timeline-container {
    height: 5px;
    width: 100%;
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
    position: relative;
    border-radius: 5px;
    transition: height 0.2s;
}

.timeline-container:hover {
    height: 8px;
}

.buffer-bar {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    width: 0%;
    border-radius: 5px;
    pointer-events: none;
}

.progress-bar-play {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    background: var(--primary);
    width: 0%;
    border-radius: 5px;
    pointer-events: none;
    box-shadow: 0 0 10px var(--primary);
}

.scrubber-head {
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%) scale(0);
    width: 12px;
    height: 12px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}

.timeline-container:hover .scrubber-head {
    transform: translateY(-50%) scale(1);
}

.controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: white;
}

.control-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 5px;
    border-radius: 5px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* Volume */
.volume-container {
    display: flex;
    align-items: center;
    gap: 5px;
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
}

.volume-wrapper:hover .volume-container,
.volume-container:hover {
    width: 80px;
}

.volume-slider {
    width: 100%;
    height: 15px;
    /* Increased hit area */
    accent-color: white;
    cursor: pointer;
    vertical-align: middle;
}

/* Settings Menu */
/* Settings Menu */
.settings-menu {
    position: absolute;
    bottom: 60px;
    right: 20px;
    background: rgba(20, 20, 20, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 8px;
    padding: 0.5rem 0;
    /* Vertical padding only */
    min-width: 200px;
    /* Slightly wider */
    display: none;
    flex-direction: column;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5);
    z-index: 100;
}

.settings-menu.active {
    display: flex;
    animation: slideUp 0.2s ease;
}

.settings-main,
.settings-submenu {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.settings-submenu {
    display: none;
}

.settings-submenu.active {
    display: flex;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    cursor: pointer;
    font-size: 0.9rem;
    color: #eee;
    transition: background 0.2s;
}

.settings-item:hover {
    background: rgba(255, 255, 255, 0.1);
}

.submenu-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0.75rem 1rem;
    margin-bottom: 0.25rem;
    font-weight: 600;
    color: var(--primary);
}

.submenu-header {
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Admin Panel */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--glass-border);
}

.permissions-btn {
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 0.5rem 1rem;
    border-radius: 4px;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.permissions-btn:hover {
    background: var(--danger);
    color: white;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.stat-card {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    border-radius: 12px;
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.5rem;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.video-table-container {
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

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

.video-table th,
.video-table td {
    padding: 1.2rem;
    text-align: left;
    border-bottom: 1px solid var(--glass-border);
}

.video-table th {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-weight: 600;
}

.video-table tr:hover {
    background: rgba(255, 255, 255, 0.02);
}

.action-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.5rem;
    color: var(--text-muted);
    transition: color 0.2s;
    font-size: 1.1rem;
}

.action-btn:hover {
    color: white;
}

.action-btn.delete:hover {
    color: var(--danger);
}

.action-btn.retry:hover {
    color: var(--accent);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-align: center;
}

.btn-primary {
    background: var(--primary-gradient);
    color: white;
    box-shadow: 0 4px 15px rgba(108, 92, 231, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(108, 92, 231, 0.6);
}

.btn-danger {
    background: linear-gradient(135deg, #ff7675, #d63031);
    color: white;
}

/* Forms & Inputs */
.upload-zone {
    border: 2px dashed var(--glass-border);
    border-radius: var(--radius);
    padding: 4rem 2rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
    background: rgba(255, 255, 255, 0.02);
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

.upload-zone:hover,
.upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(108, 92, 231, 0.1);
    transform: scale(1.01);
}

input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}

/* Video List (Cards) */
.video-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-top: 2rem;
}

.video-item {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    min-width: 0;
}

.video-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 255, 255, 0.2);
}

/* Streamable-style Play Overlay */
.video-thumbnail-link:hover .play-overlay {
    opacity: 1 !important;
}

.video-thumbnail-link:hover .play-icon {
    transform: scale(1.15) !important;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-block;
    /* Ensure padding/dimensions work correctly */
    white-space: nowrap;
    /* Prevent wrapping */
    vertical-align: middle;
}

.status-completed {
    background: rgba(0, 184, 148, 0.2);
    color: #55efc4;
    border: 1px solid rgba(0, 184, 148, 0.3);
}

.status-processing {
    background: rgba(9, 132, 227, 0.2);
    color: #74b9ff;
    border: 1px solid rgba(9, 132, 227, 0.3);
    animation: pulse 2s infinite;
}

.status-error {
    background: rgba(214, 48, 49, 0.2);
    color: #ff7675;
    border: 1px solid rgba(214, 48, 49, 0.3);
}

.status-pending {
    background: rgba(255, 255, 255, 0.1);
    color: #dfe6e9;
}

/* Progress Bar */
.progress-container {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    height: 10px;
    overflow: hidden;
    position: relative;
}

.progress-bar {
    height: 100%;
    background: var(--primary-gradient);
    position: relative;
    transition: width 0.4s ease;
    box-shadow: 0 0 10px var(--primary);
}

/* Animations */
@keyframes pulse {
    0% {
        opacity: 0.7;
    }

    50% {
        opacity: 1;
        box-shadow: 0 0 15px rgba(9, 132, 227, 0.4);
    }

    100% {
        opacity: 0.7;
    }
}

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

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

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

    .video-list {
        grid-template-columns: 1fr;
    }
}