:root {
    --bg-color: #fcfbf8;
    --primary-color: #7a1d22;
    --primary-hover: #5e161a;
    --text-dark: #333333;
    --text-muted: #666666;
    --border-color: #eaeaea;
    --white: #ffffff;
    --success-bg: #e6f7ec;
    --success-text: #0b8043;
    --font-heading: 'Playfair Display', serif;
    --font-body: 'Inter', sans-serif;
    --radius-lg: 16px;
    --radius-md: 8px;
    --radius-sm: 6px;
    --shadow-card: 0 4px 12px rgba(0,0,0,0.05);
}

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

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-dark);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 600;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: opacity 0.2s;
}

a:hover {
    opacity: 0.8;
}

/* Utilities */
.hidden {
    display: none !important;
}

.view-container {
    width: 100%;
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 20px;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Logo */
.logo-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 24px;
    justify-content: center;
    margin-bottom: 30px;
}

.logo-icon {
    color: var(--primary-color);
}

/* --- Authentication View --- */
#auth-view {
    max-width: 450px;
    margin-top: 10vh;
}

.auth-card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
}

.auth-toggle {
    display: flex;
    background: var(--bg-color);
    border-radius: var(--radius-md);
    padding: 4px;
    margin-bottom: 24px;
}

.toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.toggle-btn.active {
    background: var(--white);
    color: var(--text-dark);
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

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

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text-dark);
}

.input-group input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    font-family: var(--font-body);
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

.primary-btn {
    width: 100%;
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background-color 0.2s;
    margin-top: 10px;
}

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

.primary-btn:disabled {
    background-color: #ccc;
    cursor: not-allowed;
    opacity: 0.8;
}

.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--white);
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.danger-btn {
    background-color: #d32f2f;
    color: var(--white);
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-body);
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.forgot-password {
    display: block;
    text-align: center;
    font-size: 13px;
    margin-top: 20px;
    color: var(--primary-color);
}

.error-message {
    color: #d32f2f;
    font-size: 13px;
    margin-top: -8px;
    margin-bottom: 12px;
    text-align: center;
}

/* --- Dashboard View --- */
.dash-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 40px;
}

.dash-header .logo-title {
    margin-bottom: 0;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 20px;
}

.icon-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: transparent;
    border: none;
    color: var(--text-dark);
    font-family: var(--font-body);
    font-size: 14px;
    cursor: pointer;
    transition: opacity 0.2s;
}

.icon-btn:hover {
    opacity: 0.7;
}

.card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--border-color);
    margin-bottom: 24px;
}

.points-card {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    position: relative;
    overflow: hidden;
}

.points-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    opacity: 0.9;
    margin-bottom: 16px;
}

.points-value {
    font-size: 64px;
    font-family: var(--font-heading);
    line-height: 1;
    margin-bottom: 8px;
}

.points-greeting {
    font-size: 14px;
    opacity: 0.9;
}

.progress-container {
    margin-top: 20px;
}

.progress-bar-bg {
    background-color: rgba(255, 255, 255, 0.2);
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.progress-bar-fill {
    background-color: var(--white);
    height: 100%;
    width: 0%;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 13px;
    opacity: 0.9;
}

.qr-card {
    display: flex;
    align-items: center;
    gap: 30px;
}

.qr-container {
    background: var(--white);
    padding: 10px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    width: 120px;
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.qr-container img {
    max-width: 100%;
}

.qr-info {
    flex: 1;
}

.card-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 18px;
    margin-bottom: 8px;
}

.card-desc {
    color: var(--text-muted);
    font-size: 14px;
}

.list-section {
    margin-bottom: 30px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-color);
    font-size: 20px;
    margin-bottom: 16px;
}

.reward-card {
    background: var(--white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 15px 20px;
    margin-bottom: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    transition: transform 0.2s, box-shadow 0.2s;
}

.reward-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

.reward-info h4 {
    font-family: var(--font-body);
    font-size: 16px;
    margin-bottom: 4px;
}

.reward-info p {
    font-size: 13px;
    color: var(--text-muted);
}

.reward-action button {
    background-color: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 20px;
    padding: 6px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: opacity 0.2s;
}

.reward-action button:hover {
    opacity: 0.8;
}

.reward-action button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

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

.history-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.history-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.history-icon.plus {
    background-color: #e6f7ec;
    color: #0b8043;
}

.history-icon.minus {
    background-color: #fce8e6;
    color: #d32f2f;
}

.history-details h4 {
    font-family: var(--font-body);
    font-size: 14px;
    margin-bottom: 2px;
}

.history-details p {
    font-size: 12px;
    color: var(--text-muted);
}

.history-points {
    font-weight: 600;
    font-size: 14px;
}

.history-points.plus {
    color: #0b8043;
}

.history-points.minus {
    color: #d32f2f;
}

.empty-state {
    color: var(--text-muted);
    font-size: 14px;
}

.empty-state-card {
    padding: 20px 30px;
    color: var(--text-muted);
    font-size: 14px;
    margin-bottom: 0;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--success-bg);
    color: var(--success-text);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
    border: 1px solid rgba(11, 128, 67, 0.2);
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { top: -50px; opacity: 0; }
    to { top: 20px; opacity: 1; }
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease;
}

.modal-content {
    background-color: var(--white);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
}

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

.modal-header h2 {
    font-size: 20px;
    font-family: var(--font-heading);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: var(--text-muted);
}

.close-btn:hover {
    color: var(--text-dark);
}

.modal-body {
    display: flex;
    flex-direction: column;
}

@media (max-width: 600px) {
    .qr-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 20px;
    }
}
