@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Space+Grotesk:wght@400;500;600;700&display=swap');

:root {
    --brand: var(--primary-color, #4a90e2);
    --brand-2: var(--secondary-color, #50e3c2);
    --bg: #f5f7fb;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-2: rgba(255, 255, 255, 0.72);
    --text: #0f172a;
    --muted: #5b6476;
    --border: rgba(15, 23, 42, 0.12);
    --shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
    --glow: 0 0 0 1px rgba(15, 23, 42, 0.08);
    --danger: #ef4444;
    --success: #22c55e;
    --warning: #f97316;
    --info: #38bdf8;
    --nav-bg: rgba(248, 250, 255, 0.85);
    --bg-overlay: radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.6), transparent 55%),
        radial-gradient(circle at 90% 0%, rgba(80, 227, 194, 0.15), transparent 60%),
        linear-gradient(120deg, rgba(74, 144, 226, 0.12), rgba(255, 255, 255, 0.8));
    --bg-image-opacity: 0.35;
    --radius-xl: 24px;
    --radius-lg: 18px;
    --radius-md: 12px;
}

[data-theme="dark"] {
    --bg: #0b1224;
    --surface: rgba(15, 23, 42, 0.82);
    --surface-2: rgba(15, 23, 42, 0.6);
    --text: #e2e8f0;
    --muted: #94a3b8;
    --border: rgba(148, 163, 184, 0.25);
    --shadow: 0 28px 70px rgba(0, 0, 0, 0.45);
    --glow: 0 0 0 1px rgba(148, 163, 184, 0.18);
    --nav-bg: rgba(10, 15, 30, 0.88);
    --bg-overlay: radial-gradient(circle at 10% 10%, rgba(56, 189, 248, 0.08), transparent 55%),
        radial-gradient(circle at 90% 0%, rgba(80, 227, 194, 0.08), transparent 60%),
        linear-gradient(120deg, rgba(3, 7, 18, 0.9), rgba(10, 15, 30, 0.6));
    --bg-image-opacity: 0.18;
}

* {
    box-sizing: border-box;
}

html, body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: 'Space Grotesk', 'Segoe UI', system-ui, sans-serif;
    color: var(--text);
    background: var(--bg);
    position: relative;
    line-height: 1.6;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    background-image: var(--page-bg-image);
    background-position: center;
    background-size: cover;
    opacity: var(--bg-image-opacity);
    filter: saturate(1.2) blur(0px);
    z-index: -2;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    background: var(--bg-overlay);
    z-index: -1;
}

img {
    max-width: 100%;
    display: block;
}

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

a:hover {
    color: var(--brand);
}

h1, h2, h3 {
    font-family: 'Fraunces', serif;
    letter-spacing: -0.02em;
}

p {
    margin: 0 0 1rem;
    color: var(--muted);
}

body > nav {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 16px 6vw;
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

body > nav a {
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
    color: var(--text);
    transition: transform 0.2s ease, background-color 0.2s ease, color 0.2s ease;
}

body > nav a:hover {
    background: var(--surface-2);
    transform: translateY(-1px);
}

body > nav a.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(120deg, rgba(74, 144, 226, 0.12), rgba(80, 227, 194, 0.2));
    border: 1px solid rgba(74, 144, 226, 0.2);
}

