/* ============================================================
   GST Calculator — Page-specific styles
   Follows the GearsKit EMI calculator design system:
   bg-gray-50 body, blue-* accents, gray-* borders, card-shadow
   ============================================================ */

/* ── Tab navigation ─────────────────────────────────────── */
.gst-tabs {
    display: flex;
    gap: 0;
    background: #f3f4f6;
    border-radius: 10px;
    padding: 4px;
    border: 1px solid #e5e7eb;
}

.gst-tab-btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, box-shadow 0.15s;
    white-space: nowrap;
}

.gst-tab-btn.active {
    background: #ffffff;
    color: #1d4ed8;
    box-shadow: 0 1px 4px rgba(0,0,0,0.10);
}

.gst-tab-btn:hover:not(.active) {
    color: #374151;
    background: #e9ebee;
}

/* ── GST rate selector pills ─────────────────────────────── */
.gst-rate-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.gst-rate-btn {
    padding: 6px 16px;
    border-radius: 20px;
    border: 1.5px solid #d1d5db;
    background: #ffffff;
    color: #374151;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}

.gst-rate-btn:hover {
    border-color: #3b82f6;
    color: #1d4ed8;
}

.gst-rate-btn.active {
    background: #eff6ff;
    border-color: #3b82f6;
    color: #1d4ed8;
}

/* ── Supply type toggle (intra / inter) ──────────────────── */
.supply-toggle {
    display: flex;
    gap: 0;
    background: #f3f4f6;
    border-radius: 8px;
    padding: 3px;
    border: 1px solid #e5e7eb;
    width: fit-content;
}

.supply-toggle-btn {
    padding: 6px 18px;
    font-size: 0.8125rem;
    font-weight: 600;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: #6b7280;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.supply-toggle-btn.active {
    background: #ffffff;
    color: #1d4ed8;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ── Result rows ─────────────────────────────────────────── */
.result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #f3f4f6;
    font-size: 0.9rem;
}

.result-row:last-child {
    border-bottom: none;
}

.result-row .label {
    color: #6b7280;
    font-weight: 500;
}

.result-row .value {
    color: #111827;
    font-weight: 700;
    font-size: 1rem;
}

.result-row.total-row {
    padding: 14px 0;
    border-top: 2px solid #e5e7eb;
    margin-top: 4px;
}

.result-row.total-row .label {
    color: #111827;
    font-weight: 700;
    font-size: 1rem;
}

.result-row.total-row .value {
    color: #1d4ed8;
    font-size: 1.25rem;
}

.result-row.gst-split {
    background: #eff6ff;
    margin: 0 -12px;
    padding: 8px 12px;
    border-bottom: none;
    border-radius: 6px;
}

.result-row.gst-split .label {
    color: #1d4ed8;
}

.result-row.gst-split .value {
    color: #1d4ed8;
}

/* ── Tooltip (info icon + popover) ─────────────────────────── */
.info-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #6b7280;
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
    margin-left: 5px;
    vertical-align: middle;
    position: relative;
    border: none;
    outline: none;
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}

.info-icon:hover,
.info-icon:focus {
    background: #3b82f6;
    color: #ffffff;
}

.info-icon::after {
    content: 'i';
    font-style: normal;
    line-height: 1;
}

.tooltip-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.tooltip-pop {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    width: 220px;
    background: #1e293b;
    color: #e2e8f0;
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.5;
    padding: 10px 12px;
    border-radius: 8px;
    z-index: 100;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

.tooltip-pop::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e293b;
}

.tooltip-wrap:hover .tooltip-pop,
.tooltip-wrap.open .tooltip-pop {
    opacity: 1;
    pointer-events: auto;
}

/* Right-edge tooltips don't bleed off screen */
@media (max-width: 480px) {
    .tooltip-pop {
        left: auto;
        right: 0;
        transform: none;
    }
    .tooltip-pop::after {
        left: auto;
        right: 12px;
        transform: none;
    }
}

/* ── Formula block ─────────────────────────────────────────── */
.formula-block {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 3px solid #3b82f6;
    border-radius: 6px;
    padding: 12px 16px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.8125rem;
    color: #374151;
    line-height: 1.7;
    overflow-x: auto;
}

/* ── Multi-item table ─────────────────────────────────────── */
.gst-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.gst-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
}

.gst-table th {
    background: #f3f4f6;
    color: #6b7280;
    font-weight: 600;
    text-align: left;
    padding: 8px 10px;
    border-bottom: 1px solid #e5e7eb;
    white-space: nowrap;
}

.gst-table td {
    padding: 7px 10px;
    border-bottom: 1px solid #f3f4f6;
    color: #374151;
    vertical-align: middle;
}

.gst-table tbody tr:last-child td {
    border-bottom: none;
}

.gst-table tfoot td {
    padding: 10px 10px;
    font-weight: 700;
    color: #111827;
    border-top: 2px solid #e5e7eb;
    background: #f9fafb;
}

.gst-table input[type="text"],
.gst-table input[type="number"],
.gst-table select {
    width: 100%;
    min-width: 60px;
    padding: 4px 8px;
    border: 1px solid #d1d5db;
    border-radius: 5px;
    font-size: 0.8125rem;
    color: #111827;
    background: #fff;
    outline: none;
}

.gst-table input[type="text"]:focus,
.gst-table input[type="number"]:focus,
.gst-table select:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59,130,246,0.15);
}

.gst-table .del-btn {
    background: none;
    border: none;
    color: #ef4444;
    cursor: pointer;
    font-size: 1rem;
    padding: 2px 6px;
    border-radius: 4px;
    transition: background 0.12s;
}

.gst-table .del-btn:hover {
    background: #fef2f2;
}

/* ── Annual estimator section ─────────────────────────────── */
.annual-section {
    border-top: 1px solid #e5e7eb;
    margin-top: 8px;
    padding-top: 16px;
}

.annual-toggle-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: none;
    color: #1d4ed8;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
}

.annual-toggle-btn .chevron {
    transition: transform 0.2s;
    display: inline-block;
}

.annual-toggle-btn.open .chevron {
    transform: rotate(180deg);
}

.annual-body {
    display: none;
    margin-top: 14px;
}

.annual-body.open {
    display: block;
}

/* ── Input helpers ─────────────────────────────────────────── */
.input-group {
    position: relative;
}

.input-group .prefix {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #6b7280;
    font-weight: 600;
    font-size: 0.9rem;
    pointer-events: none;
}

.input-group input {
    padding-left: 28px;
}

/* ── Result badge (GST rate highlight) ─────────────────────── */
.rate-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 700;
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
}

/* ── Section divider ─────────────────────────────────────── */
.section-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 24px 0;
}

/* ── Responsive adjustments ──────────────────────────────── */
@media (max-width: 640px) {
    .gst-tab-btn {
        font-size: 0.75rem;
        padding: 7px 8px;
    }

    .gst-rate-btn {
        padding: 5px 12px;
        font-size: 0.75rem;
    }
}
