/* --- Updated CSS Variables and Global Styles --- */
:root {
    /* Monochrome accent colors for a "lighter black" theme */
    --accent-color: #4B5563; /* Lighter black (charcoal) */
    --accent-hover: #374151; /* Darker charcoal for hover */
    --accent-color-rgb: 75, 85, 99;

    /* --- NEW: Button colors for green theme --- */
    --button-primary-bg: #89e01a;
    --button-primary-hover: #89e01a; /* A darker green for hover */
    --button-primary-bg-rgb: 158, 255, 31;
    --button-primary-text: #333; /* Dark text for high contrast */

    --page-background: #F9FAFB;
    --card-background: #ffffff;
    --text-color: #333;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --border-light: #F3F4F6;
    --success-color: #89e01a;
    --danger-color: #EF4444;
    --warning-color: #F59E0B;
    
    --font-family: 'Mona Sans', sans-serif;
    --border-radius: 16px;
    --border-radius-sm: 8px;
    
    --box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.07);
    --box-shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    
    --transition-fast: all 0.2s ease-in-out;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--page-background);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    padding: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
    margin-bottom: 0.75rem;
    font-weight: 700;
    line-height: 1.3;
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

p {
    margin-bottom: 1rem;
    line-height: 1.6;
    text-align: justify;
}

a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition-fast);
}

a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Prevent checkbox and radio labels from getting underlined - Enhanced specificity */
.terms-container label,
.radio-group label,
label[for="terms-checkbox"] {
    text-decoration: none !important;
}

.terms-container label:hover,
.radio-group label:hover,
label[for="terms-checkbox"]:hover {
    text-decoration: none !important;
}

/* Only the actual links within labels should get underlined */
.terms-container label a,
.radio-group label a {
    text-decoration: none;
}

.terms-container label a:hover,
.radio-group label a:hover {
    text-decoration: underline !important;
    color: var(--accent-hover);
}

/* Strong override for desktop - ensure label text never gets underlined */
.terms-container:hover label,
.radio-group:hover label,
label[for="terms-checkbox"]:hover {
    text-decoration: none !important;
}

/* Additional desktop-specific override */
@media (min-width: 769px) {
    .terms-container label,
    .terms-container label:hover,
    .radio-group label,
    .radio-group label:hover {
        text-decoration: none !important;
    }
    
    .terms-container label a:hover,
    .radio-group label a:hover {
        text-decoration: underline !important;
    }
}

hr {
    border: none;
    border-top: 1px solid var(--border-light);
    margin: 1.5rem 0;
}

ul {
    list-style: none;
    width: 100%;
}

/* --- Layout and Main Components --- */
header {
    width: 100%;
    max-width: 800px;
    display: flex;
    justify-content: center; /* Centers the logo horizontally */
    margin-bottom: 1.5rem; /* Space between header and QR code */
}

footer {
    width: 100%;
    max-width: 800px;
    text-align: center;
    padding: 0.75rem 0; /* Reduced from 1rem for more compact look */
    margin-top: 2rem;
    font-size: 0.8rem; /* Smaller text size */
    color: #8B8B8B; /* Lighter black color */
}

.footer-texts {
    display: flex;
    justify-content: center;
    gap: 1rem; /* Reduced from 1.5rem for more compact spacing */
    margin-bottom: 0.5rem; /* Reduced from 0.75rem for less line spacing */
    font-size: 0.8rem; /* Smaller text size */
    flex-wrap: wrap;
    line-height: 1.4; /* Tighter line height */
}

.footer-texts a {
    color: #8B8B8B; /* Lighter black color matching footer */
    text-decoration: none;
}

.footer-texts a:hover {
    color: var(--accent-color);
    text-decoration: none;
}

#logo {
    height: 70px;
    margin-bottom: 0.5rem;
    display: block !important; /* Forces the logo to be always visible */
}

main {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1; /* Pushes footer down */
}

