/* ==========================================================================
   Main Layout Wrapper - Adapts to Astra backgrounds & typography
   ========================================================================== */
.algae-calc-wrap {
    background: transparent; /* Allows Astra's light or dark mode background to shine through */
    border: 1px solid rgba(128, 128, 128, 0.2); /* Soft neutral border adapting to any background tone */
    border-radius: 8px;
    padding: 25px;
    max-width: 600px;
    margin: 20px auto;
    font-family: inherit; /* Natively forces Astra's font family layout selection */
    color: inherit;       /* Inherits your dark mode text or standard light text automatically */
    box-sizing: border-box;
}

.algae-calc-wrap h2, 
.algae-calc-wrap h3 {
    margin-top: 0;
    color: inherit; /* Matches theme heading colors */
    font-family: inherit;
}

.algae-calc-wrap h2 {
    border-bottom: 2px solid rgba(128, 128, 128, 0.15);
    padding-bottom: 10px;
    font-size: 1.4em;
}

/* ==========================================================================
   Language Switcher Controls
   ========================================================================== */
.calc-lang-switcher {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-bottom: 15px;
}
.lang-btn {
    background: rgba(128, 128, 128, 0.1);
    border: 1px solid rgba(128, 128, 128, 0.15);
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: inherit;
    font-family: inherit;
    transition: all 0.2s ease-in-out;
}
/* Active state pulls from generic green or falls back to standard visibility color adjustments */
.lang-btn.active, 
.lang-btn:hover {
    background: #16a34a; 
    color: #ffffff !important;
    border-color: #16a34a;
}

/* ==========================================================================
   Form Controls (Select boxes & Inputs)
   ========================================================================== */
.calc-form-group {
    margin-bottom: 20px;
}
.calc-form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    font-size: 0.95em;
    opacity: 0.85; /* Softens label text natively across dark/light displays */
}
.calc-form-group select, 
.calc-form-group input {
    width: 100%;
    padding: 10px;
    background-color: rgba(128, 128, 128, 0.05); /* Tint background adapting seamlessly over black or white */
    color: inherit;
    font-family: inherit;
    border: 1px solid rgba(128, 128, 128, 0.25);
    border-radius: 6px;
    font-size: 16px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}
.calc-form-group select:focus, 
.calc-form-group input:focus {
    border-color: #16a34a; /* Highlights input with a clean focus wrapper tint */
}

/* ==========================================================================
   Data Presentation Tables
   ========================================================================== */
.calc-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    margin-top: 15px;
}
.calc-table th, 
.calc-table td {
    padding: 12px;
    border-bottom: 1px solid rgba(128, 128, 128, 0.15);
    color: inherit;
}
.calc-table th {
    background-color: rgba(128, 128, 128, 0.06); /* Dynamic row header hue */
    font-size: 0.8em;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 700;
    opacity: 0.75;
}
.calc-table td strong {
    color: #16a34a; /* Accents the target calculated values cleanly */
}
/* ==========================================================================
   Instructions Component - Safe for both Light & Dark viewing
   ========================================================================== */
.calc-instructions {
    margin-top: 30px;
    padding: 20px;
    /* Uses transparency so background matches the system theme context color weight */
    background-color: rgba(22, 163, 74, 0.07); 
    border-left: 4px solid #16a34a;
    border-radius: 4px;
}
.calc-instructions h3 {
    margin-top: 0;
    font-size: 1.05em;
}
.calc-instructions ol {
    margin: 0;
    padding-left: 20px;
}
.calc-instructions li {
    font-size: 0.9em;
    line-height: 1.6;
    margin-bottom: 8px;
    opacity: 0.9;
}
.calc-instructions li:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   RTL Layout Alignments Context Changes
   ========================================================================== */
.algae-calc-wrap.rtl-mode {
    direction: rtl;
    text-align: right;
}
.algae-calc-wrap.rtl-mode .calc-lang-switcher {
    justify-content: flex-start;
}
.algae-calc-wrap.rtl-mode .calc-table {
    text-align: right;
}
.algae-calc-wrap.rtl-mode .calc-instructions {
    border-left: none;
    border-right: 4px solid #16a34a;
}
.algae-calc-wrap.rtl-mode .calc-instructions ol {
    padding-left: 0;
    padding-right: 20px;
}