/**
 * ════════════════════════════════════════════════════════════════
 * TEVE.SK - Main Stylesheet
 * YouTube-inspired Dark Theme
 * ════════════════════════════════════════════════════════════════
 */

/* ════════════════════════════════════════════════════════════════
   CSS VARIABLES
   ════════════════════════════════════════════════════════════════ */

:root {
    /* Colors */
    --color-primary: #667eea;
    --color-primary-hover: #5568d3;
    --color-secondary: #764ba2;
    
    /* Background */
    --color-bg-dark: #0f0f0f;
    --color-bg-medium: #212121;
    --color-bg-light: #2a2a2a;
    --color-bg-hover: #3a3a3a;
    
    /* Text */
    --color-text-primary: #f1f1f1;
    --color-text-secondary: #aaaaaa;
    --color-text-tertiary: #717171;
    
    /* Border */
    --color-border: #3a3a3a;
    
    /* Success/Error */
    --color-success: #10b981;
    --color-error: #ef4444;
    --color-warning: #f59e0b;
    --color-info: #3b82f6;
    
    /* Dimensions */
    --header-height: 56px;
    --sidebar-width: 240px;
    --sidebar-width-collapsed: 72px;
    
    /* Border radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    
    /* Shadows */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 8px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 16px rgba(0, 0, 0, 0.5);
    
    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
}

/* ════════════════════════════════════════════════════════════════
   RESET & BASE
   ════════════════════════════════════════════════════════════════ */

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

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--color-bg-dark);
    color: var(--color-text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

body.no-scroll {
    overflow: hidden;
}

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

button {
    font-family: inherit;
    cursor: pointer;
    border: none;
    background: none;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

/* ════════════════════════════════════════════════════════════════
   HEADER
   ════════════════════════════════════════════════════════════════ */

.header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--color-bg-dark);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.header__left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 200px;
}

.header__menu-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    transition: background var(--transition-fast);
}

.header__menu-btn:hover {
    background: var(--color-bg-hover);
}

.header__logo {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
}

.header__logo-text {
    display: none;
}

@media (min-width: 640px) {
    .header__logo-text {
        display: inline;
    }
}

.header__center {
    flex: 1;
    max-width: 600px;
    margin: 0 40px;
}

.search-form {
    display: flex;
    height: 40px;
    border: 1px solid var(--color-border);
    border-radius: 40px;
    overflow: hidden;
    background: var(--color-bg-medium);
}

.search-form:focus-within {
    border-color: var(--color-primary);
}

.search-form__input {
    flex: 1;
    padding: 0 16px;
    background: none;
    border: none;
    color: var(--color-text-primary);
    outline: none;
}

.search-form__input::placeholder {
    color: var(--color-text-tertiary);
}

.search-form__btn {
    width: 64px;
    background: var(--color-bg-hover);
    color: var(--color-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background var(--transition-fast);
}

.search-form__btn:hover {
    background: var(--color-bg-light);
}

.header__right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.header__upload-btn,
.header__icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-primary);
    position: relative;
    transition: background var(--transition-fast);
}

.header__upload-btn:hover,
.header__icon-btn:hover {
    background: var(--color-bg-hover);
}

.header__badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--color-error);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 5px;
    border-radius: 10px;
    line-height: 1;
}

.header__login-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--color-primary);
    border-radius: 40px;
    color: var(--color-primary);
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-fast);
}

.header__login-btn:hover {
    background: var(--color-primary);
    color: white;
}

/* User Menu */
.header__user-menu {
    position: relative;
}

.header__user-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
}

.header__user-avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header__user-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--color-bg-medium);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.user-dropdown__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}

.user-dropdown__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.user-dropdown__name {
    font-weight: 600;
    font-size: 14px;
}

.user-dropdown__username {
    font-size: 12px;
    color: var(--color-text-secondary);
}

.user-dropdown__divider {
    height: 1px;
    background: var(--color-border);
    margin: 8px 0;
}

