/* ================================================================ */
/* VIDEO GENERATOR - ADMIN TOOL STYLES                              */
/* ================================================================ */

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

/* Material Symbols Styling */
.material-symbols-outlined {
    font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
    vertical-align: middle;
    font-size: 20px;
}

button .material-symbols-outlined {
    margin-right: 4px;
}

body {
    font-family: 'Kanit', Arial, sans-serif;
    background: linear-gradient(180deg, #000000 0%, #0a0a0a 50%, #000000 100%);
    min-height: 100vh;
    padding: 0;
    position: relative;
    overflow-x: hidden;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 30%, rgba(255, 4, 4, 0.05) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 4, 4, 0.03) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

.header-bar {
    background: linear-gradient(90deg, #ff0404 0%, #cc0303 50%, #ff0404 100%);
    background-size: 200% 100%;
    height: 10px;
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 9999;
    box-shadow: 0 2px 20px rgba(255, 4, 4, 0.5);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 0% 0%; }
    50% { background-position: 100% 0%; }
}

.container {
    max-width: 1400px;
    margin: 60px auto 0;
    background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 50%, #0f0f0f 100%);
    border-radius: 0;
    padding: 50px;
    box-shadow: 
        0 0 60px rgba(255, 4, 4, 0.15),
        inset 0 1px 0 rgba(255, 4, 4, 0.1);
    position: relative;
    z-index: 1;
    border-top: 1px solid rgba(255, 4, 4, 0.3);
}

h1 {
    color: #ffffff;
    margin-bottom: 12px;
    font-size: 42px;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-shadow: 
        0 0 20px rgba(255, 4, 4, 0.3),
        0 2px 4px rgba(0, 0, 0, 0.8);
    position: relative;
}

h1::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 100%;
    height: 5px;
    background: linear-gradient(90deg, #ff0404 0%, transparent 100%);
    box-shadow: 0 0 1px rgba(255, 4, 4, 0.5);
}

.subtitle {
    color: #999999;
    margin-bottom: 30px;
    font-size: 17px;
    font-weight: 400;
    margin-top: 20px;
}

.grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 35px;
    margin-top: 35px;
}

.section {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid #2a2a2a;
    box-shadow: 
        0 4px 20px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, #ff0404, transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.section:hover::before {
    opacity: 1;
}

