/* =========================================================
   Tamo Movie - Main Stylesheet
   University Project - light, sky-blue themed, responsive
   ========================================================= */

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

:root {
    --sky-light: #eaf6ff;
    --sky: #7fc8f8;
    --blue-med: #2f9be0;
    --blue-dark: #1565a8;
    --text-dark: #2c3440;
    --white: #ffffff;
    --heart-red: #e0473e;
}

html, body {
    max-width: 100%;
    overflow-x: hidden; /* prevent page-level horizontal scroll; carousels scroll internally */
}

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background-color: var(--white);
    color: var(--text-dark);
    line-height: 1.6;
    padding-bottom: 70px; /* space so fixed bottom nav never covers content, on both mobile and desktop */
}

/* Persian text renders more clearly with Tahoma as the primary font */
body.rtl-mode {
    font-family: Tahoma, 'Segoe UI', Arial, sans-serif;
}

.container {
    width: 92%;
    max-width: 1150px;
    margin: 0 auto;
}

a {
    text-decoration: none;
    color: inherit;
}

/* ============ TOP BAR ============ */
.top-bar {
    background-color: var(--blue-dark);
    padding: 10px 0;
    position: sticky;
    top: 0;
    z-index: 200;
}

.top-bar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--white);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 4px 8px;
}

/* ============ LANGUAGE SWITCHER ============ */
.lang-switch {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
}

.lang-switch a {
    color: #bcdff5;
    padding: 2px 4px;
}

.lang-switch a.active {
    color: var(--white);
    font-weight: bold;
}

.lang-switch span {
    color: #4a7ba6;
}

.lang-switch-mobile {
    justify-content: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 1px solid #dceefb;
}

.lang-switch-mobile a {
    color: var(--text-dark);
    opacity: 0.6;
}

.lang-switch-mobile a.active {
    color: var(--blue-dark);
    opacity: 1;
}

/* ============ LOGO SECTION ============ */
.logo-section {
    text-align: center;
    padding: 18px 0;
    background: linear-gradient(180deg, var(--sky-light) 0%, var(--white) 100%);
}

.site-logo {
    width: 260px;
    max-width: 80%;
    height: auto;
}

/* ============ SLIDE-OUT MENU ============ */
.side-menu {
    position: fixed;
    top: 0;
    right: -280px;
    width: 260px;
    height: 100%;
    background-color: var(--white);
    box-shadow: -2px 0 12px rgba(0,0,0,0.15);
    z-index: 400;
    transition: right 0.3s ease;
    padding: 20px;
    overflow-y: auto;
}

.side-menu.open {
    right: 0;
}

/* In RTL mode the menu slides out from the left instead of the right */
body.rtl-mode .side-menu {
    right: auto;
    left: -280px;
    box-shadow: 2px 0 12px rgba(0,0,0,0.15);
}

body.rtl-mode .side-menu.open {
    left: 0;
}

.menu-close {
    background: none;
    border: none;
    font-size: 1.3rem;
    cursor: pointer;
    margin-bottom: 20px;
    color: var(--text-dark);
}

.side-menu-links {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.side-menu-links a {
    padding: 12px 10px;
    border-radius: 6px;
    font-weight: 500;
    color: var(--text-dark);
}

.side-menu-links a:hover {
    background-color: var(--sky-light);
    color: var(--blue-dark);
}

.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.35);
    z-index: 300;
    display: none;
}

.menu-overlay.open {
    display: block;
}

/* ============ HERO (Home page) ============ */
.hero {
    text-align: center;
    padding: 30px 20px 10px 20px;
}

.hero h1 {
    font-size: 1.8rem;
    margin-bottom: 6px;
    color: var(--blue-dark);
}

.hero p {
    color: #667;
}

