/* =========================
   REBAR TOOL CARD (SYSTEM A)
========================= */

.rebar-tool-card {
    max-width: 620px;
    margin: 1rem auto;
    padding: 1rem;
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
    font-family: Arial, sans-serif;
}

/* Title */
.rebar-tool-card h2 {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.4rem;
}

/* Sections */
.rebar-tool-card .section {
    margin-bottom: 1rem;
}

/* Labels */
.rebar-tool-card label {
    display: block;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

/* ================= INPUT ROW ================= */
.rebar-tool-card .input-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
    flex-wrap: wrap; /* ✅ FIXED */
}

/* Inputs */
.rebar-tool-card select,
.rebar-tool-card input {
    padding: 0.45rem;
    font-size: 0.85rem;
    border-radius: 6px;
    border: 1px solid #ccc;
    box-sizing: border-box;
}

/* Width control */
.dia-select { width: 70px; }
.dia-custom { width: 70px; }
.length { width: 80px; }
.qty { width: 70px; }
.price { width: 110px; }

/* Checkbox */
.price-toggle {
    display: flex;
    align-items: center;
    font-size: 0.8rem;
    gap: 4px;
    white-space: nowrap;
}

/* ================= BUTTONS ================= */
.rebar-tool-card .button-group {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.rebar-tool-card button {
    flex: 1;
    padding: 0.65rem;
    border-radius: 6px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    font-size: 0.95rem;
}

/* Primary */
.rebar-tool-card .calculate-btn {
    background: #28a745;
    color: #fff;
}

.rebar-tool-card .calculate-btn:hover {
    background: #218838;
}

/* Reset */
.rebar-tool-card .reset-btn {
    background: #dc3545;
    color: #fff;
}

.rebar-tool-card .reset-btn:hover {
    background: #b52a37;
}

/* ================= ROW ACTION BUTTON ================= */
.row-action-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    flex-shrink: 0;
}

/* Add */
.add-btn {
    background: #007bff;
    color: #fff;
}

.add-btn:hover {
    background: #0056b3;
}

/* Remove */
.remove-btn {
    background: #dc3545;
    color: #fff;
}

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

/* ================= RESULT CARD ================= */
.tool-result-card {
    margin-top: 1rem;
    padding: 0.9rem;
    background: #fff;
    border-left: 6px solid #1e73be;
    border-radius: 6px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    font-size: 0.95rem;
}

/* Table */
.rebar-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

.rebar-table th,
.rebar-table td {
    border: 1px solid #ddd;
    padding: 6px;
    text-align: center;
}

.rebar-table th {
    background: #f2f2f2;
}

/* ================= WARNINGS ================= */
.tool-warning {
    background: #fff3cd;
    border-left: 4px solid #ffb300;
    padding: 0.6rem;
    border-radius: 4px;
    margin-top: 0.5rem;
    font-size: 0.9rem;
}

/* Waste coloring */
.waste-medium {
    color: #ff9800;
    font-weight: 600;
}

.waste-high {
    color: #dc3545;
    font-weight: 700;
}

/* ================= ADVANCED ================= */
.toggle-btn {
    width: 100%;
    background: #007bff;
    color: white;
    padding: 0.55rem;
    border-radius: 6px;
    margin-bottom: 0.4rem;
    cursor: pointer;
}

.toggle-section {
    max-height: 0;
    overflow: hidden;
    transition: 0.3s ease;
}

.toggle-section.show {
    max-height: 800px;
    margin-top: 0.5rem;
}

/* spacing between advanced blocks */
.section + .section {
    margin-top: 0.8rem;
}

/* ================= MOBILE ================= */
@media (max-width: 480px) {

    .rebar-tool-card .input-row {
        gap: 0.3rem;
    }

    .dia-select,
    .dia-custom,
    .length,
    .qty,
    .price {
        flex: 1 1 30%;
        min-width: 65px;
    }

    .price-toggle {
        flex: 1 1 100%;
        margin-top: 4px;
    }

    .row-action-btn {
        flex: 0 0 auto;
    }

    .rebar-tool-card .button-group {
        flex-direction: column;
    }
}

/* ================= FOCUS ================= */
.rebar-tool-card input:focus,
.rebar-tool-card select:focus {
    outline: none;
    border-color: #1e73be;
    box-shadow: 0 0 3px rgba(30,115,190,0.3);
}

/* ================= TABS ================= */

.rebar-tabs {
  display: flex;
  margin-bottom: 0.8rem;
  border-radius: 6px;
  overflow: hidden;
}

.tab-btn {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: #e0e0e0;
  cursor: pointer;
  font-weight: 600;
}

.tab-btn.active {
  background: #1e73be;
  color: white;
}