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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #f3f4f6;
    min-height: 100vh;
    color: #1f2937;
}

.page {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Home Page */
.home-page {
    background: linear-gradient(180deg, #7c3aed 0%, #5b21b6 100%);
    color: white;
}

.home-header {
    text-align: center;
    padding: 60px 20px 40px;
}

.logo {
    font-size: 48px;
    font-weight: 800;
    letter-spacing: -1px;
}

.tagline {
    margin-top: 8px;
    opacity: 0.9;
    font-size: 16px;
}

.home-content {
    flex: 1;
    background: #f3f4f6;
    border-radius: 24px 24px 0 0;
    padding: 32px 20px;
    color: #1f2937;
}

.features-section h3 {
    font-size: 14px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 16px;
}

.features-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 32px;
}

.feature-item {
    display: flex;
    align-items: center;
    padding: 16px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.feature-item.clickable {
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
}

.feature-item.clickable:active {
    transform: scale(0.98);
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
}

.feature-item.disabled {
    opacity: 0.6;
}

.feature-icon {
    font-size: 24px;
    margin-right: 16px;
}

.feature-text {
    flex: 1;
    font-size: 16px;
    font-weight: 500;
}

.soon-badge {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 20px;
    text-transform: uppercase;
}

.arrow {
    font-size: 24px;
    color: #9ca3af;
    margin-left: 8px;
}

.btn-scan {
    width: 100%;
    padding: 18px 24px;
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
    color: white;
    border: none;
    border-radius: 16px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4);
}

.btn-icon {
    font-size: 24px;
}

.home-footer {
    background: #f3f4f6;
    text-align: center;
    padding: 20px;
    color: #9ca3af;
    font-size: 12px;
}

/* Header */
.header {
    background: #7c3aed;
    color: white;
    padding: 48px 16px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
}

.header h1 {
    flex: 1;
    font-size: 18px;
    font-weight: 600;
}

.header .logo-small {
    font-size: 14px;
    font-weight: 700;
    opacity: 0.8;
}

.back-btn {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    padding: 4px 8px;
    cursor: pointer;
}

.status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #22c55e;
}

