* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Tajawal', 'Cairo', sans-serif;
}

:root {
    --bg-color: #121418;
    --second-bg: #1c1e24;
    --accent-color: #00bcd4; /* WeCima Cyan/Blue */
    --hover-accent: #0097a7;
    --text-primary: #ffffff;
    --text-secondary: #90949c;
    --card-bg: #22252b;
    --ribbon-quality: #00bcd4;
    --ribbon-year: #fbc02d;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    direction: rtl;
}

a {
    text-decoration: none;
    color: inherit;
    transition: all 0.3s ease;
}

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

.ad-space {
    width: 100%;
    min-height: 90px;
    max-width: 100%;
    overflow: hidden;
    background: #2a2d34;
    border: 1px dashed #555;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--text-secondary);
    margin: 20px 0;
    text-align: center;
    font-size: 14px;
    border-radius: 8px;
}
.ad-space iframe, .ad-space img, .ad-space script {
    max-width: 100% !important;
    height: auto;
}

/* Header */
.top-header {
    background-color: var(--second-bg);
    padding: 15px 0;
    border-bottom: 1px solid #2a2d34;
}

.top-header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

.logo {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
}

.logo span {
    color: var(--accent-color);
}

.search-box {
    flex-grow: 1;
    max-width: 600px;
    position: relative;
    display: flex;
}

.search-box input {
    width: 100%;
    padding: 12px 20px;
    border-radius: 30px;
    border: none;
    background: #0d0f12;
    color: white;
    outline: none;
}

.search-box button {
    position: absolute;
    left: 5px;
    top: 5px;
    bottom: 5px;
    background: var(--accent-color);
    color: white;
    border: none;
    width: 40px;
    border-radius: 50%;
    cursor: pointer;
    transition: 0.3s;
}

.search-box button:hover {
    background: var(--hover-accent);
}

.user-login {
    background: #2a2d34;
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 14px;
}

.user-login:hover {
    background: var(--accent-color);
    color: white;
}

/* Main Navbar */
.main-nav {
    background-color: var(--bg-color);
    border-bottom: 2px solid var(--accent-color);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    position: sticky;
    top: 0;
    z-index: 100;
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 15px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 5px;
}
.main-nav ul::-webkit-scrollbar {
    height: 4px;
}
.main-nav ul::-webkit-scrollbar-thumb {
    background: var(--accent-color);
    border-radius: 4px;
}

.main-nav ul li a {
    display: block;
    padding: 15px 10px;
    font-weight: 600;
    font-size: 15px;
    border-bottom: 3px solid transparent;
}

.main-nav ul li a:hover, .main-nav ul li a.active {
    color: var(--accent-color);
    border-bottom: 3px solid var(--accent-color);
}

/* Main Content Layout */
.main-layout {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.content-area {
    flex: 3;
    min-width: 0;
}

.sidebar {
    flex: 1;
    min-width: 300px;
}

/* Section Title */
.section-title {
    background: var(--second-bg);
    padding: 15px;
    border-right: 4px solid var(--accent-color);
    border-radius: 4px;
    margin-bottom: 20px;
    font-size: 18px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Movies Grid - The WeCima look */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
}

.grid-item {
    background: var(--card-bg);
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    transition: 0.3s;
    display: flex;
    flex-direction: column;
}

.grid-item .poster {
    position: relative;
    height: 270px;
    overflow: hidden;
}

.grid-item .poster img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: 0.3s;
}

/* Hover Effect */
.grid-item:hover .poster img {
    transform: scale(1.1);
    filter: brightness(0.6);
}

.grid-item .play-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    font-size: 40px;
    color: white;
    opacity: 0;
    transition: 0.3s;
    z-index: 2;
}

.grid-item:hover .play-icon {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    color: var(--accent-color);
}

/* Ribbons */
.ribbon-quality {
    position: absolute;
    top: 10px;
    right: -5px;
    background: var(--ribbon-quality);
    color: #fff;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 3px 0 0 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    z-index: 1;
}

.ribbon-quality::after {
    content: '';
    position: absolute;
    bottom: -5px;
    right: 0;
    border-width: 5px 5px 0 0;
    border-style: solid;
    border-color: #008394 transparent transparent transparent;
}