body > nav a.brand::before {
    content: "";
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background-image: var(--brand-logo-url);
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.language-selector {
    margin-left: 0;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.95rem;
    color: var(--muted);
}

.language-selector a {
    color: var(--muted);
}

.theme-toggle {
    margin-left: auto;
    border: 1px solid var(--border);
    background: var(--surface-2);
    color: var(--text);
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
    transform: translateY(-1px);
    border-color: rgba(74, 144, 226, 0.4);
}

.content {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 32px 6vw 72px;
    animation: fade-up 0.6s ease both;
}

@keyframes fade-up {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container,
.admin-container,
.index-container,
.login-container,
.sign_in-container,
.forgot_password-container,
.reset_password-container,
.leaderboard-container,
.send-rewards-container {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow);
    padding: 28px;
    backdrop-filter: blur(16px);
}

.index-container-wrapper {
    display: flex;
    align-items: center;
    min-height: 60vh;
}

.index-container header h1 {
    font-size: clamp(2rem, 3vw, 3rem);
    color: var(--text);
}

.index-container header img {
    width: 160px;
    margin: 0 0 20px;
}

.login-container-wrapper {
    display: grid;
    place-items: center;
}

.logo-container {
    position: relative;
    margin-bottom: 20px;
}

.logo {
    max-width: 140px;
    max-height: 140px;
    height: auto;
    margin: 0 auto 12px;
}

.sign_in-container {
    max-width: 720px;
}

.sign_in-container header h1,
.login-container header h1,
.forgot_password-container header h1,
.reset_password-container header h1 {
    color: var(--text);
}

.button-container {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

button,
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border-radius: 999px;
    border: none;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 10px 20px rgba(74, 144, 226, 0.25);
}

button:hover,
.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(74, 144, 226, 0.3);
}

.small-btn {
    width: auto;
}

.cancel-btn,
.logout-btn {
    background: linear-gradient(120deg, #ef4444, #f97316);
}

form {
    display: grid;
    gap: 12px;
    margin-top: 16px;
}

form.export-form {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-end;
}

.form-group {
    display: grid;
    gap: 6px;
}

.remember-me-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

label {
    font-weight: 600;
    color: var(--text);
}

input[type="text"],
input[type="file"],
input[type="email"],
input[type="password"],
input[type="number"],
textarea,
select {
    width: 100%;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.7);
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
}

input[type="file"].file-input {
    padding: 6px;
}

input[type="file"].file-input::file-selector-button {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    margin-right: 12px;
}

input[type="file"].file-input::-webkit-file-upload-button {
    border: none;
    border-radius: 999px;
    padding: 8px 16px;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    margin-right: 12px;
}

[data-theme="dark"] input[type="text"],
[data-theme="dark"] input[type="file"],
[data-theme="dark"] input[type="email"],
[data-theme="dark"] input[type="password"],
[data-theme="dark"] input[type="number"],
[data-theme="dark"] textarea,
[data-theme="dark"] select {
    background: rgba(15, 23, 42, 0.8);
}

input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: rgba(74, 144, 226, 0.6);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.18);
}

.toggle-password {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    cursor: pointer;
    color: var(--muted);
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    z-index: 50;
}