/* ============ SECTION TITLES ============ */
.section-title {
    margin: 30px 0 12px 0;
    font-size: 1.3rem;
    color: var(--blue-dark);
    border-left: 4px solid var(--blue-med);
    padding-left: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.section-title .view-more-link {
    font-size: 0.9rem;
    font-weight: normal;
    color: var(--blue-med);
    border: none;
    padding-left: 0;
}

/* Mirror the accent border for RTL so it stays on the "start" side */
body.rtl-mode .section-title {
    border-left: none;
    border-right: 4px solid var(--blue-med);
    padding-left: 0;
    padding-right: 10px;
}

/* ============ HORIZONTAL SCROLL ROWS ============ */
.row-wrapper {
    position: relative;
    margin-bottom: 20px;
}

.movie-row {
    display: flex;
    gap: 14px;
    overflow-x: auto;
    scroll-behavior: smooth;
    padding: 6px 2px 14px 2px;
    -webkit-overflow-scrolling: touch;
}

.movie-row::-webkit-scrollbar {
    height: 6px;
}

.movie-row::-webkit-scrollbar-thumb {
    background-color: var(--sky);
    border-radius: 10px;
}

.row-scroll-btn {
    display: none;
}

@media (min-width: 769px) {
    .row-scroll-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        width: 34px;
        height: 34px;
        border-radius: 50%;
        background-color: var(--blue-med);
        color: var(--white);
        border: none;
        cursor: pointer;
        z-index: 5;
        opacity: 0.9;
    }
    .row-scroll-left { left: -14px; }
    .row-scroll-right { right: -14px; }
}

/* ============ MOVIE / SERIES GRID (used on Movies, Series, Category, Search pages) ============ */
.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 18px;
    padding: 16px 0 30px 0;
}

/* ============ MOVIE CARD ============ */
.movie-card {
    background-color: var(--white);
    border: 1px solid #dceefb;
    border-radius: 10px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    flex: 0 0 160px;
    scroll-snap-align: start;
}

.movie-grid .movie-card {
    flex: 1 1 auto;
    width: auto;
}

.movie-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 16px rgba(47,155,224,0.2);
}

.movie-card img {
    width: 100%;
    height: 220px;
    object-fit: cover;
    background-color: var(--sky-light);
}

.movie-card-body {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.movie-card-body h3 {
    font-size: 0.95rem;
    margin-bottom: 4px;
    color: var(--text-dark);
}

.movie-meta {
    font-size: 0.8rem;
    color: #667;
    margin-bottom: 8px;
}

.type-badge {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 8px;
    border-radius: 10px;
    background-color: var(--sky-light);
    color: var(--blue-dark);
    margin-bottom: 4px;
}

.rating {
    color: #d99400;
    font-weight: bold;
}

.btn {
    display: inline-block;
    margin-top: auto;
    padding: 8px 0;
    text-align: center;
    background-color: var(--blue-med);
    color: var(--white);
    border-radius: 6px;
    font-weight: bold;
    border: none;
    cursor: pointer;
}

.btn:hover {
    background-color: var(--blue-dark);
}

.btn-outline {
    background-color: var(--white);
    color: var(--blue-med);
    border: 1px solid var(--blue-med);
}

/* ============ CATEGORY FILTER (category.php) ============ */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 20px 0;
}

.filter-bar a {
    padding: 6px 14px;
    background-color: var(--sky-light);
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--blue-dark);
}

.filter-bar a.active,
.filter-bar a:hover {
    background-color: var(--blue-med);
    color: var(--white);
}

.type-tabs {
    display: flex;
    gap: 10px;
    margin: 10px 0 20px 0;
}

.type-tabs a {
    padding: 6px 16px;
    border-radius: 20px;
    background-color: var(--white);
    border: 1px solid var(--blue-med);
    color: var(--blue-med);
    font-size: 0.9rem;
}

.type-tabs a.active {
    background-color: var(--blue-dark);
    border-color: var(--blue-dark);
    color: var(--white);
}

/* ============ MOVIE / SERIES DETAILS PAGE ============ */
.movie-details {
    display: flex;
    gap: 30px;
    flex-wrap: wrap;
    padding: 30px 0;
}

