: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);
}

:root[data-theme="dark"] {
    --bg-color: #121212;
    --text-dark: #f0f0f0;
    --text-muted: #aaaaaa;
    --border-color: #333333;
    --white: #1e1e1e;
    --success-bg: #1b3d2b;
    --success-text: #4ade80;
    --shadow-card: 0 4px 12px rgba(0,0,0,0.5);
}

* {
    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 {
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 0;
    max-width: none;
    background: var(--bg-color);
    overflow: hidden;
    display: flex;
    z-index: 1000;
}

.auth-split-layout {
    display: flex;
    width: 100%;
    height: 100%;
}

.auth-visual {
    flex: 1;
    background: url('data/auth-bg.png') center/cover no-repeat;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px;
    color: white;
}

.auth-visual::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0,0,0,0.85) 0%, rgba(122, 29, 34, 0.4) 100%);
    z-index: 1;
}

.auth-visual-content {
    position: relative;
    z-index: 2;
    transform: translateY(-20px);
}

.auth-form-side {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    position: relative;
    background: var(--white);
}

/* Optional animated orbs for the form side */
.auth-form-side::before {
    content: '';
    position: absolute;
    top: -10%;
    right: -10%;
    width: 300px;
    height: 300px;
    background: linear-gradient(135deg, rgba(255, 107, 107, 0.2), rgba(117, 29, 33, 0.1));
    border-radius: 50%;
    filter: blur(60px);
    z-index: 0;
    animation: floatAnim 8s ease-in-out infinite;
}

.auth-form-side::after {
    content: '';
    position: absolute;
    bottom: -10%;
    left: -10%;
    width: 250px;
    height: 250px;
    background: linear-gradient(135deg, rgba(79, 172, 254, 0.2), rgba(0, 242, 254, 0.1));
    border-radius: 50%;
    filter: blur(50px);
    z-index: 0;
    animation: floatAnim 6s ease-in-out infinite reverse;
}

@keyframes floatAnim {
    0% { transform: translateY(0px) scale(1); }
    50% { transform: translateY(-30px) scale(1.05); }
    100% { transform: translateY(0px) scale(1); }
}

#auth-view .auth-header {
    margin-bottom: 30px;
    z-index: 1;
}

#auth-view .auth-header .logo-title {
    color: var(--text-dark);
    font-size: 36px;
    letter-spacing: -0.5px;
    font-weight: 800;
    margin-bottom: 0;
}

.auth-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    background: var(--white);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-radius: 28px;
    padding: 48px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.04), 0 0 0 1px rgba(0,0,0,0.02);
}

@media (max-width: 900px) {
    .auth-visual {
        display: none;
    }
    .auth-form-side {
        padding: 20px;
    }
}

.auth-toggle {
    display: flex;
    background: #f1f3f5;
    border-radius: 16px;
    padding: 6px;
    margin-bottom: 30px;
}

.toggle-btn {
    flex: 1;
    border: none;
    background: transparent;
    padding: 12px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-muted);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.toggle-btn.active {
    background: var(--white);
    color: var(--text-dark);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
}

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

.input-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-dark);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input, .input-group textarea {
    width: 100%;
    padding: 16px 20px;
    background: var(--bg-color);
    border: 1px solid rgba(0,0,0,0.06);
    border-radius: 12px;
    font-family: var(--font-body);
    font-size: 15px;
    color: var(--text-dark);
    outline: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.input-group input:focus, .input-group textarea:focus {
    background: var(--white);
    border-color: var(--primary-color);
    box-shadow: 0 4px 20px rgba(0,0,0,0.06), 0 0 0 4px rgba(117, 29, 33, 0.1);
    transform: translateY(-1px);
}

.primary-btn {
    width: 100%;
    background: var(--primary-color);
    color: var(--white);
    border: none;
    border-radius: 14px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-body);
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    margin-top: 15px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.primary-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(117, 29, 33, 0.35);
    filter: brightness(1.1);
}

.primary-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(117, 29, 33, 0.2);
}

.primary-btn:disabled {
    background: #cccccc;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.8;
    animation: none;
}

.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: 12px;
    padding: 16px;
    font-size: 16px;
    font-weight: 700;
    font-family: var(--font-body);
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 12px rgba(211, 47, 47, 0.15);
}

.danger-btn:hover {
    background-color: #b71c1c;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(211, 47, 47, 0.25);
}

.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: 90%;
}

@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOutRight {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

.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-card .primary-btn, 
.reward-card .danger-btn {
    width: auto;
    margin-top: 0;
    padding: 8px 16px;
}

.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: var(--white);
    padding: 40px;
    border-radius: 24px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.1), 0 1px 3px rgba(0,0,0,0.05);
    border: 1px solid var(--border-color);
}

.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;
    }
}
