/* CSS Variables for theming */
:root {
    --primary-purple: #7C3AED;
    --light-purple: #A78BFA;
    --dark-purple: #5B21B6;
    --white: #FFFFFF;
    --off-white: #F9FAFB;
    --text-dark: #1F2937;
    --text-light: #6B7280;
    --success: #10B981;
    --error: #EF4444;
    --border-radius: 8px;
    --spacing-unit: 16px;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.1);
}

/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--off-white);
    color: var(--text-dark);
    line-height: 1.6;
}

/* Layout */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: var(--spacing-unit);
}

/* Header styles */
.app-header {
    background: linear-gradient(135deg, var(--primary-purple), var(--dark-purple));
    color: var(--white);
    padding: calc(var(--spacing-unit) * 2);
    text-align: center;
    box-shadow: var(--shadow-md);
}

.app-header h1 {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: calc(var(--spacing-unit) / 2);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--spacing-unit);
}

/* Button styles */
.btn {
    display: inline-block;
    padding: calc(var(--spacing-unit) * 0.75) calc(var(--spacing-unit) * 1.5);
    font-size: 1rem;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: all 0.2s ease;
    min-height: 44px; /* Touch target */
}

.btn-primary {
    background-color: var(--primary-purple);
    color: var(--white);
    box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
    background-color: var(--dark-purple);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: var(--white);
    color: var(--primary-purple);
    border: 2px solid var(--primary-purple);
}

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

.btn-success {
    background-color: var(--success);
    color: var(--white);
}

.btn-block {
    display: block;
    width: 100%;
    margin-bottom: var(--spacing-unit);
}

/* Form styles */
.form-group {
    margin-bottom: calc(var(--spacing-unit) * 1.5);
}

.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: calc(var(--spacing-unit) / 2);
    color: var(--text-dark);
}

.form-input {
    width: 100%;
    padding: calc(var(--spacing-unit) * 0.75);
    font-size: 1rem;
    border: 2px solid #E5E7EB;
    border-radius: var(--border-radius);
    transition: border-color 0.2s;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary-purple);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

/* Card styles */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: calc(var(--spacing-unit) * 1.5);
    margin-bottom: var(--spacing-unit);
    box-shadow: var(--shadow-sm);
}

/* Transaction styles */
.transaction-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--spacing-unit);
    border-bottom: 1px solid #E5E7EB;
}

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

/* QR Code container */
.qr-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: calc(var(--spacing-unit) * 2);
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
}

#qr-display {
    margin: calc(var(--spacing-unit) * 2) 0;
}

/* Camera preview */
#qr-reader {
    width: 100%;
    max-width: 500px;
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow-md);
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: calc(var(--spacing-unit) * 3);
    color: var(--text-light);
}

.empty-state p {
    margin-bottom: calc(var(--spacing-unit) / 2);
}

/* Message/Toast styles */
.message {
    padding: var(--spacing-unit);
    border-radius: var(--border-radius);
    margin-bottom: var(--spacing-unit);
    font-weight: 500;
}

.message-success {
    background-color: #D1FAE5;
    color: #065F46;
    border-left: 4px solid var(--success);
}

.message-error {
    background-color: #FEE2E2;
    color: #991B1B;
    border-left: 4px solid var(--error);
}

/* Responsive design */
@media (max-width: 480px) {
    .container {
        padding: calc(var(--spacing-unit) * 0.5);
    }

    .app-header h1 {
        font-size: 1.5rem;
    }

    .btn {
        font-size: 0.9rem;
        padding: calc(var(--spacing-unit) * 0.6) var(--spacing-unit);
    }
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--off-white);
    border-top: 3px solid var(--primary-purple);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: calc(var(--spacing-unit) * 2) auto;
}

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

/* Badges */
.badge {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-active {
    background-color: #DBEAFE;
    color: #1E40AF;
}

.badge-completed {
    background-color: #D1FAE5;
    color: #065F46;
}