.card {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    box-shadow: 0 8px 25px -5px rgba(0, 0, 0, 0.15), 0 4px 10px -3px rgba(0, 0, 0, 0.1);
    padding: 0 2.5rem 2.5rem 2.5rem; /* No top padding - QR goes outside card visually */
    width: 100%;
    max-width: 800px;
    margin-top: 2rem;
    display: none;
    flex-direction: column;
    gap: 1.5rem;
    border: 1px solid var(--border-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Remove top margin for customer accounts (when header logo is hidden) */
#wallet_div:not(.business-wallet) {
    margin-top: 0;
}

.card:hover {
    box-shadow: var(--box-shadow-lg);
}

/* --- Buttons --- */
button {
    padding: 0.875rem 1.5rem;
    border: 1px solid transparent;
    border-radius: var(--border-radius-sm);
    font-family: var(--font-family);
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-fast);
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

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

button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.primary {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    box-shadow: 0 4px 10px rgba(var(--button-primary-bg-rgb), 0.2);
}

.primary:hover:not(:disabled) {
    background-color: var(--button-primary-hover);
    box-shadow: 0 6px 12px rgba(var(--button-primary-bg-rgb), 0.25);
    transform: translateY(-2px);
}

.secondary {
    background-color: transparent;
    color: var(--accent-color);
    border: 1px solid var(--accent-color);
}

.secondary:hover {
    background-color: rgba(var(--accent-color-rgb), 0.05);
    border-color: var(--accent-hover);
    color: var(--accent-hover);
}

.danger {
    background-color: transparent;
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.danger:hover {
    background-color: rgba(239, 68, 68, 0.05);
}

.button-group {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.button-group button {
    flex: 1;
}

button.small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.minor-actions-group {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    width: 100%;
    margin-top: 1rem;
}

/* --- History Toggle Buttons --- */
#toggle-customer-overall-history-btn,
#toggle-business-overall-history-btn {
    margin-top: 0;
    margin-bottom: 1rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    margin-left: 0;
    margin-right: 0;
}

#toggle-customer-overall-history-btn.active,
#toggle-business-overall-history-btn.active,
.toggle-history-btn-small.active {
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    border-color: transparent;
    box-shadow: 0 4px 10px rgba(var(--button-primary-bg-rgb), 0.2);
}

/* --- Forms & Inputs --- */
form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

label {
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.form-field-group label {
    margin-bottom: 0;
}

#customer-fields,
#business-fields {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

input[type="text"],
input[type="number"],
input[type="date"],
#business-name,
#business-address {
    max-width: 100%;
    box-sizing: border-box;
    width: 100%;
    padding: 0.875rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 1rem;
    font-family: var(--font-family);
    background-color: var(--page-background);
    transition: var(--transition-fast);
    -webkit-appearance: none; /* Remove Safari default styling */
    appearance: none;
    margin: 0; /* Reset any default margins */
    min-height: 3.25rem; /* Fixed height for consistency, especially on Safari */
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
#business-name:focus,
#business-address:focus {
    outline: none;
    border-color: var(--accent-color);
    background-color: var(--card-background);
    box-shadow: 0 0 0 3px rgba(var(--accent-color-rgb), 0.15);
}

.radio-group, .terms-container {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0.5rem 0;
}

.radio-group {
    justify-content: center;
    padding: 1rem 0;
}

.terms-container {
    margin-top: 2rem;
    margin-bottom: 1rem;
    padding: 0.5rem 0;
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
}

.terms-container input[type="checkbox"] {
    margin-top: 0.25rem;
    margin-right: 0;
    flex-shrink: 0;
}

.terms-container label {
    line-height: 1.5;
}

input[type="radio"],
input[type="checkbox"] {
    margin-right: 0.5rem;
}

.form-note {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    text-align: center;
    font-style: italic;
}

#user-info-submit {
    margin-top: 1rem;
    align-self: center;
    min-width: 200px;
    padding: 0.875rem 2rem;
}

/* --- OLD: Removed price-tag styles --- */
/*
.price-tag {
    display: inline-block;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    padding: 0.2rem 0.6rem;
    font-size: 0.8rem;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    margin-left: 0.5rem;
    vertical-align: middle;
}
*/

/* --- NEW: Text highlight for "free" --- */
.highlight {
    color: var(--success-color);
}

/* --- Auth Div & Reordered Layout --- */
#auth_div {
    display: none; /* Hidden by default to prevent flash */
    flex-direction: column;
    width: 100%;
    max-width: 800px;
    align-items: center;
    gap: 2rem;
    margin-top: 0.5rem;
}

