/* LegoSetGuesser Styles */

:root {
    --bg-color: #121212;
    --container-bg: #1e1e1e;
    --primary-color: #ffcf00;
    /* Lego Yellow */
    --secondary-color: #d0021b;
    /* Lego Red */
    --accent-color: #0055bf;
    /* Lego Blue */
    --text-color: #e0e0e0;
    --input-bg: #2c2c2c;
    --border-color: #444;
}

* {
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    background-image:
        radial-gradient(#222 15%, transparent 16%),
        radial-gradient(#222 15%, transparent 16%);
    background-size: 20px 20px;
    background-position: 0 0, 10px 10px;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: 0;
    min-height: 100vh;
    padding-top: 80px;
}

/* ========== Navbar ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 60px;
    background-color: var(--container-bg);
    border-bottom: 3px solid var(--secondary-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    box-sizing: border-box;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.nav-left,
.nav-center,
.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    background-color: var(--secondary-color);
    padding: 2px 8px;
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 1px;
    border: 2px solid #fff;
    box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
    font-family: 'Impact', 'Arial Black', sans-serif;
}

.nav-btn {
    background-color: transparent;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 6px 14px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none;
}

.nav-btn:hover {
    background-color: var(--primary-color);
    color: #121212;
}

.btn-cta {
    background-color: var(--primary-color);
    color: #121212;
    padding: 8px 16px;
    border-radius: 4px;
    font-weight: bold;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s;
}

.btn-cta:hover {
    background-color: #e6b800;
    color: #121212;
}

.user-name {
    font-weight: bold;
    color: var(--primary-color);
    margin-right: 8px;
}

/* ========== Navbar Game Mode Dropdown ========== */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.nav-dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 4px;
}

.nav-dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background-color: var(--container-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
    z-index: 1100;
    overflow: hidden;
    margin-top: 6px;
}

.nav-dropdown-menu.open {
    display: block;
    animation: dropdownSlide 0.2s ease;
}

@keyframes dropdownSlide {
    0% {
        opacity: 0;
        transform: translateY(-8px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.nav-dropdown-item {
    display: block;
    padding: 12px 16px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: background-color 0.15s;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-dropdown-item:last-child {
    border-bottom: none;
}

.nav-dropdown-item:hover {
    background-color: rgba(255, 207, 0, 0.1);
    color: var(--primary-color);
}

.nav-dropdown-item.active {
    background-color: rgba(255, 207, 0, 0.15);
    color: var(--primary-color);
    font-weight: bold;
    border-left: 3px solid var(--primary-color);
}

/* ========== Headings ========== */
h1 {
    color: var(--primary-color);
    margin-bottom: 5px;
    font-size: 2.8em;
    font-family: 'Impact', 'Arial Black', sans-serif;
    letter-spacing: 1px;
    text-shadow: 2px 2px 0 #000;
    -webkit-text-stroke: 1px black;
}

.container {
    background-color: var(--container-bg);
    padding: 30px;
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
    text-align: center;
    max-width: 800px;
    width: 95%;
    margin-top: 20px;
    border: 1px solid var(--border-color);
}

/* ========== Lego Image Frame ========== */
#image-container {
    margin: 30px auto;
    width: 600px;
    height: 400px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    border: 4px solid var(--border-color);
    border-radius: 8px;
    background-color: #000;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#lego-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: none;
    transform: none;
    z-index: 1;
}

#lego-image.reveal-full {
    object-fit: contain;
}

/* Grid Overlay */
#grid-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    z-index: 10;
}

.grid-tile {
    background-color: #111;
    border: 1px solid #333;
    transition: opacity 0.4s ease;
    opacity: 1;
}

.tile-hidden {
    opacity: 0;
}

/* ========== Inputs ========== */
input[type="text"],
input[type="email"],
input[type="password"] {
    padding: 12px;
    font-size: 16px;
    width: 60%;
    margin-right: 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-bg);
    color: white;
    transition: border-color 0.3s;
    box-shadow: none;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* Primary Button (Guess) */
button {
    padding: 12px 24px;
    font-size: 16px;
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

button:hover {
    background-color: #b30017;
    transform: translateY(-1px);
}

button:active {
    transform: translateY(1px);
}

button:disabled {
    background-color: #444;
    color: #888;
    box-shadow: none;
    cursor: not-allowed;
    transform: none;
}

#feedback {
    margin-top: 25px;
    font-size: 1.4em;
    min-height: 35px;
    font-weight: 500;
}

.correct {
    color: #4cd964;
    text-shadow: 0 0 5px rgba(76, 217, 100, 0.3);
}

.incorrect {
    color: var(--secondary-color);
    font-weight: bold;
}

#lives-container {
    font-size: 28px;
    margin-bottom: 20px;
    color: var(--secondary-color);
    text-shadow: none;
}

.input-area {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 25px;
    gap: 15px;
}

#score {
    font-size: 20px;
    margin-top: 15px;
    color: var(--primary-color);
    font-weight: bold;
}

