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

:root {
    --primary-color: #0066cc;
    --secondary-color: #004499;
    --background: #f5f5f5;
    --card-bg: #ffffff;
    --text-primary: #333333;
    --text-secondary: #666666;
    --border-color: #e0e0e0;
    --result-positive: #28a745;
    --result-negative: #dc3545;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--background);
    color: var(--text-primary);
    padding: 0;
    margin: 0;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
}

.container {
    width: 100%;
    max-width: 375px;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 100vh;
    justify-content: flex-start;
}

header {
    text-align: center;
    padding: 6px 0;
    margin-bottom: 2px;
}

header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2px;
}

.subtitle {
    font-size: 12px;
    color: var(--text-secondary);
}

.card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px;
    box-shadow: var(--shadow);
}

.card h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

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

.input-group:last-child {
    margin-bottom: 0;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.input-group input {
    width: 100%;
    padding: 10px;
    font-size: 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    color: var(--text-primary);
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
}

.total-paid {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-paid-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.total-paid-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--primary-color);
}

.result-card {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: white;
}

.result-card h2 {
    color: white;
    margin-bottom: 8px;
}

.result {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-label {
    font-size: 12px;
    opacity: 0.9;
}

.result-value {
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
}

.result-bgn {
    font-size: 14px;
    font-weight: 500;
    margin-top: 4px;
    opacity: 0.9;
    display: block;
}

.rate-info {
    text-align: center;
    padding: 8px;
    font-size: 11px;
    color: var(--text-secondary);
}

/* Prevent zoom on input focus on iOS */
input[type="number"] {
    font-size: 16px !important;
}

/* Hide number input arrows */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

input[type="number"] {
    -moz-appearance: textfield;
    appearance: textfield;
}

/* Action buttons */
.action-buttons {
    margin-top: 4px;
}

.btn {
    width: 100%;
    padding: 12px 16px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s ease;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

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

.btn-clear {
    background: #ffffff;
    color: #666666;
    border: 2px solid #e0e0e0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-clear:hover {
    background: #f5f5f5;
    border-color: #cccccc;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.btn-clear:active {
    background: #eeeeee;
}

.btn-clear svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* Help text */
.help-text {
    margin-top: 4px;
    font-size: 10px;
    color: var(--text-secondary);
    opacity: 0.7;
}

.help-text kbd {
    background: #e0e0e0;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: monospace;
    font-size: 10px;
    color: #333;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* Smooth transitions */
.card, .input-group input, .btn {
    transition: all 0.2s ease;
}

/* Improved input focus */
.input-group input:focus {
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Add subtle animation to result card when value changes */
.result-card {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0.8;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

