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

:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-color: #f8fafc;
    --card-bg: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: var(--text-primary);
}

.container {
    max-width: 600px;
    margin: 0 auto;
}

header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.subtitle {
    font-size: 0.95rem;
    opacity: 0.95;
    font-weight: 300;
}

.calculator-card {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 30px;
    box-shadow: var(--shadow-xl);
    position: relative;
    overflow: hidden;
}

.input-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 25px;
}

.currency-selector,
.amount-input {
    display: flex;
    flex-direction: column;
}

label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.currency-select,
.amount-field {
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    transition: all 0.3s ease;
    background: white;
    color: var(--text-primary);
}

.currency-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2364748b'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 20px;
    padding-right: 40px;
}

.currency-select:hover,
.amount-field:hover {
    border-color: var(--primary-color);
}

.currency-select:focus,
.amount-field:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.amount-field::-webkit-inner-spin-button,
.amount-field::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.notice-section {
    margin-bottom: 25px;
    min-height: 0;
    transition: all 0.3s ease;
}

.notice-content {
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.875rem;
    line-height: 1.5;
    display: none;
}

.notice-content.show {
    display: block;
}

.notice-content.info {
    background: #dbeafe;
    color: #1e40af;
    border-left: 4px solid #3b82f6;
}

.notice-content.warning {
    background: #fef3c7;
    color: #92400e;
    border-left: 4px solid var(--warning-color);
}

.divider {
    height: 1px;
    background: linear-gradient(to right, transparent, var(--border-color), transparent);
    margin: 15px 0;
}

.results-section {
    margin-top: 25px;
}

.result-item {
    margin-bottom: 15px;
    padding: 16px;
    border-radius: 12px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.result-item.main-result .result-value {
    margin-top: 8px;
}

.result-item.gbp-result .result-value {
    color: var(--text-primary);
}

.gbp-suggestion {
    font-size: 0.95rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    background: #dbeafe;
    color: #1e40af;
}

.result-item.highlighted {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #667eea;
    box-shadow: 0 8px 16px rgba(102, 126, 234, 0.3);
    transform: scale(1.02);
}

.result-item.highlighted .result-label,
.result-item.highlighted .label-text,
.result-item.highlighted .result-value {
    color: white !important;
}

.result-item.highlighted .formula {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.result-item.highlighted .difference {
    background: rgba(255, 255, 255, 0.25);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.result-item.highlighted .profit {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.25);
}

.result-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 8px;
}

.label-text {
    font-weight: 600;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.formula {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    background: var(--bg-color);
    padding: 4px 10px;
    border-radius: 6px;
}

.rate-info {
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}

.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.result-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    flex: 1;
    min-width: 120px;
}

.difference {
    font-size: 1rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
}

.difference.positive {
    background: #dcfce7;
    color: #166534;
}

.difference.negative {
    background: #fee2e2;
    color: #991b1b;
}

.profit {
    font-size: 0.9rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
}

.profit.positive {
    background: #dbeafe;
    color: #1e40af;
}

.profit.negative {
    background: #fef3c7;
    color: #92400e;
}

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: none;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    border-radius: 20px;
    z-index: 10;
}

.loading-overlay.show {
    display: flex;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

.loading-overlay p {
    margin-top: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

footer {
    text-align: center;
    margin-top: 30px;
    color: white;
    font-size: 0.875rem;
    opacity: 0.9;
}

footer p {
    margin: 4px 0;
}

.update-time {
    font-size: 0.8rem;
    opacity: 0.8;
}

@media (max-width: 640px) {
    body {
        padding: 15px;
    }

    header h1 {
        font-size: 1.5rem;
    }

    .calculator-card {
        padding: 20px;
        border-radius: 16px;
    }

    .input-section {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .result-value {
        font-size: 1.25rem;
    }

    .difference {
        font-size: 0.875rem;
        padding: 4px 10px;
    }

    .result-label {
        flex-direction: column;
        align-items: flex-start;
    }

    .formula,
    .rate-info {
        font-size: 0.75rem;
    }
}

@media (max-width: 400px) {
    .result-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .difference,
    .profit {
        align-self: flex-end;
        font-size: 0.85rem;
    }
}
