/* =========================================
   Modern UI Design - Variables & Reset
   ========================================= */
:root {
    /* Colors - 2025 Clean & Minimal */
    --primary-color: #4F46E5;
    /* Indigo 600 - More premium/tech */
    --primary-hover: #4338CA;
    /* Indigo 700 */
    --primary-light: #E0E7FF;
    /* Indigo 100 */

    --secondary-color: #64748B;
    /* Slate 500 */
    --accent-color: #F59E0B;
    /* Amber 500 */
    --danger-color: #EF4444;
    /* Red 500 */
    --success-color: #10B981;
    /* Emerald 500 */

    /* Backgrounds */
    --bg-body: #F8F9FA;
    /* Lightest Gray - Clean slate */
    --bg-surface: #FFFFFF;
    /* Pure White */
    --bg-glass: rgba(255, 255, 255, 0.95);
    /* Less transparent = Cleaner */

    /* Text */
    --text-main: #111827;
    /* Gray 900 - Sharp */
    --text-secondary: #4B5563;
    /* Gray 600 */
    --text-muted: #9CA3AF;
    /* Gray 400 */
    --text-light: #F9FAFB;
    /* Gray 50 */

    /* Shadows & Effects - Ultra Soft */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.02);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --glass-blur: blur(8px);
    /* Reduced blur for crispness */

    /* Spacing & Radii */
    --radius-md: 0.75rem;
    /* 12px */
    --radius-lg: 1rem;
    /* 16px */
    --radius-xl: 1.5rem;
    /* 24px */
    --container-width: 1200px;
}

/* Dark Mode Variables - Refined */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #0F172A;
        /* Slate 900 */
        --bg-surface: #1E293B;
        /* Slate 800 */
        --bg-glass: rgba(30, 41, 59, 0.95);
        --text-main: #F8FAFC;
        /* Slate 50 */
        --text-secondary: #CBD5E1;
        /* Slate 300 */
        --text-muted: #64748B;
        /* Slate 500 */
        --primary-light: rgba(79, 70, 229, 0.2);
    }
}

/* Base Styles */
body {
    background-color: var(--bg-body);
    color: var(--text-main);
    font-family: 'Inter', 'Noto Sans JP', sans-serif;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    /* padding-top: 80px; Removed for admin-body control */
}