.user-dropdown__item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    color: var(--color-text-primary);
    font-size: 14px;
    transition: background var(--transition-fast);
}

.user-dropdown__item:hover {
    background: var(--color-bg-hover);
}

.user-dropdown__item i {
    width: 20px;
    color: var(--color-text-secondary);
}

/* ════════════════════════════════════════════════════════════════
   SIDEBAR
   ════════════════════════════════════════════════════════════════ */

.sidebar {
    position: fixed;
    top: var(--header-height);
    left: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--color-bg-dark);
    border-right: 1px solid var(--color-border);
    overflow-y: auto;
    overflow-x: hidden;
    z-index: 90;
    transition: transform var(--transition-normal);
}

/* Scrollbar styling */
.sidebar::-webkit-scrollbar {
    width: 8px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--color-bg-hover);
    border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--color-bg-light);
}

.sidebar__content {
    padding: 12px 0;
}

.sidebar__nav {
    padding: 0 12px;
}

.sidebar__heading {
    padding: 8px 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.sidebar__item {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 2px;
    transition: background var(--transition-fast);
}

.sidebar__item:hover {
    background: var(--color-bg-hover);
}

.sidebar__item--active {
    background: var(--color-bg-hover);
    font-weight: 600;
}

.sidebar__item i {
    width: 24px;
    text-align: center;
    font-size: 20px;
    color: var(--color-text-primary);
}

.sidebar__item--channel {
    gap: 12px;
}

.sidebar__channel-avatar {
    width:24px;
    height: 24px;
    border-radius: 50%;
    object-fit: cover;
}

.sidebar__empty {
    padding: 16px 12px;
    text-align: center;
    color: var(--color-text-tertiary);
    font-size: 13px;
}

.sidebar__divider {
    height: 1px;
    background: var(--color-border);
    margin: 12px 0;
}

.sidebar__footer {
    padding: 16px 24px;
    color: var(--color-text-tertiary);
    font-size: 12px;
}

.sidebar__footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.sidebar__footer-links a {
    color: var(--color-text-tertiary);
    transition: color var(--transition-fast);
}

.sidebar__footer-links a:hover {
    color: var(--color-text-secondary);
}

.sidebar__footer-links a::after {
    content: "•";
    margin-left: 8px;
    color: var(--color-text-tertiary);
}

.sidebar__footer-links a:last-child::after {
    content: none;
}

.sidebar__copyright {
    color: var(--color-text-tertiary);
}

/* Mobile sidebar */
@media (max-width: 1023px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar--open {
        transform: translateX(0);
    }
}

.sidebar-overlay {
    position: fixed;
    top: var(--header-height);
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 85;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

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

@media (min-width: 1024px) {
    .sidebar-overlay {
        display: none;
    }
}

/* ════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ════════════════════════════════════════════════════════════════ */

.main-content {
    margin-top: var(--header-height);
    padding: 24px;
    min-height: calc(100vh - var(--header-height));
}

@media (min-width: 1024px) {
    .main-content {
        margin-left: var(--sidebar-width);
    }
}

/* ════════════════════════════════════════════════════════════════
   FLASH MESSAGES
   ════════════════════════════════════════════════════════════════ */

.flash-messages {
    position: fixed;
    top: calc(var(--header-height) + 16px);
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.flash {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    color: white;
    font-weight: 500;
    font-size: 14px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
}

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

.flash-success {
    background: var(--color-success);
}

.flash-error {
    background: var(--color-error);
}

.flash-warning {
    background: var(--color-warning);
}

.flash-info {
    background: var(--color-info);
}

/* ════════════════════════════════════════════════════════════════
   VIDEO GRID
   ════════════════════════════════════════════════════════════════ */

.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px 16px;
}

@media (max-width: 640px) {
    .video-grid {
        grid-template-columns: 1fr;
    }
}

.video-card {
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.video-card__thumbnail {
    position: relative;
    width: 100%;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    background: var(--color-bg-medium);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.video-card__thumbnail img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-normal);
}

.video-card:hover .video-card__thumbnail img {
    transform: scale(1.05);
}

.video-card__duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 3px 6px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.video-card__info {
    display: flex;
    gap: 12px;
    padding: 12px 0;
}

.video-card__avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.video-card__details {
    flex: 1;
    min-width: 0;
}

.video-card__title {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.video-card__channel {
    font-size: 13px;
    color: var(--color-text-secondary);
    margin-bottom: 2px;
}

.video-card__channel:hover {
    color: var(--color-text-primary);
}

.video-card__meta {
    font-size: 13px;
    color: var(--color-text-secondary);
}

/* ════════════════════════════════════════════════════════════════
   BUTTONS
   ════════════════════════════════════════════════════════════════ */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: var(--radius-md);
    font-weight: 600;
    font-size: 14px;
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    text-decoration: none;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
    color: white;
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--color-bg-medium);
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
}

.btn-secondary:hover:not(:disabled) {
    background: var(--color-bg-hover);
}

.btn-outline {
    background: transparent;
    color: var(--color-primary);
    border: 2px solid var(--color-primary);
}

.btn-outline:hover:not(:disabled) {
    background: var(--color-primary);
    color: white;
}

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

.btn-danger:hover:not(:disabled) {
    background: #dc2626;
}

.btn-sm {
    padding: 6px 14px;
    font-size: 13px;
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* ════════════════════════════════════════════════════════════════
   FORMS
   ════════════════════════════════════════════════════════════════ */

.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-text-primary);
}

