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

:root {
    --primary-color: #4f46e5;
    --primary-hover: #4338ca;
    --primary-light: #e0e7ff;
    --text-color: #1f2937;
    --text-secondary: #6b7280;
    --background: #f9fafb;
    --card-background: #ffffff;
    --border-color: #e5e7eb;
    --success-color: #10b981;
    --error-color: #ef4444;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius: 0.5rem;
    --radius-lg: 0.75rem;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
    background: var(--background);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 640px;
    margin: 0 auto;
    padding: 2rem 1rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
header {
    text-align: center;
    margin-bottom: 2rem;
}

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

.subtitle {
    color: var(--text-secondary);
    font-size: 1rem;
}

/* Main Content */
main {
    background: var(--card-background);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    flex-grow: 1;
}

/* Input Section */
.input-section {
    margin-bottom: 1.5rem;
}

.input-section label,
.option-group label,
.result-section > label {
    display: block;
    font-weight: 600;
    font-size: 0.875rem;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

#numberInput {
    width: 100%;
    padding: 0.875rem 1rem;
    font-size: 1.25rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    transition: border-color 0.2s, box-shadow 0.2s;
    background: var(--card-background);
}

#numberInput:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

#numberInput::placeholder {
    color: var(--text-secondary);
}

/* Options Section */
.options-section {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 480px) {
    .options-section {
        grid-template-columns: 1fr 1fr;
    }

    .currency-options {
        grid-column: span 2;
    }
}

.option-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--card-background);
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.5rem;
}

.option-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.currency-options {
    display: none;
}

.currency-options.visible {
    display: block;
}

/* Convert Button */
.convert-btn {
    width: 100%;
    padding: 1rem;
    font-size: 1.125rem;
    font-weight: 600;
    color: white;
    background: var(--primary-color);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    margin-bottom: 1.5rem;
}

.convert-btn:hover {
    background: var(--primary-hover);
}

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

/* Result Section */
.result-section {
    margin-bottom: 1.5rem;
}

.result-container {
    position: relative;
    background: var(--background);
    border: 2px solid var(--border-color);
    border-radius: var(--radius);
    padding: 1rem;
    padding-right: 3.5rem;
    min-height: 80px;
    display: flex;
    align-items: center;
}

.result-text {
    font-size: 1.125rem;
    line-height: 1.5;
    color: var(--text-color);
    word-break: break-word;
}

.result-text.placeholder {
    color: var(--text-secondary);
    font-style: italic;
}

.result-text.error {
    color: var(--error-color);
}

.copy-btn {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    padding: 0.5rem;
    background: transparent;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s, background-color 0.2s;
}

.copy-btn:hover {
    color: var(--primary-color);
    background: var(--primary-light);
}

.copy-feedback {
    position: absolute;
    right: 0.75rem;
    top: -1.75rem;
    background: var(--success-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius);
    font-size: 0.75rem;
    font-weight: 600;
    opacity: 0;
    transform: translateY(0.5rem);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

.copy-feedback.show {
    opacity: 1;
    transform: translateY(0);
}

.result-section {
    position: relative;
}

/* Examples Section */
.examples-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.examples-section h3 {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}

.examples-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.example-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    background: var(--background);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    color: var(--text-color);
}

.example-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary-color);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem 1rem 1rem;
    margin-top: auto;
}

footer p {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.2s;
}

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

/* Responsive Design */
@media (max-width: 480px) {
    .container {
        padding: 1rem 0.75rem;
    }

    header h1 {
        font-size: 1.75rem;
    }

    main {
        padding: 1.25rem;
    }

    #numberInput {
        font-size: 1.125rem;
    }

    .result-text {
        font-size: 1rem;
    }
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.result-text:not(.placeholder) {
    animation: fadeIn 0.3s ease-out;
}
