/**
 * Aquarium Simple Tools - Fixed Table & Mobile
 */
.ast-calculator-container,
.ast-calculator-container * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

.ast-calculator-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.35;
    color: #2c3e50;
    max-width: 100%;
    overflow-x: auto;
}

.ast-calc-header h3 {
    font-size: 1.35rem;
    font-weight: 600;
    margin: 0 0 2px 0;
}

.ast-calc-description {
    font-size: 0.85rem;
    margin: 0 0 6px 0;
    color: #4a5568;
}

.ast-presets-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 5px 8px;
    margin-bottom: 8px;
}

.presets-label {
    font-size: 0.85rem;
    font-weight: 600;
}

.ast-preset-btn {
    padding: 3px 10px;
    background: #3182ce;
    color: #fff;
    border: none;
    border-radius: 3px;
    font-size: 0.8rem;
    cursor: pointer;
}

.ast-converter-grid {
    display: flex;
    flex-direction: column;
    gap: 3px;
    margin-bottom: 10px;
}

/* Desktop row style */
.ast-converter-row {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left-width: 3px;
    border-left-color: #3182ce;
    padding: 4px 8px;
}

.ast-row-label {
    flex: 2;
    min-width: 180px;
    white-space: nowrap;
}

.ast-unit-name-full {
    font-size: 0.9rem;
    font-weight: 600;
    white-space: nowrap;
}

.ast-unit-badge {
    font-size: 0.7rem;
    padding: 2px 6px;
    margin-left: 6px;
    border-radius: 10px;
    display: inline-block;
    font-weight: 600;
    white-space: nowrap;
}

.ast-badge-metric { background: #c6f6d5; color: #22543d; }
.ast-badge-us { background: #fed7e2; color: #831843; }
.ast-badge-uk { background: #e9d8fd; color: #44337a; }

.ast-row-input {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
}

.ast-flow-input {
    width: 95px;
    padding: 5px 6px;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    font-size: 0.9rem;
    text-align: right;
}

.ast-unit-symbol {
    font-size: 0.8rem;
    color: #718096;
    min-width: 65px;
}

.ast-copy-btn {
    width: 28px;
    height: 28px;
    background: #edf2f7;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.ast-turnover-section {
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    padding: 8px 10px;
    margin-bottom: 8px;
}

.ast-turnover-section h4 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 6px 0;
}

.ast-turnover-inputs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 6px;
}

.ast-turnover-input {
    display: flex;
    align-items: center;
    gap: 6px;
}

.ast-turnover-input label {
    font-size: 0.9rem;
    font-weight: 500;
}

.ast-turnover-input input,
.ast-turnover-input select {
    padding: 5px 8px;
    font-size: 0.9rem;
    border: 1px solid #cbd5e0;
    border-radius: 3px;
}

.ast-turnover-input select {
    min-width: 130px;
    width: auto;
}

.ast-turnover-input input {
    width: 125px;
    min-width: 100px;
}

/* Current turnover display */
.ast-turnover-current-display {
    text-align: center;
    font-size: 1.3rem;
    font-weight: 700;
    margin: 8px 0;
    padding: 8px;
    background: #dbeafe;
    border-radius: 6px;
    word-break: break-word;
    white-space: normal;
    overflow-wrap: break-word;
}

/* ========== TABLE STYLES ========== */
.ast-turnover-table table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
}
.ast-turnover-table th,
.ast-turnover-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: middle;
}
.ast-turnover-table th {
    background: #e2e8f0;
    font-weight: 600;
}
.ast-turnover-table th:nth-child(2),
.ast-turnover-table td:nth-child(2) {
    text-align: center;
}
.ast-turnover-table th:nth-child(3),
.ast-turnover-table td:nth-child(3) {
    text-align: center;
}
.ast-turnover-table tr:last-child td {
    border-bottom: none;
}

/* ========== MOBILE COMPACT (width ≤ 600px) ========== */
@media (max-width: 600px) {
    /* Convert rows to vertical */
    .ast-converter-row {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
        padding: 8px;
    }
    .ast-row-label {
        min-width: auto;
        white-space: normal;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
    }
    .ast-unit-name-full {
        white-space: normal;
        font-size: 0.85rem;
        word-break: break-word;
        max-width: 70%;
    }
    .ast-unit-badge {
        margin-left: auto;
    }
    .ast-row-input {
        justify-content: space-between;
        width: 100%;
    }
    .ast-flow-input {
        width: 70px;
    }
    .ast-unit-symbol {
        min-width: 50px;
    }
    /* Turnover inputs stack */
    .ast-turnover-inputs {
        flex-direction: column;
        gap: 8px;
    }
    .ast-turnover-input {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .ast-turnover-input label {
        min-width: 85px;
    }
    .ast-turnover-input input,
    .ast-turnover-input select {
        flex: 1;
        width: auto;
        min-width: 0;
        max-width: calc(100% - 90px);
    }
    .ast-turnover-current-display {
        font-size: 1.1rem;
        padding: 6px;
    }
    /* Hide table, show cards */
    .ast-turnover-table table {
        display: none !important;
    }
    .ast-recommendation-cards {
        display: flex !important;
        flex-direction: column;
        gap: 8px;
    }
    .ast-rec-card {
        background: #f8fafc;
        border: 1px solid #e2e8f0;
        border-left: 3px solid #3182ce;
        border-radius: 6px;
        padding: 8px 12px;
        display: flex;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        margin-bottom: 4px;
    }
    .ast-rec-card .rec-name {
        font-weight: 600;
        font-size: 0.85rem;
        display: flex;
        align-items: center;
        gap: 5px;
        flex: 1;
        word-break: break-word;
    }
    .ast-rec-card .rec-range {
        font-size: 0.85rem;
        color: #2c3e50;
        white-space: nowrap;
    }
    .ast-rec-card .rec-status {
        font-size: 0.85rem;
        padding: 2px 8px;
        border-radius: 12px;
        font-weight: 500;
        white-space: nowrap;
    }
    .ast-presets-bar {
        gap: 4px;
    }
    .ast-preset-btn {
        font-size: 0.7rem;
        padding: 2px 6px;
    }
    .ast-calc-header h3,
    .ast-calc-description {
        word-break: break-word;
        white-space: normal;
    }
}

/* Desktop: hide cards, show table */
@media (min-width: 601px) {
    .ast-recommendation-cards {
        display: none !important;
    }
    .ast-turnover-table table {
        display: table !important;
    }
}
/* Volume & Weight specific */
.dimensions-group {
    transition: all 0.2s;
}
.ast-turnover-input input[type="number"] {
    width: 110px;
}
.ast-turnover-input select {
    min-width: 80px;
}
#volweight-results-<?php echo esc_attr($calc_id); ?> div {
    margin: 6px 0;
    padding: 4px;
    border-bottom: 1px dashed #cbd5e0;
}
@media (max-width: 600px) {
    .ast-turnover-input {
        flex-wrap: wrap;
    }
    .ast-turnover-input input, .ast-turnover-input select {
        max-width: 100%;
    }
}