.main-headline {
    font-size: 2.75rem;
    text-align: center;
    margin-bottom: 0;
    line-height: 1.2;
    font-weight: 800;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.cta-container{
    text-align: left;
    max-width: 400px;
    margin: 0 auto 1.5rem auto;
}

.about-us-heading {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    text-align: center;
    width: 100%;
    font-weight: 700;
}

/* Position Google sign-in button below the main headline */
#g_id_signin_wrapper,
#g_id_signin_wrapper_main {
    margin: 3rem auto;
    display: flex;
    justify-content: center;
    padding: 1rem 0;
}


.benefits-grid-wrapper {
    width: 100%;
    background-color: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
}

.how-it-works-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    text-align: center;
    margin-top: 0;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.work-step {
    text-align: justify;
    padding: 0;
    border-radius: var(--border-radius);
    transition: none;
    border: none;
}

.work-step h3 {
    text-align: center;
    font-size: 1.35rem;
    margin-bottom: 1rem;
    color: var(--accent-color);
}

.work-step p {
    font-size: 1rem;
    margin-bottom: 0;
    line-height: 1.6;
    color: var(--text-secondary);
}

#our-story-mission {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-align: left;
    background-color: transparent;
    border: none;
    box-shadow: none;
    padding-top: 0;
    margin-top: 0;
    margin-bottom: 2rem;
}

#our-story-mission .container {
    background-color: transparent;
    padding: 0;
    border: none;
    box-shadow: none;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

#our-story-mission h2 {
    text-align: center;
    font-size: 1.35rem;
    margin-bottom: 1.5rem;
    color: var(--accent-color);
}

#our-story-mission p {
    text-align: justify;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* --- Wallet Div --- */
#wallet_div {
    gap: 1.5rem;
       background-color: transparent;
       box-shadow: none;
    border: none;
}

#wallet-header {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

#wallet-business-logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
    display: none;
}

#wallet-business-logo.editable {
    cursor: pointer;
    transition: filter 0.2s;
}

#wallet-business-logo.editable:hover {
    filter: brightness(0.9);
}

.wallet-user-info {
    flex: 1;
}

#wallet-user-name {
    font-size: 1.75rem;
    font-weight: 700;
}

#wallet-business-id-container {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 4px;
}

.business-address {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.editable-field-span {
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    border-radius: var(--border-radius-sm);
    transition: var(--transition-fast);
}

.editable-field-span:hover {
    background-color: rgba(var(--accent-color-rgb), 0.1);
}

.editable-field-wrapper {
    display: flex;
    gap: 0.5rem;
}

.editable-field-input {
    flex-grow: 1;
    padding: 0.5rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
}

/* --- Business Section --- */
#business-scan-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}
#scan-qr-code-btn {
    width: 100%;
    max-width: 400px;
}

.scan-disabled-alert {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    background-color: #fff3cd;
    border: 1px solid #ffeaa7;
    border-radius: 6px;
    width: 100%;
    max-width: 400px;
}

.scan-disabled-alert p {
    margin: 0;
    color: #856404;
    font-size: 0.875rem;
    text-align: center;
    line-height: 1.4;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
}

.stats-grid > div {
    text-align: center;
    padding: 1.25rem;
    background: var(--page-background);
    border-radius: var(--border-radius);
    border: 1px solid var(--border-light);
}

.stats-grid h4 {
    margin-bottom: 0.5rem;
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.stats-grid span {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--accent-color);
}

#business-customer-info {
    padding: 1.25rem;
    background-color: var(--page-background);
    border-radius: var(--border-radius);
    line-height: 1.5;
    border: 1px solid var(--border-light);
}

.error-message {
    color: var(--danger-color);
    font-weight: 500;
}

#business-overall-history,
#customer-overall-history {
    margin-top: 1rem;
}

#business-overall-history-list {
    max-height: 60vh;
    overflow-y: auto;
    background-color: transparent;
}

/* Custom scrollbar styling for business overall history list */
#business-overall-history-list::-webkit-scrollbar {
    width: 6px;
}

#business-overall-history-list::-webkit-scrollbar-track {
    background: transparent;
}

