/* Base CSS - Mobile First Design */

/* CSS Variables for theming */
:root {
    --primary-color: #007AFF;      /* iOS Blue */
    --success-color: #34C759;      /* Green */
    --danger-color: #FF3B30;       /* Red */
    --warning-color: #FF9500;      /* Orange */
    --background: #F2F2F7;         /* Light gray background */
    --card-background: #FFFFFF;
    --text-primary: #000000;
    --text-secondary: #666666;
    --text-tertiary: #999999;
    --border-color: #E0E0E0;
    --shadow: 0 2px 8px rgba(0,0,0,0.08);
    --shadow-hover: 0 4px 16px rgba(0,0,0,0.12);
    --border-radius: 12px;
    --transition: all 0.3s ease;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica', 'Arial', sans-serif;
    background: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 100%;
    padding: 16px;
    margin: 0 auto;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.3;
    margin-bottom: 12px;
}

h1 { font-size: 28px; }
h2 { font-size: 24px; }
h3 { font-size: 20px; }
h4 { font-size: 18px; }

/* Monospace font for amounts */
.amount, .tofu-amount {
    font-family: 'SF Mono', 'Consolas', 'Monaco', monospace;
    font-variant-numeric: tabular-nums;
}

/* Cards */
.card {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:active {
    transform: scale(0.98);
}

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

.card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.card-body {
    color: var(--text-secondary);
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 44px;   /* Touch target size */
    min-height: 44px;
    touch-action: manipulation;
}

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

.btn-primary:hover {
    background: #0051D5;
}

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

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

.btn-secondary {
    background: var(--border-color);
    color: var(--text-primary);
}

.btn-block {
    display: block;
    width: 100%;
}

.btn:active {
    transform: scale(0.95);
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-control {
    display: block;
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--card-background);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.1);
}

/* Flash messages */
.alert {
    padding: 16px;
    border-radius: var(--border-radius);
    margin-bottom: 16px;
    animation: slideDown 0.3s ease;
}

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

.alert-success { background: #E8F5E9; color: #2E7D32; }
.alert-error { background: #FFEBEE; color: #C62828; }
.alert-warning { background: #FFF3E0; color: #E65100; }
.alert-info { background: #E3F2FD; color: #1565C0; }

/* Balance display */
.balance-display {
    text-align: center;
    padding: 24px 16px;
    margin: 16px 0;
}

.balance-label {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.balance-tofu {
    font-size: 32px;
    font-weight: 600;
    font-family: 'SF Mono', monospace;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.balance-twd {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* Transaction list */
.transaction-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.transaction-item {
    background: var(--card-background);
    border-radius: var(--border-radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.transaction-item:active {
    transform: scale(0.98);
}

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

.txn-type {
    font-size: 12px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 6px;
    text-transform: uppercase;
}

.txn-type.credit {
    background: #E8F5E9;
    color: var(--success-color);
}

.txn-type.debit {
    background: #FFEBEE;
    color: var(--danger-color);
}

.txn-amount {
    font-size: 18px;
    font-weight: 600;
    font-family: 'SF Mono', monospace;
}

.txn-amount.credit { color: var(--success-color); }
.txn-amount.debit { color: var(--danger-color); }

.txn-details {
    font-size: 14px;
    color: var(--text-secondary);
    margin-top: 8px;
}

.txn-status {
    display: inline-block;
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 6px;
    margin-top: 8px;
}

.txn-status.completed {
    background: #E8F5E9;
    color: var(--success-color);
}

.txn-status.pending {
    background: #FFF3E0;
    color: var(--warning-color);
}

.txn-status.rejected {
    background: #FFEBEE;
    color: var(--danger-color);
}

/* Loading spinner */
.spinner {
    border: 3px solid var(--border-color);
    border-top: 3px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

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

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 8px;
}

@keyframes loading {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Empty state */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-tertiary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.3;
}

/* Utility classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--text-secondary); }
.text-small { font-size: 14px; }
.mt-16 { margin-top: 16px; }
.mb-16 { margin-bottom: 16px; }
.mt-24 { margin-top: 24px; }
.mb-24 { margin-bottom: 24px; }

/* Tablet & Desktop */
@media (min-width: 768px) {
    .container {
        max-width: 720px;
        padding: 24px;
    }
    
    h1 { font-size: 32px; }
    h2 { font-size: 28px; }
    
    .balance-tofu {
        font-size: 40px;
    }
}

@media (min-width: 1024px) {
    .container {
        max-width: 960px;
    }
}
