:root {
    --primary-color: #4a90e2;
    --primary-hover: #357abd;
    --bg-color: #f4f7f6;
    --card-bg: #ffffff;
    --text-color: #333333;
    --border-color: #e0e0e0;
    --result-bg: #e8f4fd;
    --result-text: #0077cc;
    --error-bg: #ffebee;
    --error-text: #c62828;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 12px;
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

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

body {
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* Header */
header {
    width: 100%;
    padding: 20px;
    display: flex;
    justify-content: center;
    background-color: var(--card-bg);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.return-btn {
    text-decoration: none;
    background-color: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 30px;
    font-weight: 600;
    transition: background-color 0.3s ease, transform 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.return-btn:hover {
    background-color: var(--primary-hover);
    transform: translateY(-1px);
}

/* Main Container */
main {
    width: 100%;
    max-width: 900px;
    padding: 20px;
    margin-top: 20px;
}

.intro-section {
    text-align: center;
    margin-bottom: 30px;
}

.intro-section h1 {
    font-size: 1.8rem;
    color: #2c3e50;
    margin-bottom: 15px;
    line-height: 1.3;
}

.intro-section p {
    font-size: 1.05rem;
    color: #555;
    max-width: 800px;
    margin: 0 auto;
}

/* AdSense Container */
.ads-container {
    width: 100%;
    min-height: 100px;
    /* Placeholder height */
    margin-bottom: 30px;
    text-align: center;
    overflow: hidden;
}

/* Converter Card */
.converter-card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
}

h1,
.tool-title {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 700;
}

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

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    color: #666;
}

input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    font-size: 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    transition: border-color 0.3s;
    font-family: inherit;
}

input[type="number"]:focus {
    border-color: var(--primary-color);
    outline: none;
}

/* Controls: Selects & Swap */
.controls-group {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 30px;
}

.select-wrapper {
    flex: 1;
}

select {
    width: 100%;
    padding: 12px;
    font-size: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background-color: white;
    cursor: pointer;
    font-family: inherit;
}

select:focus {
    border-color: var(--primary-color);
    outline: none;
}

.swap-btn {
    background: none;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 45px;
    height: 45px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    color: #666;
}

.swap-btn:hover {
    background-color: #f5f5f5;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.swap-btn svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
    transition: transform 0.5s ease;
}

.swap-btn.swapped svg {
    transform: rotate(180deg);
}

/* Result Section */
.result-container {
    text-align: center;
    padding: 20px;
    background-color: var(--result-bg);
    border-radius: 8px;
    color: var(--result-text);
    font-weight: 500;
    font-size: 1.1rem;
    transition: background-color 0.3s;
}

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

.highlight {
    font-weight: 800;
    font-size: 1.4rem;
}

/* Responsive */
@media (max-width: 500px) {
    .controls-group {
        flex-direction: column;
        gap: 15px;
    }

    .swap-btn {
        transform: rotate(90deg);
    }

    .swap-btn.swapped svg {
        transform: rotate(90deg);
        /* Adjust for vertical orientation if needed */
    }
}

/* Article Section */
.content-article {
    margin-top: 40px;
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: 30px;
    box-shadow: var(--shadow);
    color: var(--text-color);
}

.content-article h1,
.content-article h2 {
    color: #2c3e50;
    margin-top: 25px;
    margin-bottom: 15px;
    line-height: 1.3;
}

.content-article h1 {
    font-size: 1.8rem;
    text-align: center;
    margin-top: 0;
}

.content-article h2 {
    font-size: 1.4rem;
    border-bottom: 2px solid var(--bg-color);
    padding-bottom: 10px;
}

.content-article h3 {
    font-size: 1.1rem;
    color: #34495e;
    margin-top: 20px;
    margin-bottom: 10px;
}

.content-article p {
    margin-bottom: 15px;
    line-height: 1.7;
    color: #555;
}

.content-article ul {
    margin-bottom: 15px;
    padding-left: 20px;
}

.content-article li {
    margin-bottom: 8px;
    color: #555;
}

.content-article strong {
    color: #333;
}

.content-article a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
}

.content-article a:hover {
    text-decoration: underline;
}

/* Related Tools Flash Cards */
.related-tools-section {
    margin-top: 40px;
    width: 100%;
}

.section-title {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
    color: #2c3e50;
    font-weight: 700;
}

.flash-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
    width: 100%;
}

.flash-card {
    background-color: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    text-decoration: none;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
    position: relative;
    overflow: hidden;
}

.flash-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
    border-color: var(--primary-color);
}

.card-icon {
    font-size: 2rem;
    margin-bottom: 12px;
}

.card-title {
    font-weight: 600;
    font-size: 1rem;
    margin-bottom: 12px;
    color: #2c3e50;
}

.card-action {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--primary-color);
    margin-top: auto;
}

.flash-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background-color: var(--primary-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.flash-card:hover::after {
    opacity: 1;
}

@media (max-width: 600px) {
    .flash-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .card-icon {
        font-size: 1.5rem;
    }

    .card-title {
        font-size: 0.9rem;
    }
}