/* === Reset & Base === */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg: #0f0f0f;
    --card-bg: #1a1a1a;
    --card-hover: #222;
    --text: #e0e0e0;
    --text-dim: #888;
    --accent: #ff4757;
    --accent-hover: #ff6b7a;
    --border: #2a2a2a;
    --overlay: rgba(0,0,0,0.85);
    --radius: 12px;
    --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans SC', sans-serif;
    line-height: 1.6;
    min-height: 100vh;
}

/* === Header === */
header {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-bottom: 1px solid var(--border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-inner {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

header h1 {
    font-size: 1.6rem;
    color: #fff;
    white-space: nowrap;
}

.search-box input {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 24px;
    padding: 10px 20px;
    color: #fff;
    font-size: 0.95rem;
    width: 280px;
    max-width: 100%;
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.search-box input:focus {
    border-color: var(--accent);
    background: rgba(255,255,255,0.12);
}

.search-box input::placeholder { color: #666; }

/* === Video Grid === */
main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
}

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

/* === Card === */
.video-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
    border: 1px solid var(--border);
}

.video-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow);
    background: var(--card-hover);
}

.video-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #111;
    overflow: hidden;
}

.video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

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

.play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 56px;
    height: 56px;
    background: rgba(255,71,87,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.video-card:hover .play-icon { opacity: 1; }

.play-icon::after {
    content: '';
    display: block;
    width: 0;
    height: 0;
    border-style: solid;
    border-width: 10px 0 10px 18px;
    border-color: transparent transparent transparent #fff;
    margin-left: 3px;
}

.video-duration {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0,0,0,0.8);
    color: #fff;
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 4px;
}

.video-info {
    padding: 14px 16px;
}

.video-info h3 {
    font-size: 0.95rem;
    color: #fff;
    margin-bottom: 6px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.video-info .meta {
    font-size: 0.82rem;
    color: var(--text-dim);
    display: flex;
    gap: 12px;
}

/* === Pagination === */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: 36px;
    padding-bottom: 40px;
}

.pagination button {
    background: var(--card-bg);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.pagination button:hover:not(:disabled) {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #fff;
}

.pagination .page-info {
    color: var(--text-dim);
    font-size: 0.85rem;
    margin: 0 12px;
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: var(--overlay);
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.open { display: flex; }

.modal-content {
    background: #1a1a1a;
    border-radius: 16px;
    width: 100%;
    max-width: 960px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 8px 48px rgba(0,0,0,0.6);
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 36px;
    height: 36px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    z-index: 10;
    transition: background 0.2s;
}

.modal-close:hover { background: var(--accent); }

.modal-video {
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.modal-video video, .modal-video iframe {
    width: 100%;
    height: 100%;
    border: none;
}

.modal-title {
    padding: 16px 20px 8px;
    font-size: 1.2rem;
    color: #fff;
}

.modal-desc {
    padding: 0 20px 20px;
    font-size: 0.9rem;
    color: var(--text-dim);
}

/* === Empty === */
.empty-msg {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-dim);
    font-size: 1.1rem;
}

/* === Responsive === */
@media (max-width: 768px) {
    .header-inner { flex-direction: column; }
    .search-box input { width: 100%; }
    .video-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
    main { padding: 16px; }
}
