* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f3f5f8;
    color: #1f2937;
}

.wrap {
  width: 100%;
  margin: 20px auto;
  max-width: 1500px;
  padding: 0 20px;
}

.hero {
    background: linear-gradient(135deg, #111827, #374151);
    color: white;
    padding: 32px;
    border-radius: 18px;
    margin-bottom: 24px;
}

.hero h1,
.card h1,
.card h2 {
    margin-top: 0;
}

.card {
    background: white;
    border-radius: 18px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

label {
    display: block;
    font-weight: 700;
    margin-bottom: 8px;
}

textarea {
    width: 100%;
    padding: 14px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font-family: Consolas, Monaco, monospace;
    font-size: 14px;
    resize: vertical;
}

.actions {
    margin-top: 16px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

button,
.button-link {
    border: 0;
    border-radius: 12px;
    padding: 12px 18px;
    background: #2563eb;
    color: white;
    font-weight: 700;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
}

button.secondary {
    background: #6b7280;
}

.hint {
    color: #6b7280;
}

.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

th,
td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

th {
    background: #f9fafb;
}

a {
    color: #2563eb;
}

.status,
.result {
    display: inline-block;
    border-radius: 999px;
    padding: 5px 10px;
    font-weight: 700;
    font-size: 12px;
}

.status.success,
.result.success {
    background: #dcfce7;
    color: #166534;
}

.status.failed,
.result.failed {
    background: #fee2e2;
    color: #991b1b;
}

.results {
    display: grid;
    gap: 10px;
    margin: 18px 0;
}

.result {
    border-radius: 12px;
    width: 100%;
    font-size: 14px;
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.currency-toggle {
    display: inline-flex;
    background: #eef2ff;
    padding: 4px;
    border-radius: 999px;
    gap: 4px;
}

.currency-btn {
    background: transparent;
    color: #374151;
    padding: 8px 12px;
    border-radius: 999px;
}

.currency-btn.active {
    background: #2563eb;
    color: white;
}

.small {
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
}

.row-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.edit-field,
.save-row-btn,
.cancel-row-btn {
    display: none;
}

tr.editing .view-value {
    display: none;
}

tr.editing .edit-field {
    display: inline-block;
}

tr.editing .edit-row-btn {
    display: none;
}

tr.editing .save-row-btn,
tr.editing .cancel-row-btn {
    display: inline-block;
}

.edit-field {
    width: 110px;
    padding: 7px 8px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font: inherit;
}

.title-input {
    width: 240px;
}

.date-input {
    width: 150px;
}

.price-input {
    width: 95px;
}

a.top-link {
    color: #fff;
    font-weight: 700;
    margin-right: 14px;
}

.auth-wrap {
    width: min(520px, calc(100% - 32px));
    margin: 60px auto;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font: inherit;
    margin-bottom: 14px;
}

.check {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 400;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    border-radius: 12px;
    padding: 12px;
    font-weight: 700;
}

.secondary-link {
    background: #6b7280;
}

/* DataTables tweaks */
.dt-container .dt-search input,
.dt-container .dt-length select {
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
}

.dt-container .dt-search,
.dt-container .dt-length,
.dt-container .dt-info,
.dt-container .dt-paging {
    margin: 10px 0;
}

table.dataTable thead th,
table.dataTable tbody td {
    white-space: nowrap;
}

/* Console public pages */
.console-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
}

.console-card {
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
}

.console-photo-link {
    display: block;
    background: #e5e7eb;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.console-photo-link img,
.console-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.console-card-body {
    padding: 18px;
}

.console-card-body h2 {
    font-size: 18px;
    margin: 0 0 14px;
}

.console-detail-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 420px);
    gap: 28px;
    align-items: start;
}

.detail-photo-grid {
    display: block;
}

.photo-slider {
    width: 100%;
}

.slider-main {
    position: relative;
    overflow: hidden;
    border-radius: 16px;
    background: #e5e7eb;
}

.slider-main-link,
.slider-main-img {
    display: block;
    width: 100%;
}

.slider-main-img,
.detail-placeholder {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 14px;
    background: #e5e7eb;
    display: block;
}

.slider-main-img {
    border-radius: 16px;
}

.slider-btn {
    position: absolute;
    top: 50%;
    z-index: 2;
    transform: translateY(-50%);
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    color: white;
    cursor: pointer;
    font-size: 30px;
    line-height: 1;
}

.slider-prev {
    left: 12px;
}

.slider-next {
    right: 12px;
}

.slider-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.slider-thumb {
    border: 3px solid transparent;
    border-radius: 12px;
    background: transparent;
    padding: 0;
    cursor: pointer;
    overflow: hidden;
}

.slider-thumb.active {
    border-color: #2563eb;
}

.slider-thumb img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
}

.price-guide-table th,
.price-guide-table td {
    white-space: normal;
}

.detail-price-head {
    margin-top: 24px;
}

/* Admin photo uploader */
.admin-photos {
    min-width: 230px;
}

.photo-count {
    font-weight: 700;
    margin-bottom: 8px;
}

.thumb-strip {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.thumb-box {
    width: 54px;
    height: 54px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #e5e7eb;
}

.thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.delete-photo-btn {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 20px;
    height: 20px;
    padding: 0;
    border-radius: 999px;
    background: #dc2626;
    color: white;
    line-height: 20px;
}

.photo-upload-form {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.photo-upload-form input[type="file"] {
    max-width: 150px;
    font-size: 12px;
}

@media (max-width: 800px) {
    .console-detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1100px) {
    .console-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 800px) {
    .console-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .console-detail-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 520px) {
    .console-grid {
        grid-template-columns: 1fr;
    }
}

.game-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 520px);
  gap: 28px;
  align-items: start;
}

.small-link {
  padding: 7px 10px;
  font-size: 13px;
}

@media (max-width: 900px) {
  .game-detail-layout {
    grid-template-columns: 1fr;
  }
}



/* Games library */
.games-filter-card {
    margin-bottom: 18px;
}

.games-filters {
    display: grid;
    grid-template-columns: minmax(240px, 2fr) minmax(180px, 1fr) minmax(180px, 1fr);
    gap: 16px;
    align-items: end;
}

.games-filters input,
.games-filters select {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    font: inherit;
    background: white;
}

.games-library-head,
.games-library-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin: 18px 0;
    flex-wrap: wrap;
}

.games-count {
    font-weight: 700;
    color: #374151;
}

.games-pager {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.games-pager button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.games-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 20px;
    transition: opacity 0.15s ease;
}

.games-grid.loading {
    opacity: 0.55;
}

.game-card {
    background: white;
    border-radius: 18px;
    overflow: hidden;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
    min-width: 0;
}

.game-photo-link {
    display: block;
    background: #e5e7eb;
    aspect-ratio: 4 / 3;
    overflow: hidden;
}

.game-photo-link img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.game-card-body {
    padding: 16px;
}

.game-card-body h2 {
    font-size: 16px;
    line-height: 1.25;
    margin: 0 0 10px;
}

.game-card-body p {
    margin: 0 0 10px;
    color: #6b7280;
    font-size: 14px;
}

.game-card-genre {
    font-weight: 700;
    color: #374151 !important;
}

@media (max-width: 1250px) {
    .games-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 980px) {
    .games-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .games-filters {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 680px) {
    .games-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 460px) {
    .games-grid {
        grid-template-columns: 1fr;
    }
}
