/* Base styling for the Steam CMS */
* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #1d1e22;
    color: #d1d1d1;
    line-height: 1.6;
}

/* Header flex layout: align logo, navigation and user controls nicely */
/*
 * The site header now contains a top bar with logo, search and user controls,
 * followed by the navigation menu. Adjust the container to stack elements
 * vertically and style the header-top and right-controls for flexible layout.
 */
.site-header .container {
    display: flex;
    flex-direction: column;
}

/* Top bar within header: holds the logo and the right-side controls */
.header-top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

/* Right controls (search + user nav) */
.right-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* Search form within right-controls: override margin and spacing */
.right-controls .search-form {
    margin: 0;
}

/* User navigation (login/register or greeting/admin). Display links inline */
.user-nav {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.95em;
}
.user-nav span {
    color: #cfd2d6;
    font-weight: 500;
}
.user-nav a {
    color: #aeb4ff;
    font-weight: 600;
    text-decoration: none;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}
.user-nav a:hover {
    background: #4e54c8;
    color: #fff;
    text-decoration: none;
}

/*
 * Generic action button used for login, registration, admin actions and other calls to action.
 * These styles ensure a consistent look across the site.
 */
.btn-action {
    display: inline-block;
    padding: 6px 12px;
    background: #4e54c8;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
    font-weight: 500;
    margin-left: 8px;
    transition: background 0.2s;
}
.btn-action:hover {
    background: #565cce;
    color: #fff;
}

/*
 * Standalone search form in header. The form uses a flexible layout so it
 * doesn’t interfere with navigation or user controls. On mobile the form
 * spans the full width of the header.
 */