.admin-body {
    padding-top: 0 !important;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

a:hover {
    color: var(--primary-hover);
    text-decoration: none;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    letter-spacing: -0.025em;
}

/* =========================================
   Components
   ========================================= */

/* Glass Panel */
/* Glass Panel */
/* Glass Panel - Cleaner, Ceramic look */
.glass-panel {
    background: var(--bg-surface);
    border: 1px solid rgba(0, 0, 0, 0.03);
    /* Subtle border */
    box-shadow: var(--shadow-md);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    /* Increased whitespace */
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Navbar - Minimalist */
.navbar {
    background: var(--bg-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    box-shadow: var(--shadow-sm);
    padding: 1rem 0;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1030;
    transition: all 0.3s ease;
}

.navbar-brand {
    font-weight: 800;
    font-size: 1.5rem;
    color: var(--text-main) !important;
    letter-spacing: -0.04em;
    display: flex;
    align-items: center;
}

.navbar-brand i {
    color: var(--primary-color);
}

.nav-link {
    font-weight: 500;
    color: var(--text-secondary) !important;
    padding: 0.6rem 1.25rem !important;
    border-radius: 9999px;
    /* Pill shape */
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.nav-link:hover {
    color: var(--primary-color) !important;
    background-color: var(--primary-light);
}

/* Container */
.container {
    max-width: 1280px;
    /* Wider for modern screens */
    padding: 0 2rem;
}

/* Sidebar - Clean & Flat */
.sidebar {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.sticky-sidebar {
    position: sticky;
    top: 100px;
}

/* Footer */
.footer {
    background: var(--bg-surface);
    padding: 3rem 0;
    margin-top: 5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* =========================================
   Video Cards
   ========================================= */
/* =========================================
   Video Cards - Clean & Modern
   ========================================= */
.video-card {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    /* Smooth spring-like */
    height: 100%;
    border: none;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.video-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
}

.video-thumbnail-container {
    position: relative;
    padding-top: 56.25%;
    /* 16:9 */
    overflow: hidden;
    background-color: #F3F4F6;
}

.video-thumbnail-container img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.video-card:hover .video-thumbnail-container img {
    transform: scale(1.08);
}

.video-card-body {
    padding: 1.25rem 1.5rem;
    /* More breathing room */
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.video-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-main);
    transition: color 0.2s;
}

.video-card:hover .video-card-title {
    color: var(--primary-color);
}

.video-card-meta {
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
}

.video-card-meta a {
    color: var(--text-muted);
}

.video-card-meta a:hover {
    color: var(--primary-color);
}

/* =========================================
   Detail Pages
   ========================================= */
.detail-header {
    margin-bottom: 3rem;
    text-align: center;
}

.detail-title {
    font-size: 2.25rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    line-height: 1.2;
}

.video-player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    background: #000;
    margin-bottom: 2.5rem;
}

.video-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Check content readability */
.video-description {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-top: 2rem;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1.8;
    box-shadow: var(--shadow-sm);
}

/* Tags */
.modern-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 1rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 9999px;
    background-color: var(--primary-light);
    color: var(--primary-color);
    margin: 0.35rem;
    transition: all 0.2s;
    letter-spacing: 0.02em;
}

.modern-badge:hover {
    background-color: var(--primary-color);
    color: #FFF;
    transform: translateY(-1px);
}

/* =========================================
   Admin / forms
   ========================================= */
.form-control {
    border-radius: var(--radius-md);
    border: 1px solid #E2E8F0;
    background-color: #F8FAFC;
    padding: 0.85rem 1rem;
    font-size: 0.95rem;
    height: auto;
    transition: all 0.2s;
    color: var(--text-main);
}

select.form-control {
    padding-right: 2.5rem;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%2364748B' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    background-size: 16px 12px;
}

.form-control:focus {
    border-color: var(--primary-color);
    background-color: #FFFFFF;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

/* Ensure form groups have breathing room */
.form-group {
    margin-bottom: 2rem;
}

.form-group label {
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--text-main);
    font-size: 0.9rem;
    display: block;
}

.btn {
    border-radius: var(--radius-md);
    padding: 0.75rem 1.75rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    transition: all 0.25s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
    box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 15px -3px rgba(79, 70, 229, 0.3);
}

/* Admin Tables */
.modern-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.modern-table th {
    background-color: var(--bg-body);
    font-weight: 600;
    color: var(--text-secondary);
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #E5E7EB;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.modern-table td {
    padding: 1.25rem 1rem;
    border-bottom: 1px solid #F3F4F6;
    color: var(--text-main);
    vertical-align: middle;
}

.modern-table tr:hover td {
    background-color: #F8FAFC;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

/* =========================================
   Utilities / Misc
   ========================================= */
.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 2rem;
    padding-left: 0;
    border-left: none;
    /* Removed heavy border */
    color: var(--text-main);
    letter-spacing: -0.03em;
}

.text-muted-sm {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Show All Button */
.btn-show-all {
    display: block;
    width: 100%;
    padding: 1rem;
    text-align: center;
    background: var(--bg-surface);
    border: 2px dashed #E5E7EB;
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.2s;
}

.btn-show-all:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #F0F9FF;
}

/* Login Page specific */
.login-card {
    padding: 1rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.video-card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-main);
}

.video-card-meta {
    margin-top: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* =========================================
   Detail Pages
   ========================================= */
.detail-header {
    margin-bottom: 2rem;
    text-align: center;
}

.detail-title {
    font-size: 2rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--text-main), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 1rem;
}

.video-player-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    overflow: hidden;
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
    background: #000;
    margin-bottom: 2rem;
}

.video-player-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

/* Check content readability */
.video-description {
    background: var(--bg-body);
    /* Slightly distinct from surface */
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-top: 1.5rem;
    color: var(--text-main);
    font-size: 0.95rem;
}

/* Tags */
.modern-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    border-radius: 9999px;
    background-color: #EBF5FF;
    /* Blue 50 */
    color: var(--primary-color);
    margin: 0.25rem;
    transition: all 0.2s;
}

.modern-badge:hover {
    background-color: var(--primary-color);
    color: white;
}

/* =========================================
   Admin / forms
   ========================================= */
.form-control {
    border-radius: var(--radius-md);
    border: 1px solid #E5E7EB;
    /* Lighter border */
    background-color: #F9FAFB;
    /* Light gray background for contrast */
    padding: 0.85rem 1rem;
    /* Increased padding */
    font-size: 0.95rem;
    height: auto;
    /* Override Bootstrap's fixed height */
    transition: all 0.2s;
    color: var(--text-main);
}

select.form-control {
    padding-right: 2.5rem;
    /* Prevent text hitting arrow */
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M2 5l6 6 6-6'/%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 16px 12px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.form-control:focus {
    border-color: var(--primary-color);
    background-color: #FFFFFF;
    /* White on focus */
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* Ensure form groups have breathing room */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
}