.form-label--required::after {
    content: "*";
    color: var(--color-error);
    margin-left: 4px;
}

.form-input,
.form-textarea,
.form-select {
    width: 100%;
    padding: 10px 14px;
    background: var(--color-bg-medium);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    color: var(--color-text-primary);
    font-size: 14px;
    transition: border-color var(--transition-fast);
}

.form-input:focus,
.form-textarea:focus,
.form-select:focus {
    outline: none;
    border-color: var(--color-primary);
}

.form-input::placeholder,
.form-textarea::placeholder {
    color: var(--color-text-tertiary);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-text-tertiary);
}

.form-error {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: var(--color-error);
}

.form-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.form-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* ════════════════════════════════════════════════════════════════
   CONTAINER & LAYOUT
   ════════════════════════════════════════════════════════════════ */

.container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 0 20px;
}

.container-sm {
    max-width: 768px;
    margin: 0 auto;
    padding: 0 20px;
}

.page-header {
    margin-bottom: 32px;
}

.page-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 8px;
}

.page-subtitle {
    font-size: 16px;
    color: var(--color-text-secondary);
}

.section {
    margin-bottom: 48px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
}

/* ════════════════════════════════════════════════════════════════
   LOADING SPINNER
   ════════════════════════════════════════════════════════════════ */

.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid var(--color-bg-hover);
    border-top-color: var(--color-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.loading-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
    .header__center {
        display: none;
    }
    
    .main-content {
        padding: 16px;
    }
    
    .page-title {
        font-size: 24px;
    }
}

/* ════════════════════════════════════════════════════════════════
   UTILITIES
   ════════════════════════════════════════════════════════════════ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mt-4 { margin-top: 32px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.mb-4 { margin-bottom: 32px; }

.flex {
    display: flex;
}

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

.flex-between {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.gap-1 { gap: 8px; }
.gap-2 { gap: 16px; }
.gap-3 { gap: 24px; }
.gap-4 { gap: 32px; }

.hidden {
    display: none;
}

@media (max-width: 768px) {
    .hidden-mobile {
        display: none;
    }
}

@media (min-width: 769px) {
    .hidden-desktop {
        display: none;
    }
}
/* ════════════════════════════════════════════════════════════════
   ANIMATIONS
   ════════════════════════════════════════════════════════════════ */

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

@keyframes slideOut {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

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

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