/* ========== Admin ========== */
.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    border-bottom: 2px solid var(--border-color);
    padding-bottom: 15px;
}

.set-list {
    margin-top: 30px;
    text-align: left;
    max-height: 500px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    padding: 15px;
    border-radius: 8px;
    background: #252525;
}

.set-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid #444;
    background: #2c2c2c;
    margin-bottom: 8px;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.set-item:hover {
    background-color: #333;
}

.set-item img {
    width: 70px;
    height: 70px;
    object-fit: cover;
    margin-right: 20px;
    border-radius: 6px;
    border: 1px solid #555;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.form-group {
    text-align: left;
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #bbb;
    font-weight: 500;
}

/* Login Page Styles */
.login-container {
    margin-top: 100px;
    max-width: 400px;
}

.error-msg {
    color: var(--secondary-color);
    margin-top: 10px;
    min-height: 24px;
}

/* ========== Ranking Modal ========== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: var(--container-bg);
    padding: 30px;
    border-radius: 8px;
    width: 90%;
    max-width: 500px;
    border: 2px solid var(--primary-color);
    color: var(--text-color);
    position: relative;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    max-height: 80vh;
    overflow-y: auto;
}

.modal-close {
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    cursor: pointer;
    color: #aaa;
}

.modal-close:hover {
    color: white;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 10px;
    text-align: left;
    border-bottom: 1px solid #444;
}

.leaderboard-table th {
    color: var(--primary-color);
}

.leaderboard-tabs {
    display: flex;
    margin-bottom: 15px;
    border-bottom: 1px solid #444;
}

.tab-btn {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    color: #aaa;
    cursor: pointer;
    font-size: 16px;
    border-bottom: 2px solid transparent;
}

.tab-btn.active {
    color: var(--primary-color);
    border-bottom: 2px solid var(--primary-color);
}

/* ========== Admin Tabs ========== */
.admin-tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.admin-tab-btn {
    background-color: transparent;
    border: none;
    color: var(--text-color);
    padding: 10px 20px;
    font-size: 16px;
    cursor: pointer;
    border-bottom: 4px solid transparent;
    font-weight: bold;
    transition: all 0.2s;
}

.admin-tab-btn:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.admin-tab-btn.active {
    color: var(--primary-color);
    border-bottom: 4px solid var(--primary-color);
}

.tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Admin Search Results */
.search-item {
    display: flex;
    align-items: center;
    padding: 8px;
    cursor: pointer;
    border-bottom: 1px solid #444;
}

.search-item:hover {
    background-color: #333;
}

.search-item img {
    width: 40px;
    height: 40px;
    object-fit: cover;
    margin-right: 10px;
    border-radius: 4px;
}

/* Smaller Admin Buttons */
.role-btn,
.delete-user-btn {
    padding: 6px 12px;
    font-size: 14px;
    margin-left: 5px;
}

.role-btn {
    background-color: #2b7de9;
    color: white;
}

.role-btn:hover {
    background-color: #1a5bb8;
}

.delete-user-btn {
    background-color: #d32f2f;
    color: white;
}

.delete-user-btn:hover {
    background-color: #b71c1c;
}

/* ========== Input Wrapper ========== */
.input-wrapper {
    position: relative;
    width: 60%;
    margin-right: 0;
}

.input-wrapper input {
    width: 100% !important;
    margin-right: 0 !important;
}

/* Autocomplete List */
.autocomplete-items {
    position: absolute;
    border: 1px solid var(--border-color);
    border-top: none;
    z-index: 99;
    top: 100%;
    left: 0;
    right: 0;
    width: 100%;
    background-color: #333;
    max-height: 200px;
    overflow-y: auto;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    text-align: left;
}

.autocomplete-items div {
    padding: 10px;
    cursor: pointer;
    background-color: #333;
    border-bottom: 1px solid #444;
    color: #fff;
}

.autocomplete-items div:hover {
    background-color: #1e1e1e;
}