.btn {
    border-radius: var(--radius-md);
    padding: 0.5rem 1.5rem;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary {
    background-color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    border-color: var(--primary-hover);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

/* Admin Tables */
.modern-table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
}

.modern-table th {
    background-color: var(--bg-body);
    font-weight: 600;
    color: var(--text-muted);
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
}

.modern-table td {
    padding: 1rem;
    border-bottom: 1px solid #E5E7EB;
    color: var(--text-main);
    vertical-align: middle;
}

.modern-table tr:last-child td {
    border-bottom: none;
}

/* =========================================
   Utilities / Misc
   ========================================= */
.section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--primary-color);
}

.text-muted-sm {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Show All Button */
.btn-show-all {
    display: block;
    width: 100%;
    padding: 1rem;
    text-align: center;
    background: var(--bg-surface);
    border: 2px dashed #E5E7EB;
    border-radius: var(--radius-lg);
    color: var(--text-muted);
    font-weight: 600;
    margin-top: 1rem;
    transition: all 0.2s;
}

.btn-show-all:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #F0F9FF;
}

/* Login Page specific */
.login-card {
    max-width: 400px;
    margin: 4rem auto;
    padding: 2rem;
    background: var(--bg-surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-lg);
}

/* Admin Layout */
.admin-container {
    display: flex;
    flex-wrap: nowrap;
    /* Prevent wrapping */
    min-height: 100vh;
    background-color: #F1F5F9;
    /* Slate 100 */
}

/* Sidebar - Modern Dashboard Style */
.glass-sidebar {
    width: 260px;
    background: #0F172A;
    /* Slate 900 - Dark sidebar for contrast */
    border-right: none;
    display: flex;
    flex-direction: column;
    width: 260px;
    background: #0F172A;
    /* Slate 900 - Dark sidebar for contrast */
    border-right: none;
    display: flex;
    flex-direction: column;
    position: sticky;
    /* Changed from fixed to sticky */
    top: 0;
    height: 100vh;
    z-index: 1000;
    padding: 2rem 1rem;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    flex-shrink: 0;
    /* Important for flex layout */
    overflow-y: auto;
}

.glass-sidebar .brand {
    font-size: 1.5rem;
    font-weight: 800;
    color: #FFFFFF;
    margin-bottom: 3rem;
    text-align: center;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.glass-sidebar .brand i {
    color: var(--primary-color);
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.sidebar-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem;
    color: #94A3B8;
    /* Slate 400 */
    text-decoration: none;
    border-radius: var(--radius-md);
    transition: all 0.2s ease;
    font-weight: 500;
    font-size: 0.95rem;
}

.sidebar-link:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.05);
}

.sidebar-link.active {
    background: var(--primary-color);
    color: #FFFFFF;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.sidebar-link.text-danger:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
}

.admin-main-content {
    flex: 1;
    margin-left: 0;
    /* Remove fixed margin */
    width: 0;
    /* Prevent flex overflow */
    padding: 3rem;
    /* More space */
    min-height: 100vh;
}

/* Glass Tables - Clean Data View */
.glass-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    margin-bottom: 1rem;
}

.glass-table th {
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-secondary);
    font-weight: 600;
    padding: 1.25rem 1.5rem;
    text-align: left;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.glass-table td {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    color: var(--text-main);
    vertical-align: middle;
    font-size: 0.95rem;
}

.glass-table tr:hover td {
    background: #FAFAFA;
}

.glass-table tr:last-child td {
    border-bottom: none;
}

/* Custom Checkbox within tables */
.custom-control-label::before {
    background-color: #FFFFFF;
    border: 1px solid #CBD5E1;
}

/* Page Header in Admin */
.admin-page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
}

.admin-page-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    letter-spacing: -0.03em;
}

/* Responsive Sidebar */
@media (max-width: 991.98px) {
    .glass-sidebar {
        position: fixed;
        /* Revert to fixed for mobile overlay */
        top: 0;
        bottom: 0;
        left: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
    }

    .glass-sidebar.show {
        transform: translateX(0);
    }

    .admin-main-content {
        margin-left: 0;
        padding: 1.5rem;
    }

    .admin-mobile-toggle {
        display: block;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 0 1rem;
    }

    .navbar-collapse {
        background: var(--bg-surface);
        padding: 1rem;
        border-radius: var(--radius-lg);
        box-shadow: var(--shadow-lg);
        margin-top: 1rem;
    }
}