.movie-details img {
    width: 300px;
    max-width: 100%;
    border-radius: 10px;
    object-fit: cover;
}

.movie-details-info {
    flex: 1;
    min-width: 250px;
}

.movie-details-info h1 {
    color: var(--blue-dark);
    margin-bottom: 4px;
}

.movie-details-info .type-badge {
    margin-bottom: 14px;
}

.favorite-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 20px;
    border-radius: 6px;
    border: 1px solid var(--heart-red);
    background-color: var(--white);
    color: var(--heart-red);
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 20px;
}

.favorite-btn.active {
    background-color: var(--heart-red);
    color: var(--white);
}

.info-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.info-table td {
    padding: 6px 8px;
    border-bottom: 1px solid var(--sky-light);
    vertical-align: top;
}

.info-table td:first-child {
    font-weight: bold;
    color: var(--blue-dark);
    width: 160px;
}

/* ============ FORMS (Contact, Login, Register) ============ */
.contact-form,
.about-content,
.auth-form {
    max-width: 500px;
    margin: 30px auto;
    background-color: var(--sky-light);
    padding: 25px;
    border-radius: 10px;
}

.contact-form label,
.auth-form label {
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
    font-weight: 500;
    color: var(--blue-dark);
}

.contact-form input,
.contact-form textarea,
.auth-form input {
    width: 100%;
    padding: 10px;
    border-radius: 6px;
    border: 1px solid #bcdff5;
    background-color: var(--white);
    color: var(--text-dark);
    font-family: inherit;
}

.contact-form textarea {
    min-height: 120px;
    resize: vertical;
}

.contact-form button,
.auth-form button {
    margin-top: 20px;
    padding: 10px 25px;
    background-color: var(--blue-med);
    color: var(--white);
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
}

.contact-form button:hover,
.auth-form button:hover {
    background-color: var(--blue-dark);
}

.auth-form p.switch-link {
    margin-top: 15px;
    text-align: center;
}

.auth-form p.switch-link a {
    color: var(--blue-med);
    font-weight: bold;
}

.alert-success {
    background-color: #dff5e3;
    color: #256b32;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
}

.alert-error {
    background-color: #fde3e1;
    color: #a3352c;
    padding: 12px;
    border-radius: 6px;
    margin-bottom: 15px;
}

/* ============ FAVORITES PAGE ============ */
.remove-fav-form {
    margin-top: 8px;
}

.remove-fav-form button {
    width: 100%;
    padding: 6px 0;
    background-color: var(--white);
    color: var(--heart-red);
    border: 1px solid var(--heart-red);
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
}

.remove-fav-form button:hover {
    background-color: var(--heart-red);
    color: var(--white);
}

/* ============ FOOTER ============ */
.site-footer {
    text-align: center;
    padding: 25px 0 20px 0;
    margin-top: 30px;
    background-color: var(--sky-light);
    color: #667;
    font-size: 0.85rem;
}

/* ============ BOTTOM NAVIGATION (fixed) ============ */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--white);
    border-top: 1px solid #dceefb;
    display: flex;
    justify-content: space-around;
    padding: 6px 0;
    z-index: 250;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.06);
}

.bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 0.7rem;
    color: #667;
    padding: 4px 8px;
}

.bottom-nav a.active {
    color: var(--blue-dark);
    font-weight: bold;
}

.bn-icon {
    font-size: 1.2rem;
}

/* ============ NO RESULTS MESSAGE ============ */
.no-results {
    text-align: center;
    padding: 40px 0;
    color: #889;
}

/* ============ RESPONSIVE ============ */
@media (min-width: 769px) {
    /* Bottom nav stays visible on desktop too - just made
       narrower and centered so it looks clean on wide screens */
    .bottom-nav {
        left: 50%;
        width: 320px;
        transform: translateX(-50%);
        border-radius: 12px 12px 0 0;
        border-left: 1px solid #dceefb;
        border-right: 1px solid #dceefb;
    }
}