.ribbon-year {
    position: absolute;
    bottom: 5px;
    right: 5px;
    background: rgba(0,0,0,0.7);
    color: var(--ribbon-year);
    padding: 2px 8px;
    font-size: 12px;
    font-weight: bold;
    border-radius: 3px;
    z-index: 1;
}

/* Titles */
.title-box {
    padding: 10px;
    text-align: center;
    flex-grow: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.title-box h3 {
    font-size: 14px;
    font-weight: normal;
    line-height: 1.4;
    color: #e4e6ea;
}

.grid-item:hover .title-box h3 {
    color: var(--accent-color);
}

/* Category Badges WeCima Style */
.cat-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
}

.cat-links a {
    background: #2a2d34;
    padding: 10px 15px;
    border-radius: 20px;
    font-size: 14px;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.cat-links a:hover {
    background: var(--accent-color);
}

/* Footer */
footer {
    background: var(--second-bg);
    margin-top: 50px;
    padding: 30px 0;
    text-align: center;
    border-top: 1px solid #2a2d34;
}

.footer-links {
    margin: 20px 0;
}

.footer-links a {
    color: var(--text-secondary);
    margin: 0 10px;
    font-size: 14px;
}

.footer-links a:hover {
    color: var(--accent-color);
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 30px;
}
.pagination a {
    background: var(--second-bg);
    padding: 10px 15px;
    border-radius: 4px;
    color: var(--text-primary);
    font-weight: bold;
}
.pagination a:hover, .pagination a.active {
    background: var(--accent-color);
}

/* Movie Open Modal or Page structure mock */
.watch-page {
    background: var(--second-bg);
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 20px;
}

.watch-hero {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
}

@media(max-width: 768px) {
    .watch-hero { flex-direction: column; align-items: center; text-align: center; }
    .watch-poster { margin: 0 auto; width: 60%; }
    .watch-info ul { text-align: right; }
    .sidebar { display: none; }
    .top-header .container { flex-direction: column; text-align: center; }
    .search-box { width: 100%; }
    .grid-container { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .grid-item .poster { height: 230px; }
    .play-icon { font-size: 30px; }
    .section-title { font-size: 15px; }
}

.watch-poster {
    width: 200px;
    border-radius: 6px;
}

.watch-info h1 {
    font-size: 24px;
    margin-bottom: 15px;
    color: var(--accent-color);
}

.watch-info ul {
    list-style: none;
    line-height: 2;
    color: #ccc;
}

.watch-info ul li span {
    color: var(--accent-color);
    font-weight: bold;
    margin-left: 10px;
}

.watch-servers {
    margin-top: 20px;
}

.watch-servers .btn {
    display: inline-block;
    padding: 10px 20px;
    background: #2a2d34;
    color: white;
    margin: 5px;
    border-radius: 4px;
}

.watch-servers .btn:hover {
    background: var(--accent-color);
}

.btn-primary { background: var(--accent-color) !important; }

/* Back to Top Button */
#backToTop {
    display: none; /* Hidden by default */
    position: fixed;
    bottom: 120px;
    right: 20px;
    z-index: 998;
    border: none;
    outline: none;
    background-color: var(--accent-color);
    color: white;
    cursor: pointer;
    padding: 12px;
    border-radius: 50%;
    font-size: 18px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.5);
    transition: 0.3s background-color;
}

#backToTop:hover {
    background-color: var(--hover-accent);
}

/* Sticky Bottom Ad */
.sticky-ad {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.9);
    z-index: 9999;
    text-align: center;
    border-top: 2px solid var(--accent-color);
    padding: 10px 0;
    display: flex;
    justify-content: center;
}
.sticky-ad .close-ad {
    position: absolute;
    top: -25px;
    right: 15px;
    background: var(--accent-color);
    color: #fff;
    padding: 2px 12px;
    border-radius: 4px 4px 0 0;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
}
.sticky-ad iframe, .sticky-ad img { max-width: 100% !important; }

/* Responsive Display Logic */
.desktop-ad {
    display: flex;
}
.mobile-ad {
    display: none;
}

@media(max-width: 768px) {
    .desktop-ad {
        display: none !important;
    }
    .mobile-ad {
        display: flex !important;
    }
}