.section:hover {
    transform: translateY(-2px);
    border-color: #ff0404;
    box-shadow: 
        0 8px 30px rgba(255, 4, 4, 0.2),
        0 0 40px rgba(255, 4, 4, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.section h2 {
    color: #ff0404;
    margin-bottom: 25px;
    font-size: 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 10px rgba(255, 4, 4, 0.3);
}

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

label {
    display: block;
    margin-bottom: 10px;
    color: #ffffff;
    font-weight: 500;
    font-size: 14px;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

small {
    display: block;
    font-size: 12px;
    color: #999;
    margin-top: 5px;
    line-height: 1.6;
}

small code {
    background: rgba(255, 4, 4, 0.1);
    padding: 2px 6px;
    border-radius: 3px;
    color: #ff6666;
    font-size: 11px;
    font-family: 'Monaco', 'Menlo', monospace;
}

small strong {
    color: #ffffff;
    font-weight: 600;
}

small em {
    color: #ff9900;
    font-style: normal;
}

input, select, textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #2a2a2a;
    border-radius: 6px;
    font-size: 15px;
    transition: all 0.3s ease;
    background: linear-gradient(135deg, #0a0a0a 0%, #000000 100%);
    color: #ffffff;
    font-family: inherit;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: #ff0404;
    box-shadow: 
        0 0 0 3px rgba(255, 4, 4, 0.15),
        0 0 20px rgba(255, 4, 4, 0.2),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
    background: #000000;
}

input:hover, select:hover, textarea:hover {
    border-color: #ff0404;
    box-shadow: 
        0 0 10px rgba(255, 4, 4, 0.1),
        inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

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

select option {
    background: #0a0a0a;
    color: #ffffff;
    padding: 10px;
}

select option:hover {
    background: #1a1a1a;
}

button {
    background: linear-gradient(135deg, #ff0404 0%, #cc0303 100%);
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    margin: 6px;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 4px 15px rgba(255, 4, 4, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    transition: left 0.6s;
}

button:hover::before {
    left: 100%;
}

button:hover {
    background: linear-gradient(135deg, #ff1a1a 0%, #ff0404 100%);
    transform: translateY(-2px);
    box-shadow: 
        0 6px 25px rgba(255, 4, 4, 0.5),
        0 0 30px rgba(255, 4, 4, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button:active {
    transform: translateY(0);
    box-shadow: 
        0 2px 10px rgba(255, 4, 4, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button.danger {
    background: linear-gradient(135deg, #990202 0%, #660101 100%);
}

button.danger:hover {
    background: linear-gradient(135deg, #cc0303 0%, #990202 100%);
    box-shadow: 
        0 6px 25px rgba(153, 2, 2, 0.5),
        0 0 30px rgba(153, 2, 2, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

button.success {
    background: linear-gradient(135deg, #ff0404 0%, #cc0303 100%);
}

button.success:hover {
    background: linear-gradient(135deg, #ff1a1a 0%, #ff0404 100%);
}

.btn-small {
    padding: 10px 18px;
    font-size: 14px;
    position: relative !important;
    z-index: 100 !important; /* เพิ่ม z-index สูงมาก */
    cursor: pointer !important;
    pointer-events: auto !important; /* บังคับให้รับคลิก */
}

.video-list {
    max-height: 650px;
    overflow-y: auto;
    padding-right: 8px;
}

.video-list::-webkit-scrollbar {
    width: 10px;
}

.video-list::-webkit-scrollbar-track {
    background: #0a0a0a;
    border-radius: 10px;
    border: 1px solid #1a1a1a;
}

.video-list::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff0404 0%, #cc0303 100%);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 4, 4, 0.5);
}

.video-list::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ff1a1a 0%, #ff0404 100%);
    box-shadow: 0 0 15px rgba(255, 4, 4, 0.7);
}

.video-card {
    background: linear-gradient(135deg, #0f0f0f 0%, #0a0a0a 100%);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 16px;
    border: 1px solid #2a2a2a;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: visible; /* เปลี่ยนจาก hidden เป็น visible */
    box-shadow:
        0 2px 10px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
    z-index: 1; /* ให้การ์ดมี z-index */
}

/* ปิดการใช้งาน pointer-events บนทุก pseudo-element */
.video-card *::before,
.video-card *::after {
    pointer-events: none !important;
}

.video-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(180deg, #ff0404 0%, #cc0303 100%);
    transform: scaleY(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 4, 4, 0.5);
    pointer-events: none; /* ไม่บดบังการคลิก */
    z-index: 0; /* อยู่ด้านหลัง */
}

.video-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255, 4, 4, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
    pointer-events: none; /* ไม่บดบังการคลิก */
    z-index: 0; /* อยู่ด้านหลัง */
}

.video-card:hover {
    border-color: #ff0404;
    transform: translateX(8px);
    box-shadow:
        -4px 0 20px rgba(255, 4, 4, 0.3),
        0 4px 30px rgba(255, 4, 4, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.video-card:hover::before {
    transform: scaleY(1);
}

.video-card:hover::after {
    opacity: 1;
}

/* Video Header - Layout สำหรับรูปภาพและข้อมูล */
.video-header {
    display: flex;
    gap: 15px;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.video-thumbnail {
    width: 120px;
    height: 90px;
    object-fit: cover;
    border-radius: 6px;
    border: 2px solid #333;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.video-thumbnail:hover {
    border-color: #ff0404;
    box-shadow: 0 0 15px rgba(255, 4, 4, 0.3);
}

.no-thumbnail {
    width: 120px;
    height: 90px;
    background: linear-gradient(135deg, #333 0%, #444 100%);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #999;
    border: 2px solid #333;
    flex-shrink: 0;
}

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

.video-info h3 {
    color: #ffffff;
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 1;
}

.video-description {
    color: #cccccc !important;
    font-size: 14px !important;
    margin-bottom: 10px !important;
    line-height: 1.5 !important;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
}

.video-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
}

.student {
    color: #999999;
    font-size: 13px;
    font-weight: 500;
}

.category-badge {
    font-size: 11px !important;
    padding: 4px 10px !important;
    margin: 0 !important;
}

/* Video Details */
.video-details {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 6px;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.video-url, .video-date {
    margin-bottom: 8px;
    font-size: 13px;
}

.video-url:last-child, .video-date:last-child {
    margin-bottom: 0;
}

.video-url a {
    color: #ff0404;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.video-url a:hover {
    color: #ff6666;
    text-decoration: underline;
}

.video-date {
    color: #888;
}

/* ปรับปรุง actions */
.actions {
    margin-top: 16px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    position: relative !important;
    z-index: 100 !important; /* ให้ปุ่มอยู่ด้านบนสุด */
    pointer-events: auto !important;
}

/* ปรับปรุงปุ่ม */
.btn-small {
    padding: 8px 16px;
    font-size: 13px;
    position: relative !important;
    z-index: 100 !important; /* เพิ่ม z-index สูงมาก */
    cursor: pointer !important;
    pointer-events: auto !important; /* บังคับให้รับคลิก */
    border: none;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    text-transform: none;
}

.btn-small:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(255, 4, 4, 0.3);
}

.btn-small.danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
}

.btn-small.danger:hover {
    background: linear-gradient(135deg, #e74c3c 0%, #dc3545 100%);
}

/* ปิดการ interact กับทุกอย่างใน video-card ยกเว้นปุ่มและลิงก์ */
.video-card > *:not(.actions):not(.video-details a) {
    pointer-events: none !important;
}

.video-details a {
    pointer-events: auto !important;
}

.video-card .actions,
.video-card .actions *,
.video-card button {
    pointer-events: auto !important;
}

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin: 25px 0;
}

.stat-box {
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    padding: 24px;
    border-radius: 8px;
    text-align: center;
    border: 1px solid #2a2a2a;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    box-shadow: 
        0 2px 10px rgba(0, 0, 0, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.stat-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #ff0404 0%, #cc0303 100%);
    transform: scaleX(0);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(255, 4, 4, 0.5);
}

.stat-box::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at center, rgba(255, 4, 4, 0.05), transparent);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.stat-box:hover {
    transform: translateY(-6px) scale(1.02);
    box-shadow: 
        0 8px 10px rgba(255, 4, 4, 0.3),
        0 0 20px rgba(255, 4, 4, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.05);
    border-color: #ff0404;
}

.stat-box:hover::before {
    transform: scaleX(1);
}

.stat-box:hover::after {
    opacity: 1;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: #ff0404;
    margin-bottom: 6px;
    text-shadow: 
        0 0 20px rgba(255, 4, 4, 0.5),
        0 2px 4px rgba(0, 0, 0, 0.8);
    position: relative;
    z-index: 1;
}

.stat-label {
    color: #999999;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    z-index: 1;
}

.notification {
    position: fixed;
    top: 30px;
    right: 30px;
    padding: 18px 28px;
    border-radius: 8px;
    color: white;
    font-weight: 600;
    box-shadow: 
        0 8px 30px rgba(0, 0, 0, 0.6),
        0 0 40px rgba(255, 4, 4, 0.4),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 10000;
    transform: translateX(450px);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 15px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.notification::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    animation: pulse 2s infinite;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
}

@keyframes pulse {
    0%, 100% { 
        transform: scale(1); 
        opacity: 1; 
        box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
    }
    50% { 
        transform: scale(1.3); 
        opacity: 0.5; 
        box-shadow: 0 0 20px rgba(255, 255, 255, 0.8);
    }
}

.notification.show {
    transform: translateX(0) scale(1);
}

.notification.success { 
    background: linear-gradient(135deg, #ff0404 0%, #cc0303 100%); 
}
.notification.error { 
    background: linear-gradient(135deg, #990202 0%, #660101 100%); 
}
.notification.info { 
    background: linear-gradient(135deg, #ff0404 0%, #cc0303 100%); 
}
.notification.warning { 
    background: linear-gradient(135deg, #ff6b00 0%, #cc5500 100%); 
}

.json-preview {
    background: linear-gradient(135deg, #0a0a0a 0%, #000000 100%);
    color: #ffffff;
    padding: 24px;
    border-radius: 8px;
    font-family: 'Monaco', 'Menlo', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.6;
    max-height: 450px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    border: 1px solid #2a2a2a;
    box-shadow: 
        inset 0 2px 10px rgba(0, 0, 0, 0.5),
        0 4px 20px rgba(255, 4, 4, 0.1);
}

.json-preview::-webkit-scrollbar {
    width: 10px;
}

.json-preview::-webkit-scrollbar-track {
    background: #000000;
    border-radius: 10px;
    border: 1px solid #1a1a1a;
}

.json-preview::-webkit-scrollbar-thumb {
    background: linear-gradient(180deg, #ff0404 0%, #cc0303 100%);
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(255, 4, 4, 0.5);
}

.json-preview::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(180deg, #ff1a1a 0%, #ff0404 100%);
}

.toolbar {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.warning-box {
    background: linear-gradient(135deg, #2a0a0a 0%, #1a0505 100%);
    border-left: 4px solid #ff0000;
    padding: 22px 26px;
    margin: 25px 0;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(255, 107, 0, 0.3), inset 0 1px 0 rgba(255, 107, 0, 0.1);
    border: 1px solid rgba(255, 107, 0, 0.3);
}

.warning-box-content {
    display: flex;
    align-items: start;
    gap: 16px;
}

.warning-box-icon {
    font-size: 32px;
    line-height: 1;
    filter: drop-shadow(0 0 8px rgba(255, 107, 0, 0.5));
}

.warning-box-title {
    font-weight: 700;
    color: #ff9047;
    margin-bottom: 10px;
    font-size: 16px;
    text-shadow: 0 0 10px rgba(255, 144, 71, 0.5);
}

.warning-box-text {
    color: #cccccc;
    line-height: 1.7;
    font-size: 15px;
}

.warning-box-text code {
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 12px;
    border-radius: 6px;
    color: #ff0404;
    font-weight: 700;
    font-size: 14px;
    border: 1px solid rgba(255, 4, 4, 0.3);
    box-shadow: 0 0 10px rgba(255, 4, 4, 0.2);
}

.empty-state {
    text-align: center;
    color: #666666;
    padding: 40px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
    z-index: 9998;
    padding: 40px;
    overflow: auto;
}

.modal-content {
    max-width: 1000px;
    margin: 0 auto;
    background: linear-gradient(135deg, #1a1a1a 0%, #0f0f0f 100%);
    border-radius: 12px;
    padding: 40px;
    border: 1px solid #2a2a2a;
    box-shadow: 0 20px 60px rgba(255, 4, 4, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.modal-title {
    margin-bottom: 20px;
    color: #ff0404;
    text-shadow: 0 0 20px rgba(255, 4, 4, 0.5);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .grid {
        grid-template-columns: 1fr;
    }
    
    .container {
        padding: 30px 20px;
        margin: 40px 10px 0;
    }
    
    h1 {
        font-size: 32px;
    }
    
    .section {
        padding: 20px;
    }
}

@media (max-width: 768px) {
    h1 {
        font-size: 28px;
    }
    
    .subtitle {
        font-size: 15px;
    }
    
    .stats {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .notification {
        right: 10px;
        left: 10px;
        transform: translateY(-150px);
    }
    
    .notification.show {
        transform: translateY(0);
    }
}