.search-form {
    display: flex;
    align-items: center;
    margin-left: auto;
    gap: 6px;
}
.search-form input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #1e1f24;
    color: #ddd;
}
.search-form button {
    padding: 6px 12px;
    background: #4e54c8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.search-form button:hover {
    background: #565cce;
}
@media (max-width: 768px) {
    /* On small screens, stack the top controls and navigation */
    .site-header .container {
        flex-direction: column;
        align-items: flex-start;
    }
    .header-top {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .right-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .user-nav {
        justify-content: flex-start;
        margin-top: 0;
    }
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* Header and navigation */
.site-header {
    background: linear-gradient(135deg, #232526 0%, #414345 100%);
    padding: 20px 0;
    border-bottom: 1px solid #292a2f;
    box-shadow: 0 2px 4px rgba(0,0,0,0.4);
}
.logo a {
    text-decoration: none;
    color: #ffffff;
    font-size: 1.8em;
    font-weight: bold;
}
.main-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-wrap: wrap;
}
.main-nav li {
    margin-right: 15px;
}
.main-nav a {
    color: #cfd2d6;
    text-decoration: none;
    padding: 6px 10px;
    border-radius: 4px;
    transition: background 0.2s;
}
.main-nav a:hover {
    background: #3a3b3f;
    color: #ffffff;
}
.admin-link a {
    color: #e9b96e;
    font-weight: bold;
}

/* Main content */
.site-main {
    padding: 20px 0;
    min-height: 80vh;
}

.game-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.game-card {
    background: #26272c;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    transition: transform 0.2s;
    /* Ensure all cards have the same height and column layout */
    display: flex;
    flex-direction: column;
    height: 100%;
}
.game-card:hover {
    transform: translateY(-4px);
}
.game-card img {
    width: 100%;
    height: 160px;
    object-fit: contain;
    object-position: center center;
    background-color: #000;
    display: block;
    margin-left: auto;
    margin-right: auto;
}
.game-card .info {
    padding: 10px;
    flex-grow: 1;
}
.game-card .info h3 {
    margin: 0 0 10px;
    font-size: 1.1em;
    color: #ffffff;
}
.game-card .info p {
    margin: 0;
    font-size: 0.9em;
    color: #bbb;
}
.game-card .info a {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 12px;
    background: #4e54c8;
    color: #fff;
    text-decoration: none;
    border-radius: 4px;
}
.game-card .info a:hover {
    background: #565cce;
}

/* Make entire card clickable */
.game-list .card-link {
    text-decoration: none;
    color: inherit;
    display: block;
}

/* Pagination styles */
.pagination {
    margin-top: 20px;
    text-align: center;
}
.pagination .page-link {
    margin: 0 5px;
    padding: 8px 14px;
    background: #3a3b3f;
    color: #ffffff;
    text-decoration: none;
    border-radius: 4px;
}
.pagination .page-link:hover {
    background: #4e54c8;
}

/* Highlight the current page number in pagination */
.pagination .current {
    background: #4e54c8;
    color: #fff;
    font-weight: bold;
    pointer-events: none;
}

/* Page info text used when showing summary instead of individual page links */
.pagination .page-info {
    margin: 0 8px;
    padding: 8px 14px;
    color: #bbb;
    display: inline-block;
}

/* DLC section on the game page */
.dlc-section {
    margin-top: 20px;
    background: #26272c;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.dlc-section h4 {
    margin-top: 0;
    color: #fff;
}
.dlc-section ul {
    list-style: none;
    padding-left: 0;
}
.dlc-section li {
    margin-bottom: 6px;
}
.dlc-section a {
    color: #aeb4ff;
    text-decoration: none;
    transition: color 0.2s;
}
.dlc-section a:hover {
    color: #fff;
}

/* Game detail page */
.game-header {
    display: flex;
    flex-wrap: wrap;
    background: #26272c;
    padding: 20px;
    border-radius: 6px;
    margin-bottom: 20px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.game-header img {
    width: 280px;
    height: 160px;
    object-fit: cover;
    margin-right: 20px;
    border-radius: 4px;
}
.game-header h2 {
    margin-top: 0;
    color: #fff;
}
.tags {
    margin: 10px 0;
}
.tags span {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: #3a3b3f;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 0.8em;
}

/* Tag links within game header */
.tags a.tag-link {
    display: inline-block;
    margin-right: 8px;
    margin-bottom: 6px;
    padding: 4px 8px;
    background: #3a3b3f;
    color: #e0e0e0;
    border-radius: 4px;
    font-size: 0.8em;
    text-decoration: none;
    transition: background 0.2s;
}
.tags a.tag-link:hover {
    background: #4e54c8;
    color: #fff;
}

.game-desc {
    background: #26272c;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Comments */
/* Comments module */
.comments-section {
    margin-top: 30px;
    background: #26272c;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.comments-section h3 {
    color: #fff;
}
.comment {
    background: #303139;
    padding: 15px;
    border-radius: 4px;
    margin-bottom: 10px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.4);
}
.comment .author {
    font-weight: bold;
    color: #c4c7cb;
}
.comment .timestamp {
    font-size: 0.8em;
    color: #888;
    margin-left: 6px;
}
.comment-form {
    margin-top: 20px;
}
.comment-form input[type="text"],
.comment-form textarea {
    width: 100%;
    padding: 8px;
    margin-bottom: 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #1e1f24;
    color: #ddd;
}
.comment-form button {
    padding: 8px 14px;
    background: #4e54c8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.comment-form button:hover {
    background: #565cce;
}

/* Authentication forms container */
.auth-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 40px;
    background: #26272c;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    max-width: 380px;
    margin-left: auto;
    margin-right: auto;
}
.theme-light .auth-container {
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

/* Media gallery */
.media-section {
    margin-top: 30px;
    background: #26272c;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.media-section h3 {
    margin-top: 0;
    color: #fff;
}
.media-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}
.screenshot-thumb img {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.2s;
}
.screenshot-thumb img:hover {
    transform: scale(1.05);
}
.video-container {
    flex: 1 1 300px;
    max-width: 480px;
    margin-top: 10px;
}
.video-container video {
    width: 100%;
    border-radius: 4px;
}

/* Similar games section */
.similar-section {
    margin-top: 30px;
    background: #26272c;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.similar-section h3 {
    margin-top: 0;
    color: #fff;
}
.similar-games {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .game-header img {
        width: 100%;
        height: auto;
        margin-right: 0;
        margin-bottom: 10px;
    }
    .game-list {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
    .media-grid {
        flex-direction: column;
    }
    .screenshot-thumb img {
        width: 100%;
        height: auto;
    }
    .video-container {
        max-width: 100%;
    }
    .similar-games {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    }
}


/* Admin styles */
.admin-container {
    background: #26272c;
    padding: 20px;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}
.admin-container h2 {
    margin-top: 0;
    color: #fff;
}
.admin-container ul {
    list-style: none;
    margin: 0;
    padding: 0;
}
/* Display admin dashboard links inline with spacing */
.admin-container ul li {
    display: inline-block;
    margin-right: 10px;
    margin-bottom: 10px;
}
.admin-container table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}
.admin-container th, .admin-container td {
    padding: 8px 10px;
    border: 1px solid #3b3c40;
    text-align: left;
    color: #ddd;
}
.admin-container th {
    background: #31333a;
}
.admin-container a.delete {
    color: #e57373;
}
.admin-container a.delete:hover {
    text-decoration: underline;
}

/*
 * User navigation duplicate definitions removed. See the primary definition above for styling.
 */

/* -------------------------------------------------------------------------
 * Gallery tabs and modals
 * These classes style the tabbed gallery (images/videos) and modals used to
 * display full-size screenshots and streaming videos. On mobile, tabs stack
 * neatly and the gallery adapts to small widths.
 */

/* Tab menu container for media gallery */
.tab-menu {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.tab-menu .tab-button {
    background: #3a3b3f;
    color: #e0e0e0;
    border: none;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}
.tab-menu .tab-button:hover {
    background: #4e54c8;
    color: #fff;
}
.tab-menu .tab-button.active {
    background: #4e54c8;
    color: #fff;
}

/* Tab content wrappers. Hidden by default until activated */
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}

/* Video thumbnail styling */
.video-thumb img {
    width: 160px;
    height: 90px;
    object-fit: cover;
    border-radius: 4px;
    transition: transform 0.2s;
}
.video-thumb img:hover {
    transform: scale(1.05);
}

/* Modal overlay for images and videos */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}
.modal .close {
    position: absolute;
    top: 15px;
    right: 20px;
    font-size: 28px;
    color: #fff;
    cursor: pointer;
    user-select: none;
}
.modal img.modal-content,
 .modal video {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 4px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain;
    object-position: center center;
}

/* Ensure modal images are centered horizontally and vertically */
.modal img.modal-content {
    max-width: 90%;
    max-height: 80vh;
    border-radius: 4px;
    display: block;
    margin-left: auto;
    margin-right: auto;
    object-fit: contain;
    object-position: center center;
}

/* Age verification overlay */
.age-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10001;
}
.age-overlay .age-box {
    background: #26272c;
    padding: 30px;
    border-radius: 6px;
    text-align: center;
    color: #fff;
    width: 90%;
    max-width: 360px;
}
.age-overlay .age-box a {
    display: inline-block;
    margin: 10px 5px;
    padding: 8px 14px;
    background: #4e54c8;
    color: #fff;
    border-radius: 4px;
    text-decoration: none;
}
.age-overlay .age-box a:hover {
    background: #565cce;
}

