:root {
    --primary-color: #f5b50a;
    --bg-color: #0f0f0f;
    --card-bg: #1a1a1a;
    --text-main: #ffffff;
    --text-secondary: #cccccc;
    --badge-hd: #46d369;
    --badge-cam: #e50914
}

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

body {
    font-family: 'Kanit', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6
}

a {
    text-decoration: none;
    color: var(--text-main);
    transition: color .3s
}

a:hover {
    color: var(--primary-color)
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px
}

header {
    background-color: #000;
    padding: 15px 0;
    border-bottom: 2px solid var(--primary-color);
    position: sticky;
    top: 0;
    z-index: 1000
}

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

.logo {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    text-transform: uppercase
}

.main-nav ul {
    display: flex;
    list-style: none;
    gap: 20px
}

.main-nav a {
    font-weight: 500
}

.search-box input {
    padding: 8px 15px;
    border-radius: 20px;
    border: 1px solid #333;
    background: #222;
    color: #fff;
    outline: 0
}

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
    margin: 30px 0
}

@media (min-width: 1024px) {
    .movie-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

.movie-card {
    background: var(--card-bg);
    border-radius: 8px;
    overflow: hidden;
    transition: transform .3s;
    position: relative;
    contain: content
}

.movie-card:hover {
    transform: translateY(-5px)
}

.movie-poster {
    position: relative;
    aspect-ratio: 2/3;
    overflow: hidden;
    background: #222;
    /* Skeleton Loading Effect */
    background: linear-gradient(90deg, #222 25%, #333 50%, #222 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.movie-poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: relative;
    /* Ensure image is above background */
    z-index: 1;
    display: block;
    /* Remove bottom space */
}

.movie-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    z-index: 2;
}

.movie-rating-badge {
    position: absolute;
    top: 10px;
    left: 10px;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 700;
    color: #fff;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid gold;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 4px;
}

.badge-hd {
    background-color: var(--badge-hd)
}

.badge-cam {
    background-color: var(--badge-cam)
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, .5);
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity .3s;
    z-index: 1;
}

.movie-card:hover .play-overlay {
    opacity: 1
}

.play-icon {
    width: 50px;
    height: 50px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #000;
    font-size: 24px
}

.movie-info {
    padding: 10px
}

.movie-title {
    font-size: 15px;
    font-weight: 400;
    line-height: 1.4;
    margin-bottom: 5px;
    color: #ddd;
    text-align: center;
}

.movie-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: none;
    /* Hide meta since we moved rating and removed year */
}

.pagination {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 40px 0
}

.pagination a {
    padding: 8px 16px;
    background: var(--card-bg);
    border-radius: 4px
}

.pagination a.active,
.pagination a:hover {
    background: var(--primary-color);
    color: #000
}

footer {
    background: #000;
    padding: 40px 0;
    margin-top: 50px;
    border-top: 1px solid #333;
    text-align: center;
    color: var(--text-secondary)
}

.player-container {
    background: #000;
    margin-bottom: 20px
}

.video-wrapper {
    position: relative;
    padding-bottom: 56.25%;
    height: 0;
    background: #000
}

.video-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%
}

.server-list {
    display: flex;
    gap: 10px;
    margin: 20px 0;
    flex-wrap: wrap
}

.server-btn {
    padding: 10px 20px;
    background: var(--card-bg);
    border: none;
    color: #fff;
    cursor: pointer;
    border-radius: 4px
}

.server-btn.active {
    background: var(--primary-color);
    color: #000
}

.movie-details {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 30px;
    margin-top: 30px
}

.movie-details-poster img {
    width: 100%;
    border-radius: 8px;
    aspect-ratio: 2/3;
    object-fit: cover
}

@media (max-width:768px) {
    .header-content {
        flex-direction: column;
        gap: 15px
    }

    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center
    }

    .movie-grid {
        grid-template-columns: repeat(2, 1fr)
    }

    .movie-details {
        grid-template-columns: 1fr
    }

    .movie-details-poster {
        max-width: 200px;
        margin: 0 auto
    }
}

/* Sidebar Layout */
.home-container {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 30px;
    margin-top: 20px;
}

.sidebar-widget {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.widget-title {
    font-size: 18px;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--primary-color);
    color: var(--primary-color);
}

.widget-list {
    list-style: none;
    padding: 0;
}

.widget-list li {
    border-bottom: 1px solid #333;
}

.widget-list li:last-child {
    border-bottom: none;
}

.widget-list a {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    color: var(--text-secondary);
    transition: all 0.3s;
}

.widget-list a:hover {
    color: var(--primary-color);
    padding-left: 5px;
}

.widget-list .count {
    background: #333;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 12px;
}

.year-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 10px;
}

.year-tag {
    background: #333;
    text-align: center;
    padding: 5px;
    border-radius: 4px;
    font-size: 14px;
    color: #fff;
    transition: background 0.3s;
}

.year-tag:hover {
    background: var(--primary-color);
    color: #000;
}

.tag-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tag-item {
    background: #222;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 13px;
    color: #aaa;
    border: 1px solid #333;
    transition: all 0.3s;
}

.tag-item:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

/* Responsive Sidebar */
@media (max-width: 768px) {
    .header-content {
        flex-direction: column;
        gap: 15px;
    }

    .main-nav ul {
        flex-wrap: wrap;
        justify-content: center;
    }

    .movie-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .movie-details {
        grid-template-columns: 1fr;
    }

    .movie-details-poster {
        max-width: 200px;
        margin: 0 auto;
    }
}