#business-overall-history-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#business-overall-history-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* --- Business Subscription Section --- */
#business-trial-section {
    text-align: center;
    padding: 2rem;
    background-color: var(--page-background);
    border: 1px dashed var(--border-color);
    border-radius: var(--border-radius);
    margin-bottom: 2rem;
}

#business-trial-section h3 {
    color: var(--accent-color);
    margin-bottom: 1rem;
}

#business-trial-section p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

#business-details-form {
    margin-top: 3rem !important;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.form-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.form-field-group label {
    margin-bottom: 0;
}

#business-account-status {
    padding: 1rem;
    background-color: rgba(var(--accent-color-rgb), 0.05);
    border-radius: var(--border-radius-sm);
    text-align: center;
    margin-bottom: 1.5rem;
    font-weight: 500;
    display: none; /* Hidden by default, will be shown in manage account */
}

#business-account-status.trial-active {
    background-color: rgba(var(--button-primary-bg-rgb), 0.1);
    color: var(--accent-color);
}

#business-account-status.trial-expired {
    background-color: rgba(245, 158, 11, 0.1); /* warning color */
    color: #b45309;
    border: 1px solid #f97316;
}

#business-account-status.subscribed {
     background-color: rgba(var(--button-primary-bg-rgb), 0.1);
    color: var(--accent-color);
}

#business-account-status button {
    margin-top: 1rem;
}


/* --- Customer Section --- */
#customer-business-section {
    position: relative;
    display: flex;
    flex-direction: column;
}

#customer-business-points-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 400px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    max-height: 75vh; /* Increased from 60vh to 75vh for better visibility */
    overflow-y: auto; /* Add vertical scroll when needed */
    padding-right: 1rem; /* Increased space for scrollbar to avoid overlap */
    box-sizing: border-box;
}

/* Custom scrollbar styling for the business list */
#customer-business-points-list::-webkit-scrollbar {
    width: 6px;
}

#customer-business-points-list::-webkit-scrollbar-track {
    background: transparent;
}

#customer-business-points-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#customer-business-points-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Fade effect at bottom when scrollable */
#customer-business-section::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 20px;
    background: linear-gradient(transparent, var(--page-background));
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

/* Show fade effect when list is scrollable and not at bottom */
#customer-business-section.has-scroll::after {
    opacity: 1;
}

#customer-business-points-list li.customer-points-item {
    background-color: transparent;
    border: 1px solid var(--border-light);
    border-radius: var(--border-radius);
    overflow: visible; /* Changed from hidden to visible to prevent content cutoff */
    transition: var(--transition-fast);
    width: 100%;
    box-sizing: border-box;
    margin-bottom: 0.5rem; /* Extra space between items for better separation */
}

.customer-points-item:hover {
    border-color: var(--accent-color);
    background-color: rgba(var(--accent-color-rgb), 0.02);
}

.customer-points-item.active {
    border-color: var(--button-primary-bg);
}

.customer-points-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem;
    width: 100%;
    box-sizing: border-box;
}

.business-logo-small {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.business-info-wrapper {
    flex-grow: 1;
    min-width: 0; /* Prevents flex item from overflowing when using text-overflow */
}

.business-name-display {
    font-weight: bold;
    color: var(--accent-color);
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.business-meta-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.business-address-display {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.points-display {
    font-size: 1.35rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--success-color);
}

.toggle-history-btn-small {
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    padding: 0.3rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.toggle-history-btn-small:hover {
    background-color: var(--border-light);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.business-details-container {
    padding: 0.75rem 1.25rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border-light);
    display: none;
    width: 100%;
    box-sizing: border-box;
    background-color: rgba(var(--accent-color-rgb), 0.02);
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.loading-text-small {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

/* Last transaction date styling */
.last-transaction-date {
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
    font-style: italic;
}

/* --- Clean QR Code Display --- */
#card-qr-code-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: -1.5rem auto 1.5rem auto; /* Negative margin to sit between header and card, then space before search */
    width: fit-content;
    padding: 0.5rem 0;
    position: relative;
    z-index: 2; /* Above card background */
}

#card-qr-code-container img {
    background: white;
    padding: 15px;
    border-radius: var(--border-radius);
    width: 160px;
    height: 160px;
    border: 2px solid var(--border-color);
    transition: transform 0.3s ease;
}

#card-qr-code-container img:hover {
    transform: translateY(-3px);
}

/* --- Loading Overlay --- */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.6);
    display: flex; /* Visible by default for initial load */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
}

