@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@400;500;600;700&display=swap');

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

body {
    font-family: 'Be Vietnam Pro', sans-serif;
    background: linear-gradient(135deg, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    color: #e8e8e8;
    padding: 12px;
}

.container { max-width: 1100px; margin: 0 auto; }

/* ========== AUTH SCREEN ========== */
#auth-screen {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 90vh;
}

.auth-box {
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 20px;
    padding: 40px 35px;
    width: 100%;
    max-width: 420px;
    backdrop-filter: blur(10px);
}

.auth-box h1 {
    text-align: center;
    font-size: 1.8rem;
    background: linear-gradient(90deg, #ff9a3c, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

.auth-box .subtitle {
    text-align: center;
    color: #aaa;
    margin-bottom: 28px;
    font-size: 0.95rem;
}

.auth-tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 22px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: #ccc;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: 0.2s;
}

.auth-tab.active {
    background: linear-gradient(90deg, #ff9a3c, #ff6b6b);
    color: white;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    color: #bbb;
    margin-bottom: 6px;
}

.form-group input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.15);
    background: rgba(0,0,0,0.3);
    color: white;
    font-family: inherit;
    font-size: 0.95rem;
}

.form-group input:focus {
    outline: none;
    border-color: #ff9a3c;
}

.btn-auth {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(90deg, #ff9a3c, #ff6b6b);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    font-family: inherit;
    margin-top: 8px;
    transition: 0.2s;
}

.btn-auth:hover { opacity: 0.9; transform: scale(1.02); }
.btn-auth:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.auth-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

.auth-loading {
    text-align: center;
    color: #aaa;
    margin-top: 10px;
    font-size: 0.9rem;
}

/* ========== GAME SCREEN ========== */
#game-screen { display: none; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 18px;
    padding: 16px 20px;
    background: rgba(255,255,255,0.05);
    border-radius: 16px;
    border: 1px solid rgba(255,255,255,0.1);
}

