/* ========================================
   Video Tutorials Portal - Clean Light Design
   ======================================== */

/* --- CSS Variables / Design Tokens --- */
:root {
    --primary: #05A875;
    --primary-dark: #048A5F;
    --primary-light: #06C98B;
    --primary-bg: #E6F7F1;
    --secondary: #F59E0B;
    --secondary-bg: #FEF3C7;
    --accent: #05A875;
    --accent-purple: #8B5CF6;
    --accent-purple-bg: #EDE9FE;
    --accent-pink: #EC4899;
    --accent-pink-bg: #FCE7F3;
    --accent-blue: #3B82F6;
    --accent-blue-bg: #DBEAFE;
    --accent-orange: #F97316;
    --accent-orange-bg: #FFEDD5;
    --bg-body: #E8F0ED;
    --bg-card: #FFFFFF;
    --bg-card-hover: #EDF7F3;
    --bg-header: rgba(255, 255, 255, 0.95);
    --text-primary: #1A2E2A;
    --text-secondary: #5A7A72;
    --text-muted: #8AA39B;
    --border-color: #D5E6E0;
    --shadow: 0 4px 24px rgba(5, 168, 117, 0.08);
    --shadow-sm: 0 1px 4px rgba(5, 168, 117, 0.06);
    --radius: 16px;
    --radius-sm: 10px;
    --radius-lg: 24px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --max-width: 1100px;
    --header-height: 68px;
}

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

html {
    scroll-behavior: smooth;
}

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

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

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

ul {
    list-style: none;
}

/* --- Preloader --- */
.preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-body);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.preloader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.preloader-icon {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.preloader-text {
    margin-top: 16px;
    color: var(--text-secondary);
    font-size: 14px;
    letter-spacing: 1px;
}

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

/* --- Header / Navigation --- */
.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--header-height);
    background: var(--bg-header);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
    z-index: 1000;
    transition: var(--transition);
}

.header.scrolled {
    box-shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
}

.header-inner {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 24px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    transition: var(--transition);
}

.logo:hover {
    color: var(--primary);
}

.logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: white;
    box-shadow: 0 2px 8px rgba(5, 168, 117, 0.3);
}

/* --- Main Content --- */
.main-content {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: calc(var(--header-height) + 32px) 24px 40px;
    flex: 1;
    width: 100%;
}

/* --- Video Grid --- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}

/* --- Video Card --- */
.video-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.video-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 8px 20px rgba(5, 168, 117, 0.1);
}

.video-card-thumb {
    position: relative;
    width: 100%;
    padding-top: 50%; /* 2:1 aspect ratio - shorter */
    overflow: hidden;
}