.modal-content {
    background: var(--surface);
    color: var(--text);
    margin: 15% auto;
    padding: 24px;
    border-radius: var(--radius-lg);
    width: min(90vw, 420px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.modal-content.success { background: rgba(34, 197, 94, 0.85); color: #fff; }
.modal-content.error { background: rgba(239, 68, 68, 0.85); color: #fff; }
.modal-content.info { background: rgba(56, 189, 248, 0.85); color: #fff; }
.modal-content.warning { background: rgba(249, 115, 22, 0.85); color: #fff; }

.flashes {
    margin-bottom: 20px;
}

.alert {
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
}

.table-container {
    overflow: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface-2);
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

thead th {
    text-align: left;
    padding: 14px;
    background: rgba(74, 144, 226, 0.12);
    color: var(--text);
    font-weight: 600;
}

tbody td {
    padding: 12px 14px;
    border-top: 1px solid var(--border);
    color: var(--text);
}

tbody tr:hover {
    background: rgba(74, 144, 226, 0.08);
}

/* Send rewards layout */
.background {
    position: relative;
    width: 100%;
}

.background-image {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    opacity: 0.08;
    pointer-events: none;
}

.background header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 24px;
}

.background header h1 {
    color: var(--text);
}

.background header nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.background header nav a {
    display: inline-flex;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    font-weight: 600;
}

.background .container {
    display: grid;
    grid-template-columns: 280px minmax(320px, 1fr) 360px;
    gap: 24px;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
}

.left-side,
.right-side {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.account-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
}

.account-link img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
}

.left-image,
.right-image,
.coins-image {
    width: 100%;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    opacity: 0.9;
}

.send-rewards-container {
    padding: 24px;
}

.send-rewards-container .header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.points-info {
    background: rgba(74, 144, 226, 0.12);
    border-radius: var(--radius-md);
    padding: 8px 12px;
    border: 1px solid var(--border);
}

.rewards-section {
    display: none;
}

.rewards-section.active {
    display: block;
}

.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    gap: 16px;
    position: relative;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 10px;
    top: 4px;
    bottom: 4px;
    width: 2px;
    background: rgba(74, 144, 226, 0.35);
}

.timeline-item {
    position: relative;
    padding-left: 32px;
}

.timeline-dot {
    position: absolute;
    left: 2px;
    top: 8px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: linear-gradient(120deg, var(--brand), var(--brand-2));
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.2);
}

.timeline-card {
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface-2);
    padding: 14px 16px;
    display: grid;
    gap: 6px;
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.timeline-title {
    font-weight: 600;
    color: var(--text);
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--muted);
}

.timeline-body {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: 0.95rem;
}

.timeline-points {
    font-weight: 600;
    color: var(--text);
}

.leaderboard-tables-container h1 {
    margin-top: 0;
}

.leaderboard-section h2 {
    margin-top: 12px;
    color: var(--text);
}

/* Shop cards */
.shop-items-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
}

.shop-item-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px;
    display: grid;
    gap: 10px;
    box-shadow: var(--glow);
}

.shop-item-card .item-image {
    width: 100%;
    height: 160px;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
}

.shop-item-card .item-name {
    font-size: 1.05rem;
    margin: 0;
    color: var(--text);
}

.shop-item-card .item-description {
    font-size: 0.9rem;
    color: var(--muted);
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.shop-item-card .item-price {
    font-weight: 600;
    margin: 0;
}

.item-more {
    margin-left: 6px;
    font-weight: 600;
    color: var(--brand);
}

.shop-item-detail {
    display: grid;
    grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

.shop-item-detail .item-image {
    width: 100%;
    height: 260px;
    object-fit: contain;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.6);
}

.shop-item-info .item-description {
    font-size: 1rem;
    color: var(--text);
    line-height: 1.6;
    word-break: break-word;
    overflow-wrap: anywhere;
}

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

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

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

@media (max-width: 600px) {
    .shop-items-grid {
        grid-template-columns: 1fr;
    }
}

/* Leaderboard page */
.leaderboard-container {
    padding: 24px;
}

.leaderboard-header {
    background: linear-gradient(120deg, rgba(74, 144, 226, 0.3), rgba(80, 227, 194, 0.25));
    border-radius: var(--radius-lg);
    padding: 18px;
    border: 1px solid var(--border);
}

.leaderboard-title {
    margin: 0;
}

/* Admin */
.admin-container {
    display: grid;
    gap: 24px;
}

.admin-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 24px;
}

.admin-sidebar nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.admin-sidebar nav a {
    display: block;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-weight: 600;
}

.admin-section {
    display: none;
    background: var(--surface-2);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
}

.admin-section.active {
    display: block;
}

.admin-shop .admin-section {
    display: block;
}

.profile-image {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    object-fit: cover;
}

.profile-image-lg {
    width: 150px;
    height: 150px;
}

.form-container,
.table-header {
    margin-bottom: 16px;
}

/* Responsive */
@media (max-width: 1100px) {
    .background .container {
        grid-template-columns: 1fr;
    }

    .admin-body {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    body > nav {
        padding: 14px 4vw;
    }

    .content {
        padding: 24px 4vw 60px;
    }

    .button-container {
        flex-direction: column;
    }

    .theme-toggle {
        order: 2;
        width: 100%;
    }

    .language-selector {
        width: 100%;
        justify-content: flex-start;
    }
}
