/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #667eea;
    --primary-dark: #5568d3;
    --secondary-color: #764ba2;
    --success-color: #4CAF50;
    --warning-color: #ffc107;
    --danger-color: #f44336;
    --text-primary: #333;
    --text-secondary: #666;
    --text-tertiary: #888;
    --bg-light: #f8f9fa;
    --bg-white: #ffffff;
    --border-color: #e0e0e0;
    --border-accent: #ffebee;
    --input-focus: rgba(102, 126, 234, 0.1);
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.3);
    --border-radius-sm: 8px;
    --border-radius-md: 12px;
    --border-radius-lg: 20px;
    --transition: all 0.3s ease;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    padding: 20px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    max-width: 600px;
    margin: 0 auto;
    background: var(--bg-white);
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow-lg);
}

/* Header */
header {
    margin-bottom: 25px;
}

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

.subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.5;
}

/* Rates Section */
.rates-section {
    background: var(--bg-light);
    border-radius: var(--border-radius-md);
    padding: 20px;
    margin-bottom: 25px;
}

.rates-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    flex-wrap: wrap;
    gap: 10px;
}

.rates-header h2 {
    font-size: 18px;
    color: var(--text-primary);
    font-weight: 600;
}

.toggle-rates {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}

.toggle-rates:hover {
    background: var(--primary-dark);
}

.toggle-rates:active {
    transform: scale(0.98);
}

/* Rate Row */
.rate-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 15px;
    margin-bottom: 20px;
    align-items: flex-start;
    padding: 15px;
    background: var(--bg-white);
    border-radius: 10px;
    border: 2px solid var(--border-accent);
}

.rate-label {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 14px;
    padding-top: 10px;
}

.rate-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rate-input-label {
    font-size: 11px;
    color: var(--text-tertiary);
    line-height: 1.4;
}

.rate-input {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: #fff5f5;
    font-family: inherit;
}

.rate-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

.rate-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Input with Button */
.input-with-button {
    display: flex;
    gap: 10px;
    align-items: stretch;
}

.input-with-button .rate-input {
    flex: 1;
    min-width: 0;
}

.visa-button {
    background: #1A1F71;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
}

.visa-button:hover {
    background: #141955;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.visa-button:active {
    transform: translateY(0);
}

/* Save Indicator */
.save-indicator {
    text-align: center;
    color: var(--success-color);
    font-size: 12px;
    margin-top: 10px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.save-indicator.show {
    opacity: 1;
}

/* Amounts Section */
.amounts-section {
    margin-top: 25px;
}

.amounts-section h2 {
    font-size: 18px;
    color: var(--text-primary);
    margin-bottom: 15px;
    font-weight: 600;
}

/* Currency Row */
.currency-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
    gap: 10px;
}

.currency-label {
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 70px;
    font-size: 16px;
    flex-shrink: 0;
}

.currency-input {
    flex: 1;
    padding: 15px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius-md);
    font-size: 18px;
    transition: var(--transition);
    font-family: inherit;
    min-width: 0;
}

.currency-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--input-focus);
}

.currency-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

/* Info Boxes */
.info-box {
    background: #e8f4fd;
    border-left: 4px solid #2196F3;
    padding: 15px;
    border-radius: var(--border-radius-sm);
    margin-top: 20px;
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.6;
}

.chain-info {
    background: #fff3cd;
    border-left: 4px solid var(--warning-color);
    padding: 12px;
    border-radius: var(--border-radius-sm);
    margin-top: 15px;
    font-size: 12px;
    color: #856404;
    line-height: 1.6;
}

/* Footer */
.app-footer {
    text-align: center;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    font-size: 12px;
    color: var(--text-tertiary);
}

.app-footer a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.app-footer a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 500px) {
    body {
        padding: 15px;
    }

    .container {
        padding: 20px;
    }

    h1 {
        font-size: 20px;
    }

    .subtitle {
        font-size: 13px;
    }

    .rates-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .toggle-rates {
        width: 100%;
    }

    .rate-row {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
    }

    .rate-label {
        font-size: 13px;
        padding-top: 0;
    }

    .rate-input-label {
        font-size: 10px;
    }

    .input-with-button {
        flex-direction: column;
    }

    .visa-button {
        width: 100%;
        padding: 14px;
    }

    .currency-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .currency-label {
        min-width: auto;
        font-size: 14px;
    }

    .currency-input {
        width: 100%;
        font-size: 16px;
    }

    .info-box,
    .chain-info {
        font-size: 12px;
        padding: 12px;
    }
}

/* Small phones */
@media (max-width: 360px) {
    .container {
        padding: 15px;
    }

    h1 {
        font-size: 18px;
    }

    .rate-input,
    .currency-input {
        font-size: 14px;
        padding: 10px;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus visible for keyboard navigation */
:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    body {
        background: white;
    }

    .container {
        box-shadow: none;
    }

    .toggle-rates,
    .visa-button {
        display: none;
    }
}