/* ============================================
   Calculadora de CO2 — KH + pH
   Prefixo: .co2-*
   ============================================ */

/* === Container === */
.co2-calc {
    max-width: 780px;
    margin: 0 auto;
    padding: 0;
}

/* === Tabs === */
.co2-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 28px;
    border-bottom: 2px solid #e2e8f0;
}

.co2-tab {
    flex: 1;
    padding: 12px 20px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    font-size: 0.95rem;
    font-weight: 500;
    color: #718096;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.co2-tab:hover {
    color: #4a5568;
    background: #f7fafc;
}

.co2-tab.active {
    color: #2b6cb0;
    border-bottom-color: #3182ce;
    font-weight: 600;
}

/* === Form === */
.co2-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 28px;
}

.co2-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.co2-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.co2-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #4a5568;
}

.co2-input {
    width: 100%;
    padding: 10px 14px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    color: #2d3748;
    background: #fff;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.co2-input:focus {
    outline: none;
    border-color: #3182ce;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
}

.co2-input.error {
    border-color: #e53e3e;
    box-shadow: 0 0 0 3px rgba(229, 62, 62, 0.1);
}

.co2-error-msg {
    font-size: 0.8rem;
    color: #e53e3e;
    min-height: 18px;
}

/* === Buttons === */
.co2-actions {
    display: flex;
    gap: 12px;
    margin-top: 4px;
}