.loading-box {
    background-color: white;
    padding: 2.5rem;
    border-radius: var(--border-radius);
    text-align: center;
    box-shadow: var(--box-shadow-lg);
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-light);
    border-top: 4px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 1.5rem auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#loading-message {
    font-weight: 500;
    color: var(--text-secondary);
}

/* --- Cookie Consent Banner --- */
#cookie-consent-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: var(--card-background);
    padding: 1.25rem;
    display: none; /* Hidden by default */
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 100;
    flex-wrap: wrap;
    gap: 1rem;
}

#cookie-consent-banner p {
    margin-bottom: 0;
    flex: 1;
    min-width: 300px;
}

#cookie-accept-btn {
    white-space: nowrap;
}

/* --- Modal Styles --- */
#customer-action-modal,
.custom-modal-overlay,
#qr-scanner-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 1rem;
}

.modal-content {
    background-color: var(--card-background);
    border-radius: var(--border-radius);
    padding: 2.5rem;
    width: 100%;
    max-width: 500px;
    position: relative;
    box-shadow: var(--box-shadow-lg);
}

#modal-close-btn, #scanner-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: none;
    border: none;
    font-size: 1.75rem;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0;
    width: auto;
    height: auto;
}

#modal-close-btn:hover, #scanner-close-btn:hover {
    color: var(--text-color);
    background: none;
}

#modal-header {
    margin-bottom: 1.5rem;
}

#modal-customer-details {
    margin-top: 1rem;
    padding: 1rem;
    background-color: var(--page-background);
    border-radius: var(--border-radius-sm);
    font-size: 0.9rem;
}

#business-points-actions {
    margin-bottom: 1.5rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
}

#business-transaction-history h4 {
    margin-bottom: 1rem;
}

#business-transaction-list {
    max-height: 300px;
    overflow-y: auto;
    background-color: transparent;
}

/* Custom scrollbar styling for business transaction list */
#business-transaction-list::-webkit-scrollbar {
    width: 6px;
}

#business-transaction-list::-webkit-scrollbar-track {
    background: transparent;
}

#business-transaction-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

#business-transaction-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

#business-transaction-list li {
    background-color: transparent;
    font-size: 0.8rem;
    padding: 0.4rem 0.5rem;
    margin-bottom: 0.25rem;
    line-height: 1.3;
}

.custom-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

/* --- Styles for points input group in modal --- */
.points-input-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.points-input-group input {
    flex-grow: 1; /* Allows the input field to take up the available space */
}

.points-input-group button {
    flex-shrink: 0; /* Prevents buttons from shrinking if space is tight */
}

/* --- QR Scanner Modal Styles --- */
#qr-scanner-modal .modal-content {
    max-width: 450px;
    text-align: center;
}
#qr-reader {
    width: 100%;
    border-radius: var(--border-radius-sm);
    overflow: hidden;
    border: 1px solid var(--border-color);
    margin-top: 1rem;
}
#qr-scan-result {
    margin-top: 1rem;
    font-weight: 500;
    min-height: 1.6em;
}

/* QR Scanner Status Styles */
.scan-status.initializing {
    color: var(--primary-color);
    font-weight: 500;
}

.scan-status.ready {
    color: var(--success-color);
    font-weight: 500;
}

.scan-status.verifying {
    color: var(--primary-color);
    font-weight: 500;
}

.scan-status.error {
    color: var(--error-color);
    font-weight: 600;
    background-color: rgba(239, 68, 68, 0.1);
    padding: 0.75rem;
    border-radius: var(--border-radius-sm);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

/* --- Customer Overall History List --- */
#customer-overall-history-list {
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

#customer-overall-history-list li {
    list-style: none;
    background-color: transparent;
}

#business-overall-history-list li {
    background-color: transparent;
    padding: 0.4rem 0.75rem;
    border-radius: var(--border-radius-sm);
    margin-bottom: 0.25rem;
    font-size: 0.8rem;
    line-height: 1.3;
}