/* Make admin tables responsive */
.admin-container table {
    display: block;
    width: 100%;
    overflow-x: auto;
    white-space: nowrap;
}
.admin-container table thead,
.admin-container table tbody {
    display: table;
    width: 100%;
    table-layout: fixed;
}
.admin-container th,
.admin-container td {
    white-space: nowrap;
}

@media (max-width: 768px) {
    .user-nav {
        width: 100%;
        justify-content: flex-end;
        margin-top: 10px;
    }
    .main-nav ul {
        flex-wrap: wrap;
    }

    /* On small screens the search form spans the full width and stacks nicely */
    .search-form {
        width: 100%;
        margin-top: 10px;
        margin-left: 0;
    }
    .search-form input[type="text"] {
        flex: 1 1 auto;
        width: auto;
    }
}

/* Admin search form */
.admin-search-form input[type="text"] {
    padding: 6px 10px;
    border: 1px solid #444;
    border-radius: 4px;
    background: #1e1f24;
    color: #ddd;
    margin-right: 6px;
}
.admin-search-form button {
    padding: 7px 12px;
    background: #4e54c8;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.admin-search-form button:hover {
    background: #565cce;
}

/* Footer */
.site-footer {
    background: #232526;
    padding: 15px 0;
    text-align: center;
    border-top: 1px solid #292a2f;
}