.co2-btn {
    padding: 11px 28px;
    border: none;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.co2-btn-primary {
    background: #3182ce;
    color: #fff;
}

.co2-btn-primary:hover {
    background: #2b6cb0;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(49, 130, 206, 0.3);
}

.co2-btn-secondary {
    background: #edf2f7;
    color: #4a5568;
}

.co2-btn-secondary:hover {
    background: #e2e8f0;
}

/* === Result Card === */
.co2-result-wrapper {
    animation: co2FadeIn 0.4s ease;
}

@keyframes co2FadeIn {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

.co2-result-card {
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
}

.co2-result-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.co2-result-icon {
    font-size: 1.4rem;
}

.co2-result-label {
    font-size: 0.875rem;
    color: #718096;
    font-weight: 500;
}

.co2-result-value-row {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 8px;
}

.co2-result-value {
    font-size: 2.4rem;
    font-weight: 700;
    line-height: 1;
}

.co2-result-unit {
    font-size: 1rem;
    color: #718096;
    font-weight: 500;
}

.co2-result-class {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.co2-result-class-desc {
    font-size: 0.85rem;
    color: #718096;
    margin-top: 4px;
}

/* Classification colors */
.co2-class-zero        { background: #f3f4f6; color: #6b7280; }
.co2-class-insufficient { background: #fef2f2; color: #dc2626; }
.co2-class-lowtech     { background: #fffbeb; color: #d97706; }
.co2-class-medium      { background: #f0fdf4; color: #16a34a; }
.co2-class-hightech    { background: #eff6ff; color: #2563eb; }
.co2-class-danger      { background: #fef2f2; color: #991b1b; }

/* Result value colors */
.co2-val-zero        { color: #9ca3af; }
.co2-val-insufficient { color: #ef4444; }
.co2-val-lowtech     { color: #f59e0b; }
.co2-val-medium      { color: #22c55e; }
.co2-val-hightech    { color: #3b82f6; }
.co2-val-danger      { color: #dc2626; }

/* === Fauna Badge === */
.co2-fauna-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-top: 12px;
}

.co2-fauna-safe    { background: #f0fdf4; color: #16a34a; border: 1px solid #bbf7d0; }
.co2-fauna-caution { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.co2-fauna-danger  { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* === Gauge === */
.co2-gauge-container {
    margin: 20px 0;
}

.co2-gauge-label {
    font-size: 0.8rem;
    color: #718096;
    margin-bottom: 8px;
    font-weight: 500;
}

.co2-gauge {
    position: relative;
    height: 28px;
    border-radius: 14px;
    overflow: visible;
    display: flex;
    margin-bottom: 24px;
}

.co2-gauge-zone {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: rgba(255,255,255,0.9);
    text-shadow: 0 1px 2px rgba(0,0,0,0.2);
    white-space: nowrap;
    overflow: hidden;
}

.co2-gauge-zone:first-child {
    border-radius: 14px 0 0 14px;
}

.co2-gauge-zone:last-child {
    border-radius: 0 14px 14px 0;
}

.co2-gauge-zone-insuf  { background: #ef4444; width: 10%; }
.co2-gauge-zone-low    { background: #f59e0b; width: 20%; }
.co2-gauge-zone-ideal  { background: #22c55e; width: 30%; }
.co2-gauge-zone-danger { background: #dc2626; width: 40%; }

.co2-gauge-pointer {
    position: absolute;
    top: -8px;
    transform: translateX(-50%);
    z-index: 2;
    transition: left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.co2-gauge-pointer-arrow {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 10px solid #1a202c;
    margin: 0 auto;
}

.co2-gauge-pointer-value {
    background: #1a202c;
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
    white-space: nowrap;
    margin-bottom: 2px;
}

.co2-gauge-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    padding: 0 2px;
}

.co2-gauge-tick {
    font-size: 0.7rem;
    color: #a0aec0;
}

/* === Tips === */
.co2-tips {
    background: #fffff0;
    border: 1px solid #fefcbf;
    border-radius: 10px;
    padding: 16px 20px;
    margin-bottom: 24px;
}

.co2-tips-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #975a16;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.co2-tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.co2-tips-list li {
    font-size: 0.85rem;
    color: #744210;
    padding-left: 20px;
    position: relative;
}

.co2-tips-list li::before {
    content: '💡';
    position: absolute;
    left: 0;
    font-size: 0.75rem;
}

.co2-tip-kh-warning {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: #9b2c2c;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* === Reverse Info === */
.co2-reverse-info {
    background: #ebf8ff;
    border: 1px solid #bee3f8;
    border-radius: 8px;
    padding: 10px 14px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: #2a4365;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

/* === Formula Display === */
.co2-formula {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 16px;
    margin-top: 16px;
    text-align: center;
}

.co2-formula-label {
    font-size: 0.75rem;
    color: #a0aec0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.co2-formula-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a5568;
    font-family: 'Courier New', monospace;
}

/* === Reference Table === */
.co2-ref-section {
    margin-top: 36px;
}

.co2-ref-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #2d3748;
    margin-bottom: 4px;
}

.co2-ref-subtitle {
    font-size: 0.85rem;
    color: #a0aec0;
    margin-bottom: 16px;
}

.co2-ref-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 0 -4px;
    padding: 0 4px 8px;
}

.co2-ref-table {
    border-collapse: collapse;
    width: 100%;
    min-width: 600px;
    font-size: 0.8rem;
}

.co2-ref-table th {
    background: #edf2f7;
    color: #4a5568;
    font-weight: 600;
    padding: 8px 6px;
    text-align: center;
    border: 1px solid #e2e8f0;
    white-space: nowrap;
    position: sticky;
    top: 0;
}

.co2-ref-table th:first-child {
    position: sticky;
    left: 0;
    z-index: 2;
    background: #e2e8f0;
}

.co2-ref-table td {
    padding: 6px;
    text-align: center;
    border: 1px solid #e2e8f0;
    font-weight: 500;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.co2-ref-table td:first-child {
    background: #edf2f7;
    font-weight: 600;
    color: #4a5568;
    position: sticky;
    left: 0;
    z-index: 1;
}

/* Table cell classification colors */
.co2-cell-zero        { background: #f9fafb; color: #9ca3af; }
.co2-cell-insufficient { background: #fef2f2; color: #b91c1c; }
.co2-cell-lowtech     { background: #fffbeb; color: #92400e; }
.co2-cell-medium      { background: #f0fdf4; color: #166534; }
.co2-cell-hightech    { background: #eff6ff; color: #1e40af; }
.co2-cell-danger      { background: #fce4e4; color: #7f1d1d; font-weight: 700; }

/* Highlighted cell (closest to user input) */
.co2-cell-highlight {
    outline: 3px solid #1a202c;
    outline-offset: -2px;
    z-index: 1;
    position: relative;
    font-weight: 700 !important;
    box-shadow: 0 0 0 1px #fff, 0 0 8px rgba(26, 32, 44, 0.3);
}

/* === Legend === */
.co2-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

.co2-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.75rem;
    color: #718096;
}

.co2-legend-color {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    border: 1px solid rgba(0,0,0,0.1);
}

/* === Separator === */
.co2-separator {
    height: 1px;
    background: #e2e8f0;
    margin: 24px 0;
}

/* === Responsive === */
@media (max-width: 768px) {
    .co2-form-row {
        grid-template-columns: 1fr;
    }

    .co2-actions {
        flex-direction: column;
    }

    .co2-btn {
        width: 100%;
        text-align: center;
    }

    .co2-result-value {
        font-size: 2rem;
    }

    .co2-gauge-zone {
        font-size: 0.6rem;
    }

    .co2-legend {
        gap: 8px;
    }
}

@media (max-width: 480px) {
    .co2-calc {
        padding: 0;
    }

    .co2-tab {
        padding: 10px 12px;
        font-size: 0.85rem;
    }

    .co2-result-value {
        font-size: 1.8rem;
    }

    .co2-ref-table {
        font-size: 0.7rem;
    }

    .co2-ref-table th,
    .co2-ref-table td {
        padding: 4px 3px;
    }
}