#business-overall-history-list li:last-child {
    border-bottom: none;
}

.simple-history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background-color: transparent;
    border-radius: var(--border-radius);
    margin-bottom: 0.75rem;
    transition: var(--transition-fast);
}

.simple-history-item:hover {
    border-color: var(--border-color);
    transform: translateY(-2px);
    box-shadow: var(--box-shadow);
}

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

.simple-history-business-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-grow: 1;
}

.simple-history-logo {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--border-light);
}

.simple-history-business-name {
    font-weight: 600;
    color: var(--accent-color);
}

.simple-history-points {
    font-weight: 700;
    font-size: 1.1rem;
    white-space: nowrap;
}

.simple-history-points.points-sent {
    color: var(--success-color);
}

.simple-history-points.points-retrieved {
    color: var(--danger-color);
}

/* --- New Account Management Styles --- */
.card-footer-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1.5rem;
    padding-top: 0;
}

#manage-account-btn {
    max-width: 400px;
    width: 100%;
    border: none !important;
    color: #999 !important;
}

#minor-actions-container {
    display: none; /* Hides the buttons by default */
    flex-direction: column;
    gap: 0.5rem; /* Adds space between elements */
    max-width: 400px;
    width: 100%;
}

.user-email-display {
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
    margin: 0.75rem 0;
}

.subscription-status-display {
    text-align: center;
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--bg-light);
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.subscription-status-display p {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    text-align: center;
}

.subscription-status-display button {
    margin-top: 0.5rem;
    align-self: center;
    font-size: 0.8rem;
}

.minor-actions-buttons {
    display: flex;
    gap: 0.75rem;
    width: 100%;
}

.minor-actions-buttons button {
    flex: 1;
}


/* --- Responsive Design --- */
@media (max-width: 768px) {
    body {
        padding: 1rem;
    }

    .main-headline {
        font-size: 2rem;
    }

    .how-it-works-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
        padding: clamp(1rem, 5%, 1.75rem);
    }

    .work-step {
        padding: 0;
    }

    .work-step h3 {
        font-size: 1.25rem;
    }
    
    #our-story-mission .container {
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
        padding: clamp(1rem, 5%, 1.75rem);
    }
    
    .button-container {
        max-width: 400px;
    }

    .card {
        padding: 1.5rem;
    }

    /* Fix Google Sign-in button spacing on mobile */
    #g_id_signin_wrapper,
    #g_id_signin_wrapper_main {
        margin: 2rem auto;
        padding: 0.5rem 0;
    }

    /* Mobile adjustments for clean layout */
    #card-qr-code-container {
        margin: -1rem auto 1rem auto; /* Adjusted negative margin for mobile */
        padding: 0.25rem 0;
    }
    
    .search-container {
        margin-top: 1rem; /* Adjusted for mobile */
        margin-bottom: 0;
    }
    
    .refresh-container {
        width: 140px; /* Match mobile QR code width */
        margin: 1.5rem auto 1.5rem auto; /* Consistent mobile spacing */
    }

    #card-qr-code-container img {
        width: 140px;
        height: 140px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    /* FIX: Make footer links stack vertically on mobile - more compact */
    .footer-texts {
        flex-direction: column;
        align-items: center;
        gap: 0.3rem; /* Even tighter spacing on mobile */
        font-size: 0.75rem; /* Smaller text on mobile */
        line-height: 1.3; /* Tighter line height on mobile */
    }
    /* END FIX */

    #cookie-consent-banner {
        flex-direction: column;
        text-align: center;
    }

    #cookie-consent-banner p {
        min-width: auto;
    }

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

