:root {
    --primary-color: #4f46e5;
    /* Indigo 600 */
    --primary-hover: #4338ca;
    /* Indigo 700 */
    --secondary-color: #ec4899;
    /* Pink 500 */
    --bg-gradient-start: #f3f4f6;
    --bg-gradient-end: #e5e7eb;
    --card-bg: rgba(255, 255, 255, 0.85);
    --text-main: #1f2937;
    --text-muted: #6b7280;
    --border-color: #e5e7eb;
    --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);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background: linear-gradient(135deg, #e0e7ff 0%, #fce7f3 100%);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 40px 20px;
}

.container {
    width: 100%;
    max-width: 600px;
}

header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.lang-toggle {
    position: absolute;
    top: 0;
    right: 0;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    width: 48px;
    height: 48px;
    padding: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-sm);
}

.lang-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-color);
}

.lang-toggle img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

h1 {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(to right, var(--primary-color), var(--secondary-color));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 8px;
}

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

.card {
    background: var(--card-bg);
    backdrop-filter: blur(12px);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(255, 255, 255, 0.5);
    margin-bottom: 20px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

h2 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-main);
}

/* Inputs */
.input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-main);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

input[type="number"],
input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: white;
}

input[type="number"]:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.unit {
    position: absolute;
    right: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.unit-left {
    position: absolute;
    left: 16px;
    color: var(--text-muted);
    font-size: 0.9rem;
    pointer-events: none;
}

.icon-btn {
    position: absolute;
    right: 50px;
    /* Position to the left of the unit */
    background: none;
    border: none;
    cursor: pointer;
    color: var(--primary-color);
    padding: 4px;
    border-radius: 50%;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: #eef2ff;
}

.icon-btn.rotating svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.help-text {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
}

.target-display {
    margin-top: 12px;
    padding: 10px;
    background: rgba(99, 102, 241, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(99, 102, 241, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
}

.target-display .label {
    color: var(--text-muted);
}

.target-display .value {
    color: var(--primary-color);
    font-weight: 600;
}

.help-text a {
    color: var(--primary-color);
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

/* Product List */
.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.product-row {
    display: flex;
    gap: 10px;
    margin-bottom: 12px;
    align-items: center;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.product-row input[type="text"] {
    flex: 2;
}

.product-row input[type="number"] {
    flex: 1;
}

.remove-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-btn:hover {
    background: #fee2e2;
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-size: 1rem;
}

.btn.primary {
    background: var(--primary-color);
    color: white;
    width: 100%;
    box-shadow: 0 4px 6px rgba(79, 70, 229, 0.25);
}

.btn.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 8px rgba(79, 70, 229, 0.3);
}

.btn.primary:active {
    transform: translateY(0);
}

.btn.secondary {
    background: white;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
    padding: 8px 16px;
    font-size: 0.9rem;
}

.btn.secondary:hover {
    background: #eef2ff;
}

/* Results */
/* Exchange Rate Section Updates */
.section-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.manual-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-muted);
    cursor: pointer;
}

.manual-toggle input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.manual-inputs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 0.5rem;
}

@media (max-width: 480px) {
    .manual-inputs {
        grid-template-columns: 1fr;
    }
}

.hidden {
    display: none !important;
}

.results-section {
    border-left: 4px solid var(--secondary-color);
}

.result-summary {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.result-item {
    display: flex;
    flex-direction: column;
}

.result-item .label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.result-item .value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-main);
}

#result-items-list {
    list-style: none;
}

#result-items-list li {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.95rem;
}

#result-items-list li:last-child {
    border-bottom: none;
}

.item-price {
    font-weight: 600;
    color: var(--text-main);
}

.item-original {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 8px;
}

/* Discount Select */
.discount-select {
    padding: 12px 8px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    font-size: 0.9rem;
    background: white;
    cursor: pointer;
    transition: border-color 0.2s;
    min-width: 70px;
}

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

/* Mobile Layout */
@media (max-width: 600px) {
    .container {
        padding: 0;
    }

    .card {
        padding: 16px;
        border-radius: 0;
        margin-bottom: 10px;
    }

    .product-row {
        flex-wrap: wrap;
        gap: 6px;
        background: #f9fafb;
        padding: 8px;
        border-radius: 8px;
    }

    /* 
       User Request: "Product column too small... Adjust Price and 4:6 ratio"
       Interpreting as Product (6) : Price (4) to give Product more space.
       Also handling the new Discount field.
    */
    .product-row input[type="text"] {
        flex: 1 1 100%;
        /* Full width for name on very small screens or top row */
        margin-bottom: 4px;
    }

    .input-wrapper {
        flex: 6;
        /* Price gets 6 parts */
    }

    .discount-select {
        flex: 4;
        /* Discount gets 4 parts? Or maybe Price vs Discount? */
    }

    /* 
       Re-reading: "Product column too small... Adjust Price and 4:6 ratio"
       Maybe they want Product and Price on one line with 4:6 ratio?
       Let's try to keep them on one line if possible, but with discount it's hard.
       
       Let's try:
       Row 1: Product Name (100%)
       Row 2: Price (60%) + Discount (40%) ? 
       
       Or:
       Product (40%) : Price (60%) ?
       
       Let's try to follow the "4:6" strictly for Product vs Price if they are on the same line.
       But with Discount, we have 3 elements.
       
       Let's assume the user meant Product vs Price ratio.
       Let's set:
       Product: flex 4
       Price: flex 6
       
       But wait, if Product is "too small", making it 4 (40%) vs Price 6 (60%) makes it smaller than 2:1 (66%).
       
       Maybe the user meant "Product 6 : Price 4".
       
       Let's try a specific mobile layout:
       Product Name: flex 6
       Price Wrapper: flex 4
       Discount: Auto/Fixed
    */

    .product-row {
        display: flex;
        align-items: center;
    }

    .product-row input[type="text"] {
        flex: 6;
        min-width: 0;
    }

    .input-wrapper {
        flex: 13;
        min-width: 0;
    }

    .discount-select {
        flex: 8;
        min-width: 0;
        margin-left: 4px;
    }

    .remove-btn {
        padding: 4px;
    }

    /* Compact inputs for mobile */
    input[type="number"],
    input[type="text"] {
        padding: 8px 12px;
        font-size: 0.95rem;
    }
}

/* About Section */
.about-section {
    margin-top: 30px;
}

.about-content {
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-muted);
}

.about-content p {
    margin-bottom: 12px;
}

.about-content p:last-child {
    margin-bottom: 0;
}

/* Footer */
footer {
    margin-top: 50px;
    margin-bottom: 40px;
    text-align: center;
}

.footer-content {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

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