@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;700&display=swap');

:root {
    --primary-color: #00ff00;
    --background-color: #001a00;
    --dark-gray: #333;
    --light-gray: #f4f4f4;
    --xp-gold: #ffd700;
    --danger-red: #ff3b30;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--background-color);
    color: var(--light-gray);
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    overflow: hidden;
}

#app-container {
    width: 100%;
    max-width: 480px;
    height: 100%;
    background-color: #0a2a0a;
    box-shadow: 0 0 20px rgba(0, 255, 0, 0.5);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.view {
    display: none;
    padding: 20px;
    height: calc(100% - 40px);
    overflow-y: auto;
    box-sizing: border-box;
}

.view.active {
    display: flex;
    flex-direction: column;
}

/* Login & Register View */
#login-view {
    justify-content: center;
    text-align: center;
}

#login-form, #register-form {
    display: flex;
    flex-direction: column;
    gap: 15px; /* Spacing between direct children */
    padding: 0 20px; /* Add some horizontal padding to forms */
}

#login-view h1 {
    color: var(--primary-color);
    margin-bottom: 30px;
}
#login-view h2 {
    color: var(--light-gray);
    margin-bottom: 10px;
}
#login-view input {
    padding: 12px;
    border-radius: 5px;
    border: 1px solid var(--primary-color);
    background-color: var(--dark-gray);
    color: var(--light-gray);
    font-size: 1rem;
    width: calc(100% - 24px); /* Full width minus padding */
    max-width: 350px; /* Limit max width */
    margin: 0 auto; /* Center the inputs */
}
#login-view button {
    padding: 12px;
    font-size: 1.1rem;
    background-color: var(--primary-color);
    color: var(--background-color);
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: transform 0.2s ease;
    width: 100%; /* Full width */
    max-width: 350px; /* Limit max width */
    margin: 0 auto; /* Center the buttons */
    margin-top: 5px; /* A little extra space above button if needed, gap should handle most */
}
#login-view button:active {
    transform: scale(0.98);
}
#login-view p {
    margin-top: 20px;
}
#login-view a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: bold;
}
.error-text {
    color: var(--danger-red);
    min-height: 20px;
}


/* Dashboard */
#dashboard-view.active {
    display: block; /* Override flex for dashboard */
}
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}
#welcome-message {
    font-size: 1.2rem;
    font-weight: bold;
}
#logout-btn {
    background: none;
    border: 1px solid var(--danger-red);
    color: var(--danger-red);
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}
#stats-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-card {
    background-color: var(--dark-gray);
    padding: 20px;
    border-radius: 10px;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.stat-card h2 {
    margin: 0 0 10px;
    font-size: 1rem;
    color: var(--primary-color);
}

.stat-card p {
    margin: 0;
    font-size: 1.8rem;
    font-weight: bold;
}

#xp-container {
    text-align: center;
    margin-bottom: 120px; /* Space for FAB */
}

#xp-bar-container {
    width: 100%;
    background-color: var(--dark-gray);
    border-radius: 10px;
    margin-bottom: 5px;
    overflow: hidden;
}

#xp-bar {
    width: 0%;
    height: 20px;
    background: linear-gradient(90deg, #ffd700, #f0a500);
    border-radius: 10px;
    transition: width 0.5s ease-out;
}

.fire-emoji {
    color: var(--danger-red); /* Set the fire emoji to red */
}

.fab {
    position: absolute;
    bottom: 30px; /* Default for larger screens */
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    background-color: var(--primary-color);
    color: var(--background-color);
    border-radius: 50%;
    border: none;
    box-shadow: 0 5px 15px rgba(0, 255, 0, 0.4);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: transform 0.1s ease;
}

@media (max-width: 480px) { /* Apply for mobile screens */
    .fab {
        bottom: 5px; /* Adjust for mobile screens */
    }
}


.fab svg {
    color: var(--background-color);
}

.fab:active {
    transform: translateX(-50%) scale(0.95);
}

/* Scanner View */
#scanner-view.active {
     display: block; /* Override flex for scanner */
}
#scanner-view {
    text-align: center;
}
#scanner-view h2 {
    color: var(--primary-color);
}
#scanner-help-text {
    font-size: 0.9rem;
    color: #ccc;
}
#qr-reader {
    width: 90%;
    margin: 20px auto;
    border: 2px solid var(--primary-color);
    border-radius: 10px;
}
#qr-reader video {
    border-radius: 8px; /* Smooth the edges of the video feed */
}

#cancel-scan-btn, #manual-submit-btn {
    padding: 10px 20px;
    font-size: 1rem;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
}
#cancel-scan-btn {
    background-color: var(--danger-red);
}
#manual-submit-btn {
    background-color: var(--primary-color);
    color: var(--background-color);
}

#manual-entry-container {
    margin-top: 30px;
}
#manual-barcode-input {
    padding: 8px;
    width: 70%;
    background-color: var(--dark-gray);
    color: var(--light-gray);
    border: 1px solid var(--primary-color);
    border-radius: 5px;
}


/* Feedback Overlay */
#feedback-overlay {
    position: absolute;
    top: -150px;
    left: 10%;
    width: 80%;
    background-color: var(--dark-gray);
    color: white;
    text-align: center;
    padding: 20px;
    border-radius: 10px;
    box-shadow: 0 10px 20px rgba(0,0,0,0.5);
    transition: top 0.5s ease-in-out;
    z-index: 100;
}

#feedback-overlay.show {
    top: 20px;
}

#feedback-overlay h2 {
    color: var(--primary-color);
    margin: 0 0 10px;
}
#feedback-ok-btn {
    background-color: var(--primary-color);
    color: var(--background-color);
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
    font-size: 1rem;
}


/* Animations */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.shake-animation {
    animation: shake 0.5s;
}

@keyframes odometer {
  from {
    transform: translateY(-1em);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
.odometer-animation {
    animation: odometer 0.3s ease-out;
}

button:active {
    transform: scale(0.95);
}