@media (max-width: 480px) {
    .main-headline {
        font-size: 1.75rem;
    }

    /* Extra tight spacing on very small screens */
    #g_id_signin_wrapper,
    #g_id_signin_wrapper_main {
        margin: 1.5rem auto;
        padding: 0.5rem 0;
    }

    #card-qr-code-container {
        margin: 0.5rem auto;
        padding: 0.25rem 0;
    }

    #card-qr-code-container img {
        width: 120px;
        height: 120px;
        padding: 12px;
    }

    #wallet-header {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }

    .customer-points-item-header {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        column-gap: 0.75rem;
    }

    .business-logo-small {
        order: 1;
    }

    .points-display {
        order: 2;
        margin-left: auto;
    }

    .toggle-history-btn-small {
        order: 3;
    }

    .business-info-wrapper {
        order: 4;
        width: 100%;
        margin-top: 0.5rem;
    }

    /* Fix for mobile Safari date input issues */
    input[type="date"] {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        -webkit-appearance: none !important;
        appearance: none !important;
        text-align: center;
        min-height: 3.25rem !important; /* Consistent height on mobile Safari */
        line-height: 1.5 !important; /* Better vertical alignment */
    }

    /* Mobile-specific customer business list improvements */
    #customer-business-points-list {
        max-height: 80vh; /* More space on mobile */
        padding-right: 0.5rem; /* Reduce padding on mobile */
    }

    .business-details-container {
        padding: 0.5rem 1rem 1rem 1rem; /* Reduce padding on mobile */
    }

    .customer-points-item-header {
        padding: 1rem; /* Reduce padding on mobile */
    }
}

/* --- NEW: Search Bar Styles --- */
.search-container {
    padding: 0 !important; /* Override card padding */
    box-shadow: none !important;
    border: none !important;
    background-color: transparent !important;
    margin-top: 1.5rem; /* Space from card top since QR is positioned above */
    margin-bottom: 0; /* No bottom margin - refresh button handles spacing */
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

#business-search-input {
    width: 100%;
    padding: 1rem 1rem 1rem 3rem;
    font-size: 1rem;
    border-radius: 50px;
    border: 2px solid var(--border-light);
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%236B7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: 1rem center;
    background-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    margin-top: 0; /* Remove artificial spacing - rely on natural flow */
}

#business-search-input:focus {
    outline: none;
    border-color: var(--button-primary-bg);
    box-shadow: 0 0 0 3px rgba(var(--button-primary-bg-rgb), 0.2), 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: var(--card-background);
    transform: translateY(-1px);
}

#business-search-input::placeholder {
    color: var(--text-secondary);
    font-weight: 400;
}

/* --- Button Container and Back Button Styles (for about.html) --- */
.button-container {
    display: flex;
    justify-content: center;
    margin-top: 2rem;
    max-width: 90%;
    margin-left: auto;
    margin-right: auto;
}

.back-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    background-color: var(--button-primary-bg);
    color: var(--button-primary-text);
    text-decoration: none;
    border-radius: var(--border-radius-sm);
    font-weight: 600;
    font-size: 0.875rem;
    transition: var(--transition-fast);
    box-shadow: 0 4px 10px rgba(var(--button-primary-bg-rgb), 0.2);
}

.back-button:hover {
    background-color: var(--button-primary-hover);
    color: var(--button-primary-text);
    text-decoration: none;
    box-shadow: 0 6px 12px rgba(var(--button-primary-bg-rgb), 0.25);
    transform: translateY(-2px);
}

/* Refresh Button for Customer Accounts */
.refresh-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 1.5rem auto 1.5rem auto; /* Space after search, before business list */
    padding: 0;
    width: 160px; /* Match QR code width exactly */
}

.refresh-btn-light {
    background-color: #F9FAFB !important;
    border: none !important; /* Remove border */
    color: #999 !important;
    width: 100%; /* Fill container width (160px) */
    margin: 0;
    font-size: 0.9rem !important; /* Slightly larger font size */
    padding: 0.75rem 1rem !important; /* Adjust padding for smaller text */
}

.refresh-btn-light:hover {
    background-color: #F9FAFB !important; /* Same as normal state - no hover effect */
    border: none !important;
    color: #999 !important; /* Same as normal state - no hover effect */
}

.refresh-btn-light:disabled {
    background-color: #fafafa !important;
    border: none !important; /* Remove border when disabled too */
    color: #ccc !important;
}

.refresh-btn-light:active,
.refresh-btn-light:focus {
    background-color: #F9FAFB !important; /* Same as normal state - no click effect */
    border: none !important;
    color: #999 !important; /* Same as normal state - no click effect */
    outline: none !important; /* Remove focus outline */
    box-shadow: none !important; /* Remove any focus box shadow */
    transform: none !important; /* Remove any click transform */
}