.autocomplete-active {
    background-color: var(--primary-color) !important;
    color: #000 !important;
}

/* ========== User Dropdown ========== */
.user-menu {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.dropdown-content {
    display: none;
    position: absolute;
    right: 0;
    top: 100%;
    background-color: #1e1e1e;
    min-width: 160px;
    box-shadow: 0 8px 16px 0 rgba(0, 0, 0, 0.2);
    z-index: 1001;
    border: 1px solid #444;
    border-radius: 4px;
    flex-direction: column;
}

.dropdown-content a {
    color: white;
    padding: 12px 16px;
    text-decoration: none;
    display: block;
    text-align: left;
}

.dropdown-content a:hover {
    background-color: #333;
    color: var(--primary-color);
}

.user-menu:hover .dropdown-content {
    display: flex;
}

/* ========== Auth Pages ========== */
.auth-body {
    padding-top: 0;
    justify-content: center;
    background-image:
        radial-gradient(rgba(50, 50, 50, 0.4) 15%, transparent 16%),
        radial-gradient(rgba(50, 50, 50, 0.4) 15%, transparent 16%);
    background-color: #050505;
}

.auth-container {
    background-color: #1a1a1a;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.8);
    width: 100%;
    max-width: 420px;
    text-align: center;
    border: 1px solid #333;
    margin: 0;
    animation: fadeIn 0.5s ease;
    display: flex;
    flex-direction: column;
}

.auth-container h1 {
    font-size: 2.5em;
    margin-bottom: 30px;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(255, 207, 0, 0.2);
    -webkit-text-stroke: 0;
}

.auth-form-group {
    margin-bottom: 20px;
    text-align: left;
}

.auth-form-group label {
    display: block;
    margin-bottom: 8px;
    color: #e0e0e0;
    font-weight: 600;
    font-size: 0.9em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.auth-input {
    width: 100%;
    max-width: 100%;
    padding: 14px;
    font-size: 16px;
    background-color: #2a2a2a;
    border: 2px solid #444;
    border-radius: 6px;
    color: white;
    box-sizing: border-box;
    outline: none;
    transition: all 0.3s ease;
}

.auth-input::placeholder {
    color: #888;
}

.auth-input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(255, 207, 0, 0.2);
    background-color: #333;
}

.auth-btn {
    width: 100%;
    padding: 14px;
    font-size: 18px;
    margin-top: 10px;
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
    background-color: var(--primary-color);
    color: #000;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.auth-btn:hover {
    background-color: #ffd700;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(255, 207, 0, 0.4);
}

.auth-btn:active {
    transform: translateY(0);
}

.auth-links {
    margin-top: 30px;
    font-size: 0.95em;
    color: #ccc;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.auth-link {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
    transition: color 0.2s;
    font-size: 1em;
}

.auth-link:hover {
    color: #fff;
    text-decoration: underline;
}

.auth-error {
    min-height: 24px;
    color: #ff4444;
    margin-bottom: 15px;
    font-weight: bold;
    font-size: 0.95em;
}

/* ========== Hints Mode — Royaledle Style ========== */
#hints-container {
    margin: 25px auto;
    width: 700px;
    max-width: 95%;
}

.hints-header {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.hints-header .hints-col {
    flex: 1;
    text-align: center;
    font-weight: 700;
    font-size: 0.85em;
    color: var(--primary-color);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 4px;
    background: rgba(255, 207, 0, 0.08);
    border-radius: 6px;
}

.guess-row {
    display: flex;
    gap: 6px;
    margin-bottom: 6px;
    animation: guessRowIn 0.4s ease;
}

@keyframes guessRowIn {
    0% {
        opacity: 0;
        transform: translateY(-12px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.guess-cell {
    flex: 1;
    text-align: center;
    padding: 12px 6px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 0.85em;
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 55px;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

.guess-cell .arrow {
    font-size: 1.4em;
    line-height: 1;
}

.guess-cell.cell-correct {
    background-color: #2d8a4e;
}

.guess-cell.cell-wrong {
    background-color: #c0392b;
}

.guess-cell.cell-close {
    background-color: #e67e22;
}

.guess-cell.cell-set {
    padding: 4px;
}

.guess-cell.cell-set img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

/* ========== Admin Form Improvements ========== */
.admin-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.admin-form-grid .form-group.full-width {
    grid-column: 1 / -1;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group input[type="file"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: var(--input-bg);
    color: #fff;
    font-size: 14px;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.form-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.form-group label {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}