:root {
    --primary-color: #4F46E5;
    /* Indigo 600 */
    --primary-hover: #4338CA;
    /* Indigo 700 */
    --bg-color: #F3F4F6;
    /* Gray 100 */
    --card-bg: #FFFFFF;
    --text-main: #1F2937;
    /* Gray 800 */
    --text-secondary: #6B7280;
    /* Gray 500 */
    --border-color: #E5E7EB;
    /* Gray 200 */
    --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);
    --radius: 12px;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    min-height: 100vh;
}

.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

/* Header */
.main-header {
    background: var(--card-bg);
    padding: 1rem 2rem;
    box-shadow: var(--shadow-sm);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 10;
}

.logo-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.logo-text {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-color);
}

.language-switcher select {
    padding: 0.5rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background-color: #F9FAFB;
    color: var(--text-main);
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
}

.language-switcher select:focus {
    border-color: var(--primary-color);
}

/* Layout Grid */
.content-grid {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 2rem 1rem;
    flex: 1;
    max-width: 1400px;
    margin: 0 auto;
    width: 100%;
}

.banner-side {
    display: none;
    /* Ads hidden per user request */
    flex-direction: column;
    gap: 1rem;
}

.ad-placeholder {
    background: #E5E7EB;
    border: 2px dashed #9CA3AF;
    border-radius: var(--radius);
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6B7280;
    font-weight: 500;
    font-size: 0.875rem;
}

.main-content {
    width: 100%;
    max-width: 800px;
}

.app-container {
    width: 100%;
}

.hero-section {
    text-align: center;
    margin-bottom: 2rem;
}

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

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

.calculator-card,
.results-card,
.table-card,
.info-section {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    margin-bottom: 1.5rem;
    transition: transform 0.2s ease;
}

/* Unit Toggle */
.unit-toggle-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.switch-label {
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0;
}

.unit-switch {
    display: flex;
    background: #F9FAFB;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.unit-switch input[type="radio"] {
    display: none;
}

.unit-switch label {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-bottom: 0;
}

.unit-switch input[type="radio"]:checked+label {
    background-color: var(--card-bg);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

/* Form Elements */
.input-group {
    margin-bottom: 1.25rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

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

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

.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

/* Gender Selector */
.gender-selector {
    display: flex;
    background: #F9FAFB;
    padding: 4px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.gender-selector input[type="radio"] {
    display: none;
}

.gender-btn {
    flex: 1;
    text-align: center;
    padding: 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: all 0.2s;
    margin-bottom: 0;
    /* Override label margin */
}

.gender-selector input[type="radio"]:checked+.gender-btn {
    background-color: var(--card-bg);
    color: var(--primary-color);
    box-shadow: var(--shadow-sm);
    font-weight: 600;
}

.primary-btn {
    width: 100%;
    padding: 0.875rem;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.2s;
}

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

.form-hint {
    margin-top: 1.5rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* RTL Support */
[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .logo-icon {
    margin-right: 0;
    margin-left: 0.5rem;
}

[dir="rtl"] .unit-switch label:first-of-type {
    border-radius: 0 6px 6px 0;
}

[dir="rtl"] .unit-switch label:last-of-type {
    border-radius: 6px 0 0 6px;
}

[dir="rtl"] .gender-selector label:first-of-type {
    border-radius: 0 6px 6px 0;
}

[dir="rtl"] .gender-selector label:last-of-type {
    border-radius: 6px 0 0 6px;
}

/* Results Section */
.hidden {
    display: none;
}

.results-card h2,
.table-card h2,
.info-section h2 {
    font-size: 1.25rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.main-result {
    text-align: center;
    margin-bottom: 1.5rem;
}

.calories-value {
    font-size: 3.5rem;
    font-weight: 800;
    color: var(--primary-color);
    line-height: 1;
}

.unit {
    font-size: 1.25rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-left: 0.25rem;
}

.secondary-results {
    display: flex;
    justify-content: space-around;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.stat-item {
    text-align: center;
}

.stat-item .label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.stat-item .value {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--text-main);
}

/* Table Section */
.table-subtitle {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    margin-top: -0.5rem;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

th,
td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    font-weight: 600;
    color: var(--text-secondary);
    background-color: #F9FAFB;
}

td {
    color: var(--text-main);
}

tr:last-child td {
    border-bottom: none;
}

/* Info Section */
.info-section h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-main);
}

.info-section p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.info-section ul {
    list-style-type: disc;
    padding-left: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

.info-section li {
    margin-bottom: 0.5rem;
}

/* Footer */
.main-footer {
    text-align: center;
    padding: 2rem;
    background: var(--card-bg);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

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

.main-footer .disclaimer {
    font-size: 0.75rem;
    margin-top: 0.5rem;
    color: #9CA3AF;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
        max-width: 700px;
    }

    .banner-side {
        display: none;
        /* Hide ads on smaller screens for cleaner UX */
    }
}

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

    .calories-value {
        font-size: 2.5rem;
    }

    .main-header {
        padding: 1rem;
    }
}