/* --- Gradient color themes for video cards (all #05A875 light variations) --- */
.video-card.gradient-green .video-card-thumb {
    background: linear-gradient(135deg, #E6F7F1, #D1F0E5);
}
.video-card.gradient-amber .video-card-thumb {
    background: linear-gradient(135deg, #D6F5EC, #C2F0E2);
}
.video-card.gradient-purple .video-card-thumb {
    background: linear-gradient(135deg, #C5EDE0, #B3E8D8);
}
.video-card.gradient-pink .video-card-thumb {
    background: linear-gradient(135deg, #B5E6D5, #A3E0CD);
}
.video-card.gradient-blue .video-card-thumb {
    background: linear-gradient(135deg, #A4DFC9, #90D8BF);
}
.video-card.gradient-orange .video-card-thumb {
    background: linear-gradient(135deg, #94D8BC, #80D0B2);
}

/* Hover border color per theme (all same #05A875) */
.video-card.gradient-green:hover { border-color: #05A875; }
.video-card.gradient-amber:hover { border-color: #05A875; }
.video-card.gradient-purple:hover { border-color: #05A875; }
.video-card.gradient-pink:hover { border-color: #05A875; }
.video-card.gradient-blue:hover { border-color: #05A875; }
.video-card.gradient-orange:hover { border-color: #05A875; }

/* Play triangle - pure CSS play button icon */
.play-triangle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 18px 0 18px 30px;
    border-color: transparent transparent transparent rgba(5, 168, 117, 0.85);
    transition: var(--transition);
}

.video-card:hover .play-triangle {
    border-color: transparent transparent transparent rgba(5, 168, 117, 1);
    transform: translate(-50%, -50%) scale(1.15);
}

.play-triangle.small {
    border-width: 12px 0 12px 18px;
    border-color: transparent transparent transparent rgba(5, 168, 117, 0.7);
}

.video-card-body {
    padding: 14px;
}

.video-card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.3;
}

.video-card-description {
    font-size: 13px;
    color: var(--text-secondary);
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
}

.video-card-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-muted);
}

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

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.empty-state h3 {
    font-size: 20px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

/* --- Video Watch Page --- */
.watch-container {
    max-width: 960px;
    margin: 0 auto;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary);
    font-size: 15px;
    margin-bottom: 20px;
    padding: 10px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    transition: var(--transition);
    cursor: pointer;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.watch-video-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 16px;
    line-height: 1.3;
}

.back-button:hover {
    background: var(--primary-bg);
    border-color: var(--primary);
    transform: translateX(-4px);
    box-shadow: 0 4px 12px rgba(5, 168, 117, 0.1);
}

/* --- Video Player Wrapper --- */
.video-wrapper {
    background: #000;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    position: relative;
}

.video-wrapper video {
    width: 100%;
    display: block;
    max-height: 70vh;
    background: #000;
}

.video-wrapper video {
    pointer-events: auto;
}

/* --- Video Info Section --- */
.video-info {
    margin-top: 28px;
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 32px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

.video-info h1 {
    font-size: 26px;
    font-weight: 700;
    margin-bottom: 10px;
    line-height: 1.3;
    color: var(--text-primary);
}

.video-info-description {
    color: var(--text-secondary);
    font-size: 16px;
    line-height: 1.7;
    margin-bottom: 20px;
}

.video-info-meta {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.video-info-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
    font-size: 14px;
    background: var(--primary-bg);
    padding: 6px 14px;
    border-radius: 50px;
}

/* --- Next Videos Section --- */
.next-videos {
    margin-top: 40px;
}

.next-videos h2 {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.next-videos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.next-video-card {
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    transition: var(--transition);
    cursor: pointer;
    display: flex;
    gap: 0;
    box-shadow: var(--shadow-sm);
}

.next-video-card:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(5, 168, 117, 0.1);
}

.next-video-thumb {
    width: 120px;
    min-height: 80px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #E6F7F1, #D1F0E5);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    position: relative;
}

.next-video-info {
    padding: 12px 14px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.next-video-info h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.next-video-info p {
    font-size: 12px;
    color: var(--text-muted);
}

/* --- Footer --- */
.footer {
    text-align: center;
    padding: 12px 24px;
    color: var(--text-muted);
    font-size: 13px;
    border-top: 1px solid var(--border-color);
    margin-top: 20px;
    background: var(--bg-card);
}

.footer a {
    color: var(--primary);
    transition: var(--transition);
}

.footer a:hover {
    color: var(--primary-dark);
}

/* --- Toast Notification --- */
.toast {
    position: fixed;
    bottom: 30px;
    right: 30px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 14px 22px;
    color: var(--text-primary);
    font-size: 14px;
    z-index: 9999;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    transform: translateY(100px);
    opacity: 0;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 10px;
}

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

.toast .toast-icon {
    font-size: 18px;
}

.toast.success .toast-icon {
    color: var(--accent);
}

.toast.error .toast-icon {
    color: #EF4444;
}

/* --- Scroll to Top --- */
.scroll-top {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 44px;
    height: 44px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
    z-index: 999;
    box-shadow: 0 4px 16px rgba(5, 168, 117, 0.3);
}

.scroll-top.visible {
    opacity: 1;
    visibility: visible;
}

.scroll-top:hover {
    background: var(--primary-dark);
    transform: translateY(-3px);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .video-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
    
    .video-info h1 {
        font-size: 22px;
    }

    .next-video-thumb {
        width: 100px;
    }
}

@media (max-width: 768px) {
    .header-inner {
        padding: 0 16px;
    }
    
    .main-content {
        padding: calc(var(--header-height) + 16px) 16px 24px;
    }
    
    .video-grid {
        grid-template-columns: 1fr;
        gap: 18px;
    }
    
    .video-info {
        padding: 20px;
    }
    
    .video-info h1 {
        font-size: 20px;
    }
    
    .next-videos-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {    
    .back-button {
        font-size: 13px;
        padding: 8px 16px;
    }
    
    .video-info-meta {
        flex-direction: column;
        gap: 10px;
    }
    
    .next-video-thumb {
        width: 80px;
        min-height: 64px;
    }
}