/* ------------------------------------------------------------------------
 * Light theme overrides. When the body has the class `theme-light`,
 * we override various dark backgrounds to light backgrounds and darken
 * text for readability. Only major containers and components are overridden
 * to avoid specifying every rule twice.
 */
.theme-light {
    background-color: #f7f7f7;
    color: #222;
}
.theme-light .site-header {
    background: linear-gradient(135deg, #f0f0f0 0%, #e0e0e0 100%);
    border-bottom: 1px solid #ddd;
    box-shadow: none;
}
.theme-light .logo a {
    color: #333;
}
.theme-light .main-nav a {
    color: #555;
}
.theme-light .main-nav a:hover {
    background: #e0e0e0;
    color: #000;
}
.theme-light .admin-link a {
    color: #b58900;
}
.theme-light .user-nav span {
    color: #333;
}
.theme-light .user-nav a {
    background: #7b83ff;
    color: #fff;
}
.theme-light .btn-action {
    background: #7b83ff;
    color: #fff;
}
.theme-light .btn-action:hover {
    background: #6a72e6;
}
.theme-light .search-form input[type="text"] {
    background: #fff;
    color: #222;
    border: 1px solid #ccc;
}
.theme-light .search-form button {
    background: #7b83ff;
    color: #fff;
}
.theme-light .container {
    color: #222;
}
.theme-light .game-card {
    background: #fff;
    color: #222;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.theme-light .game-card:hover {
    transform: translateY(-2px);
}
.theme-light .game-card .info h3 {
    color: #111;
}
.theme-light .game-card .info p {
    color: #444;
}
.theme-light .pagination .page-link {
    background: #e0e0e0;
    color: #333;
}
.theme-light .pagination .page-link:hover {
    background: #d0d0d0;
}
.theme-light .pagination .current {
    background: #7b83ff;
    color: #fff;
}
.theme-light .dlc-section,
.theme-light .game-header,
.theme-light .game-desc,
.theme-light .media-section,
.theme-light .similar-section,
.theme-light .comments-section,
.theme-light .admin-container {
    background: #fff;
    color: #222;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.theme-light .tags a.tag-link {
    background: #e0e0e0;
    color: #333;
}
.theme-light .tags a.tag-link:hover {
    background: #7b83ff;
    color: #fff;
}
.theme-light .media-grid .screenshot-thumb img,
.theme-light .video-thumb img {
    /* images unchanged */
}
.theme-light .modal {
    background: rgba(255, 255, 255, 0.9);
}
.theme-light .age-overlay {
    background: rgba(255, 255, 255, 0.85);
}
.theme-light .age-overlay .age-box {
    background: #fff;
    color: #222;
}
.theme-light .age-overlay .age-box a {
    background: #7b83ff;
    color: #fff;
}
.theme-light .comment {
    background: #f0f0f0;
    color: #222;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.theme-light .comment .author {
    color: #333;
}
.theme-light .comment-form textarea {
    background: #fff;
    color: #222;
    border: 1px solid #ccc;
}
.theme-light .comment-form button {
    background: #7b83ff;
    color: #fff;
}
.site-footer p {
    margin: 0;
    color: #777;
    font-size: 0.8em;
}

/* Список DLC */
.dlc-list { margin: 0; padding-left: 18px; }
.dlc-list li { margin: 4px 0; }

/* Внутренняя прокрутка DLC (по желанию) */
.dlc-section.dlc-scroll { max-height: 380px; overflow: auto; }

/* Небольшой отступ под пагинацию DLC */
.pagination.dlc-pagination { margin-top: 10px; }