/* Content */
.content {
    flex: 1;
    padding: 16px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.center-content {
    justify-content: center;
    align-items: center;
}

/* Icons */
.icon {
    width: 100%;
    height: 100%;
}

.icon.spin {
    animation: spin 1s linear infinite;
}

.icon.chevron {
    width: 20px;
    height: 20px;
}

.chevron {
    transition: transform 0.2s;
}

.chevron.rotated {
    transform: rotate(180deg);
}

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

/* Scan Prompt */
.scan-prompt {
    text-align: center;
    padding: 20px;
    width: 100%;
    max-width: 320px;
}

.phone-icon {
    width: 96px;
    height: 96px;
    margin: 0 auto 24px;
    color: #7c3aed;
}

.phone-icon.pulse {
    animation: pulse 2s ease-in-out infinite;
}

.phone-icon.gray {
    color: #9ca3af;
}

.phone-icon.error {
    color: #ef4444;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.05); opacity: 0.8; }
}

.scan-title {
    font-size: 22px;
    font-weight: 700;
    color: #7c3aed;
    margin-bottom: 8px;
}

.scan-title.error-text {
    color: #ef4444;
}

.scan-subtitle {
    color: #6b7280;
    font-size: 14px;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Buttons */
.btn-primary {
    background: #7c3aed;
    color: white;
    border: none;
    padding: 14px 32px;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
}

.btn-primary:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-primary.full-width {
    width: 100%;
}

.btn-secondary {
    background: transparent;
    color: #7c3aed;
    border: 2px solid #7c3aed;
    padding: 12px 24px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.btn-secondary.full-width {
    width: 100%;
}

/* Manual Input */
.manual-input-section {
    margin-top: 8px;
    width: 100%;
}

.manual-input {
    width: 100%;
    padding: 14px 16px;
    font-size: 16px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    margin-bottom: 12px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    outline: none;
}

.manual-input:focus {
    border-color: #7c3aed;
}

.manual-error {
    color: #ef4444;
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
}

/* Balance Card */
.balance-card {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
    padding: 24px;
    margin-bottom: 16px;
}

.balance-main {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 4px;
}

.wallet-icon {
    width: 32px;
    height: 32px;
    color: #7c3aed;
}

.balance-amount {
    font-size: 36px;
    font-weight: 700;
    color: #1f2937;
}

.balance-label {
    text-align: center;
    color: #6b7280;
    font-size: 14px;
}

.points-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e5e7eb;
}

.star-icon {
    width: 20px;
    height: 20px;
    color: #eab308;
}

.points-amount {
    font-size: 20px;
    font-weight: 700;
    color: #ca8a04;
}

.tag-id {
    text-align: center;
    color: #9ca3af;
    font-size: 12px;
    margin-top: 12px;
}

/* History Card */
.history-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 200px;
    margin-bottom: 16px;
}

.history-header {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-header .icon {
    width: 16px;
    height: 16px;
    color: #9ca3af;
}

.history-list {
    flex: 1;
    overflow-y: auto;
}

.history-item {
    width: 100%;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: none;
    background: none;
    border-bottom: 1px solid #f3f4f6;
    cursor: pointer;
    text-align: left;
}

.history-item:active {
    background: #f3f4f6;
}

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

.tx-icon {
    font-size: 24px;
}

.tx-details {
    display: flex;
    flex-direction: column;
}

.tx-label {
    font-weight: 500;
    font-size: 14px;
    color: #1f2937;
}

.tx-date {
    font-size: 12px;
    color: #9ca3af;
}

.tx-amount {
    font-weight: 700;
    font-size: 14px;
}

.tx-amount.green { color: #16a34a; }
.tx-amount.red { color: #ef4444; }
.tx-amount.yellow { color: #ca8a04; }

.no-history {
    text-align: center;
    color: #9ca3af;
    padding: 32px 16px;
}

/* Bottom Buttons */
.bottom-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Loading */
.loading-page, .error-page {
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #e5e7eb;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 16px;
}

/* Modal */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    padding: 16px;
}

.modal {
    background: white;
    border-radius: 16px;
    width: 100%;
    max-width: 400px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 20px;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
}

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

.modal-amount-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 12px;
}

.modal-amount-box.yellow {
    background: #fef9c3;
}

.modal-amount-label {
    color: #6b7280;
}

.modal-amount {
    font-size: 24px;
    font-weight: 700;
}

.modal-amount.green { color: #16a34a; }
.modal-amount.red { color: #ef4444; }
.modal-amount.yellow { color: #ca8a04; }

.modal-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
}

.modal-row span:first-child {
    color: #6b7280;
}

.modal-row.bold span:last-child {
    font-weight: 700;
}

.mono {
    font-family: monospace;
    font-size: 12px;
}

.modal-divider {
    border-top: 1px solid #e5e7eb;
    margin: 8px 0;
}

.items-header {
    font-weight: 600;
    margin-bottom: 8px;
}

.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    background: #f0fdf4;
    border-radius: 12px;
    margin-bottom: 8px;
}

.item-name {
    font-weight: 500;
    color: #1f2937;
}

.item-price {
    font-size: 12px;
    color: #6b7280;
}

.item-total {
    font-weight: 700;
    color: #16a34a;
}

/* Menu Page */
.menu-content {
    padding: 16px;
}

.menu-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    color: #1f2937;
}

.vendors-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vendor-accordion {
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    overflow: hidden;
}

.vendor-header {
    width: 100%;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: white;
    border: none;
    cursor: pointer;
    text-align: left;
}

.vendor-header.expanded {
    background: #f9fafb;
    border-bottom: 1px solid #e5e7eb;
}

.vendor-name {
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
}

.vendor-content {
    padding: 8px;
}

.category-accordion {
    margin-bottom: 4px;
}

.category-header {
    width: 100%;
    padding: 12px;
    display: flex;
    align-items: center;
    background: #f3f4f6;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    text-align: left;
    gap: 8px;
}

.category-header.expanded {
    background: #e5e7eb;
    border-radius: 8px 8px 0 0;
}

.category-name {
    flex: 1;
    font-size: 14px;
    font-weight: 600;
    color: #4b5563;
}

.category-count {
    background: #7c3aed;
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
}

.category-content {
    background: #f9fafb;
    border-radius: 0 0 8px 8px;
    padding: 8px;
}

.product-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    background: white;
    border-radius: 8px;
    margin-bottom: 6px;
}

.product-item:last-child {
    margin-bottom: 0;
}

.product-info {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.product-name {
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
}

.product-desc {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.product-price {
    font-size: 16px;
    font-weight: 700;
    color: #7c3aed;
}

.no-vendors {
    text-align: center;
    color: #9ca3af;
    padding: 32px 16px;
}
