/* =======================================
   1. CSS VARIABLES & BASE STYLES
   ======================================= */

:root {
    /* Dark Theme (Default) */
    --bg-primary: #0d1117;
    --bg-secondary: #161b22;
    --text-color: #f5f5f5;
    --accent-color: #1f6feb;
    --border-color: #30363d;
    --shadow-color: rgba(0, 0, 0, 0.5);
    --input-bg: #21262d;
    --glass-blur: blur(10px);
}

/* Light Mode Variables */
body.light-mode {
    --bg-primary: #ffffff;
    --bg-secondary: #f0f0f0;
    --text-color: #1a1a1a;
    --accent-color: #007bff;
    --border-color: #cccccc;
    --shadow-color: rgba(0, 0, 0, 0.1);
    --input-bg: #e8e8e8;
}

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

body {
    font-family: 'Poppins', sans-serif;
    background: var(--bg-primary);
    color: var(--text-color);
    transition: background 0.3s, color 0.3s;
    min-height: 100vh;
}

h1, h2 {
    font-weight: 700;
    margin-bottom: 0.5em;
}

h2 {
    font-size: 1.5rem;
    padding-left: 10px;
    margin-top: 2rem;
}

main {
    padding-top: 80px;
}

.content-sections {
    padding: 20px;
    max-width: 1400px;
    margin: 0 auto;
}

/* =======================================
   2. HEADER & NAVIGATION STYLES
   ======================================= */

.sticky-nav {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    z-index: 1000;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    box-shadow: 0 2px 5px var(--shadow-color);
}

.logo strong {
    font-size: 1.8rem;
    font-weight: 900;
    color: var(--accent-color);
    letter-spacing: -1px;
}

.icon-button {
    background: none;
    border: none;
    color: var(--text-color);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 10px;
    transition: color 0.2s;
}

.icon-button:hover {
    color: var(--accent-color);
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* =======================================
   3. SEARCH BAR STYLES
   ======================================= */

.search-section {
    padding: 20px;
    max-width: 800px;
    margin: 20px auto;
    position: relative;
}

#search-form {
    display: flex;
    background: var(--input-bg);
    border-radius: 8px;
    border: 1px solid var(--border-color);
    overflow: hidden;
}

#search-input {
    flex-grow: 1;
    padding: 12px 15px;
    border: none;
    background: transparent;
    color: var(--text-color);
    font-size: 1rem;
    outline: none;
}

#search-input::placeholder {
    color: #888;
}

#search-form button {
    padding: 0 15px;
    border-left: 1px solid var(--border-color);
    font-size: 1rem;
}

/* =======================================
   4. MOVIE GRID & CARD STYLES
   ======================================= */

.movie-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); 
    gap: 20px;
    padding: 20px 0;
}

.movie-card {
    background: var(--bg-secondary);
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 10px var(--shadow-color);
    position: relative;
    display: flex;
    flex-direction: column;
}

.movie-card:hover {
    transform: scale(1.03);
    box-shadow: 0 8px 15px var(--shadow-color);
}

.movie-card img {
    width: 100%;
    height: auto;
    display: block;
    aspect-ratio: 2 / 3;
    object-fit: cover;
}

.card-info {
    padding: 10px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.card-info h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 5px;
    line-height: 1.2;
}

.card-info p {
    font-size: 0.8rem;
    color: #aaa;
}

.card-action-btn {
    width: 100%;
    padding: 8px;
    margin-top: 10px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s;
}

.card-action-btn:hover {
    background: #1459c7;
}

/* =======================================
   5. MODAL STYLES
   ======================================= */

.modal-overlay {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: var(--glass-blur);
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-content {
    background: var(--bg-secondary);
    border-radius: 15px;
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    padding: 30px;
    box-shadow: 0 10px 30px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 2rem;
    color: var(--text-color);
    cursor: pointer;
    line-height: 1;
}

/* =======================================
   6. RESPONSIVENESS
   ======================================= */

@media (max-width: 768px) {
    .sticky-nav {
        height: 60px;
        padding: 0 10px;
    }
    
    .logo strong {
        font-size: 1.5rem;
    }

    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 15px;
    }

    h2 {
        font-size: 1.3rem;
    }
    
    .modal-content {
        width: 100%;
        margin: 0 10px;
    }
}

@media (max-width: 480px) {
    .movie-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    }
}

/* =======================================
   9. SIDE MENU (UPDATED FULL VERSION)
   ======================================= */

.side-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--bg-secondary);
    color: var(--text-color);
    z-index: 2500;
    transform: translateX(-100%);
    transition: transform 0.4s ease;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 4px 0 15px rgba(0, 0, 0, 0.5);
}

.side-menu-overlay.active {
    transform: translateX(0);
}

.side-menu-content {
    padding: 2rem 1.5rem;
}

.side-menu-overlay::-webkit-scrollbar {
    width: 6px;
}

.side-menu-overlay::-webkit-scrollbar-thumb {
    background: #444;
    border-radius: 3px;
}

.side-menu-overlay::-webkit-scrollbar-thumb:hover {
    background: #666;
}

.side-menu-content h2 {
    margin-top: 0;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
    margin-bottom: 20px;
}

.side-menu-content ul {
    list-style: none;
    margin: 1.5rem 0;
    padding: 0;
}

.side-menu-content li a {
    display: block;
    color: var(--text-color);
    padding: 0.75rem 1rem;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.2s ease;
}

.side-menu-content li a:hover {
    background-color: var(--accent-color);
    color: #fff;
    padding-left: 1.3rem;
}

/* =======================================
   10. PAGINATION & SEARCH SUGGEST
   ======================================= */

.pagination-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    margin: 30px 0;
}

#current-page-display {
    font-size: 1.1rem;
    font-weight: 600;
}

#search-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    z-index: 500;
    max-height: 250px;
    overflow-y: auto;
}

.suggestion-item {
    padding: 10px 15px;
    cursor: pointer;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.1s;
}

.suggestion-item:hover {
    background: var(--input-bg);
}

/* =======================================
   11. FOOTER STYLES
   ======================================= */

footer {
    width: 100%;
    background: var(--bg-secondary);
    color: #999; /* Light gray text */
    padding: 20px 0;
    font-size: 0.85rem;
    border-top: 1px solid var(--border-color);
    text-align: center;
}

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

.footer-links a {
    color: #999;
    text-decoration: none;
    margin-left: 15px;
    transition: color 0.2s;
}

.footer-links a:hover {
    color: var(--text-color); /* Brighten on hover */
}

.api-attribution {
    margin-top: 15px;
    padding-top: 10px;
    border-top: 1px dashed var(--border-color);
    font-size: 0.75rem;
}

.api-attribution a {
    color: var(--accent-color);
    text-decoration: none;
}

/* Mobile adjustments */
@media (max-width: 600px) {
    .footer-content {
        flex-direction: column;
    }
    .footer-links {
        margin-top: 10px;
    }
    .footer-links a {
        margin: 0 5px;
    }
}