header h1 {
    font-size: 1.5rem;
    background: linear-gradient(90deg, #ff9a3c, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
}

.user-info span { color: #ffd166; }

.admin-badge {
    background: linear-gradient(90deg, #f72585, #7209b7);
    color: white;
    font-size: 0.7rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
}

.btn-logout {
    background: rgba(255,107,107,0.2);
    color: #ff6b6b;
    border: 1px solid #ff6b6b;
    padding: 7px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-weight: 600;
    font-size: 0.85rem;
}

.btn-logout:hover { background: #ff6b6b; color: white; }

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.stat-card {
    background: rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.08);
}

.stat-label { font-size: 0.8rem; color: #aaa; margin-bottom: 4px; }
.stat-value { font-size: 1.25rem; font-weight: 700; }
.stat-value.money { color: #06d6a0; }
.stat-value.day { color: #4cc9f0; }
.stat-value.level { color: #f72585; }
.stat-value.rep { color: #ffd166; }

.tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.tab-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    background: rgba(255,255,255,0.08);
    color: #ccc;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    transition: 0.2s;
}

.tab-btn.active {
    background: linear-gradient(90deg, #ff9a3c, #ff6b6b);
    color: white;
}

.tab-content { display: none; }
.tab-content.active { display: block; }

.main-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

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

.panel {
    background: rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 16px;
    border: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 16px;
}

.panel h2 {
    font-size: 1.1rem;
    margin-bottom: 12px;
    color: #ff9a3c;
    display: flex;
    align-items: center;
    gap: 8px;
}

.product-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
}

.product {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.25);
    padding: 11px 12px;
    border-radius: 10px;
    border: 1px solid rgba(255,255,255,0.05);
    gap: 8px;
}

.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 600; font-size: 0.9rem; }
.product-detail { font-size: 0.75rem; color: #aaa; margin-top: 2px; }

.product-actions {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-shrink: 0;
}

button {
    font-family: inherit;
    border: none;
    border-radius: 8px;
    padding: 7px 11px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.btn-buy { background: #06d6a0; color: #111; }
.btn-buy:hover { background: #05c090; transform: scale(1.04); }
.btn-buy:disabled { background: #444; color: #888; cursor: not-allowed; transform: none; }

.btn-sell { background: #ff6b6b; color: white; }
.btn-sell:hover { background: #ee5a5a; transform: scale(1.04); }
.btn-sell:disabled { background: #444; color: #888; cursor: not-allowed; transform: none; }

.btn-primary {
    background: linear-gradient(90deg, #ff9a3c, #ff6b6b);
    color: white;
    padding: 12px 20px;
    font-size: 0.95rem;
    width: 100%;
}

.btn-primary:hover { opacity: 0.9; transform: scale(1.01); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn-upgrade {
    background: linear-gradient(90deg, #7209b7, #f72585);
    color: white;
    width: 100%;
    padding: 11px;
    margin-top: 8px;
}

.btn-upgrade:hover { opacity: 0.9; }
.btn-upgrade:disabled { background: #444; cursor: not-allowed; opacity: 0.6; }

.btn-secondary {
    background: rgba(76,201,240,0.2);
    color: #4cc9f0;
    border: 1px solid #4cc9f0;
    width: 100%;
    padding: 11px;
    margin-top: 8px;
}

.btn-secondary:hover { background: #4cc9f0; color: #111; }
.btn-secondary:disabled { opacity: 0.5; cursor: not-allowed; }

.stock-badge {
    background: #4cc9f0;
    color: #111;
    font-size: 0.7rem;
    padding: 2px 7px;
    border-radius: 20px;
    font-weight: 700;
}

.category-filter {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.cat-btn {
    padding: 6px 12px;
    border-radius: 20px;
    background: rgba(255,255,255,0.08);
    color: #ccc;
    font-size: 0.8rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
}

.cat-btn.active {
    background: #ff9a3c;
    color: white;
}

/* Quest */
.quest-item {
    background: rgba(0,0,0,0.25);
    border-radius: 10px;
    padding: 12px 14px;
    margin-bottom: 10px;
    border-left: 4px solid #ff9a3c;
}

.quest-item.completed {
    border-left-color: #06d6a0;
    opacity: 0.7;
}

.quest-title { font-weight: 600; margin-bottom: 4px; }
.quest-desc { font-size: 0.82rem; color: #aaa; margin-bottom: 8px; }

.quest-progress {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    overflow: hidden;
    margin-bottom: 6px;
}

.quest-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9a3c, #ff6b6b);
    border-radius: 10px;
    transition: width 0.3s;
}

.quest-item.completed .quest-progress-fill {
    background: #06d6a0;
}

.quest-reward {
    font-size: 0.8rem;
    color: #ffd166;
}

.quest-claim {
    background: #06d6a0;
    color: #111;
    padding: 5px 12px;
    font-size: 0.8rem;
    margin-top: 6px;
}

/* Upgrade */
.feature-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

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

.feature-card {
    background: rgba(0,0,0,0.25);
    border-radius: 12px;
    padding: 14px;
    border: 1px solid rgba(255,255,255,0.08);
}

.feature-card h3 {
    font-size: 0.95rem;
    margin-bottom: 6px;
    color: #ffd166;
}

.feature-card p {
    font-size: 0.8rem;
    color: #aaa;
    margin-bottom: 10px;
}

/* Log */
.log {
    background: rgba(0,0,0,0.3);
    border-radius: 10px;
    padding: 12px;
    max-height: 180px;
    overflow-y: auto;
    font-size: 0.82rem;
}

.log-entry {
    padding: 4px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.log-entry:last-child { border-bottom: none; }
.log-money { color: #06d6a0; }
.log-loss { color: #ff6b6b; }
.log-info { color: #4cc9f0; }
.log-quest { color: #ffd166; }

.capacity-bar {
    height: 8px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin-top: 8px;
    overflow: hidden;
}

.capacity-fill {
    height: 100%;
    background: linear-gradient(90deg, #06d6a0, #4cc9f0);
    border-radius: 10px;
    transition: width 0.3s;
}

.notification {
    position: fixed;
    top: 18px;
    right: 18px;
    background: #06d6a0;
    color: #111;
    padding: 13px 20px;
    border-radius: 10px;
    font-weight: 600;
    box-shadow: 0 8px 25px rgba(0,0,0,0.35);
    transform: translateX(150%);
    transition: transform 0.3s ease;
    z-index: 999;
    max-width: 300px;
}

.notification.show { transform: translateX(0); }
.notification.error { background: #ff6b6b; color: white; }
.notification.quest { background: #ffd166; color: #111; }

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

.footer-actions button { flex: 1; min-width: 140px; }

.saving-indicator {
    font-size: 0.8rem;
    color: #06d6a0;
    margin-left: 8px;
}

.leaderboard-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    background: rgba(0,0,0,0.25);
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9rem;
}

.leaderboard-item.me {
    border: 1px solid #ff9a3c;
}

.rank { font-weight: 700; color: #ffd166; min-width: 30px; }

/* Admin panel */
.admin-panel {
    border: 1px solid #f72585;
    background: rgba(247, 37, 133, 0.08);
}

.admin-panel h2 { color: #f72585; }

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

.btn-admin {
    background: linear-gradient(90deg, #f72585, #7209b7);
    color: white;
    padding: 8px 14px;
}
