/* ── User Accounts: Side Panel ──────────────────────────────────────────────── */
:root { --ua-top: 175px; --ua-width: 200px; }



#user-panel {
    position: fixed;
    top: var(--ua-top);
    left: 0;
    width: var(--ua-width);
    height: calc(100vh - var(--ua-top));
    background: #f0f0f0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease;
    font-size: 13px;
    overflow: hidden;
    /* No right border — active tabs connect seamlessly to white page */
}

#user-panel.collapsed {
    transform: translateX(calc(-1 * var(--ua-width)));
}

/* Panel header */
.user-panel-header {
    padding: 10px 12px;
    background: #d2165c;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 40px;
}

.user-panel-header .user-email {
    font-size: 11px;
    color: #fff;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
    font-weight: 600;
}

.user-panel-header .btn-signin {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 3px;
    font-weight: 600;
}
.user-panel-header .btn-signin:hover {
    background: rgba(255,255,255,0.35);
}

.user-panel-header .btn-hide-panel {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 12px;
    padding: 3px 6px;
    border-radius: 3px;
    margin-left: auto;
}
.user-panel-header .btn-hide-panel:hover {
    background: rgba(255,255,255,0.3);
}

/* Logout button at bottom */
#user-panel > .btn-logout {
    display: block;
    width: calc(100% - 16px);
    margin: 8px;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: #fff;
    color: #999;
    cursor: pointer;
    font-size: 11px;
    text-align: center;
    transition: all 0.15s;
}
#user-panel > .btn-logout:hover {
    border-color: #dc3545;
    color: #dc3545;
    background: #fff5f5;
}

/* Saved calculations list */
.saved-calculations-list {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0;
    background: transparent;
}

/* ── Book index divider tabs ──────────────────────────────────────────────── */

.calc-card {
    position: relative;
    padding: 8px 10px 7px 12px;
    margin: 0;
    cursor: pointer;
    transition: all 0.15s;
    background: transparent;
    border-left: 5px solid var(--tab, #d2165c);
    border-bottom: 1px solid #e5e5e5;
}
.calc-card:hover {
    background: rgba(0,0,0,0.03);
}

/* Active tab: white bg connects to the white page — no right border */
.calc-card.active {
    background: #fff;
    border-left-width: 5px;
    padding: 9px 0 8px 12px;
    margin-right: 0;
    border-bottom-color: #fff;
    box-shadow: 2px 0 6px rgba(0,0,0,0.04);
    z-index: 2;
}

.calc-card .calc-gross {
    font-size: 10px;
    color: #aaa;
    font-weight: 500;
}

.calc-card .calc-name {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #777;
}
.calc-card.active .calc-name {
    color: #333;
}

.calc-card .calc-net {
    font-size: 14px;
    font-weight: 700;
    color: var(--tab, #8a0737);
}

/* Stacked bar sparkline */
.calc-bar {
    display: flex;
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
    margin: 4px 10px 3px 0;
    background: #e0e0e0;
}
.calc-card.active .calc-bar {
    margin-right: 0;
    background: #eee;
}
.calc-bar-seg {
    display: block;
    min-width: 2px;
}
.calc-bar-seg:hover {
    filter: brightness(1.15);
}

.calc-card .calc-meta {
    font-size: 10px;
    color: #aaa;
    margin-top: 2px;
    display: flex;
    align-items: center;
    gap: 5px;
}
.calc-card.active .calc-meta {
    color: #999;
}

.calc-card .calc-badge {
    display: inline-block;
    font-size: 9px;
    padding: 0 5px;
    border-radius: 2px;
    background: #e5e5e5;
    color: #888;
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.3px;
}
.calc-card.active .calc-badge {
    background: #f0f0f0;
}

.calc-card .calc-actions {
    position: absolute;
    top: 5px;
    right: 6px;
    display: flex;
    gap: 3px;
    opacity: 0;
    transition: opacity 0.15s;
}
.calc-card:hover .calc-actions {
    opacity: 1;
}
.calc-card .calc-actions button {
    background: transparent;
    border: none;
    color: #bbb;
    cursor: pointer;
    padding: 4px;
    font-size: 15px;
    border-radius: 3px;
}
.calc-card .calc-actions button:hover {
    color: #dc3545;
    background: rgba(220,53,69,0.08);
}

/* Compare checkbox */
.calc-card .calc-compare-check {
    position: absolute;
    bottom: 5px;
    right: 8px;
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #d2165c;
}

/* New calc button */
.btn-new-calc {
    display: block;
    width: calc(100% - 16px);
    margin: 6px 8px;
    padding: 6px;
    border: 2px dashed #ccc;
    border-radius: 6px;
    background: none;
    color: #bbb;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    transition: all 0.15s;
}
.btn-new-calc:hover {
    border-color: #d2165c;
    color: #d2165c;
    background: rgba(229,94,33,0.05);
}

/* Compare bar */
.compare-bar {
    padding: 8px;
    border-top: 1px solid #e0e0e0;
    background: #f0f0f0;
    display: none;
}
.compare-bar.visible {
    display: block;
}
.compare-bar .btn-compare {
    width: 100%;
    padding: 6px;
    background: #d2165c;
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 700;
    transition: background 0.15s;
}
.compare-bar .btn-compare:hover {
    background: #e7276d;
}

/* Panel toggle button */
#user-panel-toggle {
    position: fixed;
    top: calc(var(--ua-top) + 40vh);
    left: 0;
    transform: translateY(-50%);
    z-index: 999;
    width: 24px;
    height: 48px;
    background: #d2165c;
    border: none;
    border-radius: 0 5px 5px 0;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 1px 0 4px rgba(229, 33, 108, 0.3);
}
#user-panel-toggle:hover {
    background: #e7276d;
    width: 28px;
}

/* ── Action bar (Save + PDF buttons, outside scroll wrapper) ───────────────── */

.tbl-action-bar {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    padding: 6px 2px 2px;
}

/* ── Save button ─────────────────────────────────────────────────────────────── */

.btn-save-calc {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    background: #d2165c;
    border: none;
    color: #fff;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-save-calc:hover {
    background: #e7276d;
}
.btn-save-calc.saved {
    background: #28a745;
}

/* ── Download PDF button ────────────────────────────────────────────────────── */

.btn-download-pdf {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 14px;
    font-size: 12px;
    font-weight: 600;
    background: transparent;
    border: none;
    color: #d2165c;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.15s;
}
.btn-download-pdf:hover {
    background: #e7276d;
    color: #fff;
}
.btn-download-pdf:disabled {
    opacity: 0.6;
    cursor: default;
}

/* ── Auth modal ─────────────────────────────────────────────────────────────── */

#authModal .modal-content {
    border-radius: 10px;
    border: none;
    box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}
#authModal .modal-body {
    padding: 24px;
    text-align: center;
}
#authModal h5 {
    font-weight: 700;
    margin-bottom: 6px;
    color: #333;
}
#authModal p {
    color: #666;
    font-size: 14px;
    margin-bottom: 14px;
}
#authModal .form-control {
    text-align: center;
    font-size: 16px;
    margin-bottom: 10px;
    border-radius: 6px;
    border: 2px solid #eee;
    padding: 10px;
}
#authModal .form-control:focus {
    border-color: #d2165c;
    box-shadow: 0 0 0 3px rgba(229,94,33,0.15);
}
#authModal #auth-send {
    background: #d2165c;
    border: none;
    border-radius: 6px;
    font-weight: 600;
    padding: 10px;
}
#authModal #auth-send:hover {
    background: #e7276d;
}

/* ── Comparison overlay ─────────────────────────────────────────────────────── */

#compare-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    z-index: 2000;
    display: none;
    overflow-y: auto;
    padding: 40px 20px;
}

#compare-overlay.visible {
    display: block;
}

.compare-container {
    max-width: 900px;
    margin: 0 auto;
    background: #fff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}

.compare-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: #d2165c;
    color: #fff;
}
.compare-header h5 {
    margin: 0;
    font-weight: 700;
}
.compare-header .btn-close-compare {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.compare-header .btn-close-compare:hover {
    background: rgba(255,255,255,0.35);
}

.compare-table {
    width: 100%;
    border-collapse: collapse;
}
.compare-table th {
    padding: 10px 14px;
    text-align: right;
    background: #f8f8f8;
    font-size: 13px;
    border-bottom: 2px solid #eee;
    color: #555;
}
.compare-table th:first-child {
    text-align: left;
}
.compare-table td {
    padding: 8px 14px;
    text-align: right;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}
.compare-table td:first-child {
    text-align: left;
    font-weight: 500;
    color: #555;
}
.compare-table td.diff {
    color: #d2165c;
    font-weight: 700;
}

/* Compare chart */
#compare-chart-wrap {
    padding: 16px;
    height: 260px;
}

/* ── Tax Charts Section (page charts, below calculator) ───────────────────── */

.tax-charts-section {
    max-width: 900px;
    margin: 30px auto 40px;
    padding: 0 20px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 20px;
}

.chart-card {
    background: #fff;
    border-radius: 10px;
    padding: 18px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    border: 1px solid #f0f0f0;
}

.chart-card-title {
    font-size: 14px;
    font-weight: 700;
    color: #333;
    margin: 0 0 14px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f0f0;
}

.chart-wrap {
    height: 200px;
    position: relative;
}

.chart-wrap-donut {
    height: 300px;
}

/* ── Fun Facts Strip ───────────────────────────────────────────────────────── */

.fun-facts-strip {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.fun-fact-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    background: #fff;
    border-radius: 8px;
    padding: 12px 14px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.04);
    border: 1px solid #f0f0f0;
    transition: transform 0.15s;
}
.fun-fact-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.07);
}

.fun-fact-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
}

.fun-fact-content {
    min-width: 0;
}

.fun-fact-title {
    font-size: 16px;
    font-weight: 700;
    color: #333;
    margin-bottom: 1px;
}

.fun-fact-text {
    font-size: 15px;
    color: #666;
    line-height: 1.6;
}

/* ── Mobile: sticky bottom bar with expandable content ──────────────────── */

/* Mobile-only elements hidden on desktop */
.sheet-title { display: none; }
.sheet-arrow { display: none; }

@media screen and (max-width: 768px) {

    /* Hide the desktop sidebar toggle FAB — header is the toggle on mobile */
    #user-panel-toggle {
        display: none !important;
    }

    /* Panel: fixed to bottom, full width */
    #user-panel {
        top: auto !important;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: 100vw;
        height: auto;
        max-height: 65vh;
        z-index: 1000;
        border-radius: 0;
        box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
        box-sizing: border-box;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        transform: none !important;
        transition: max-height 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Collapsed: only header bar visible */
    #user-panel.collapsed {
        max-height: 48px;
        overflow: hidden;
    }

    /* Override the desktop collapsed translateX — we use max-height instead */
    #user-panel.collapsed {
        transform: none !important;
    }

    /* Header is always the tap target */
    .user-panel-header {
        border-radius: 0;
        cursor: pointer;
        min-height: 48px;
        padding: 12px 14px;
        position: sticky;
        top: 0;
        z-index: 2;
    }

    /* Hide desktop-only header elements */
    .user-panel-header .btn-hide-panel { display: none; }
    .user-panel-header .user-email { display: none; }

    /* Show mobile title + arrow */
    .sheet-title {
        display: block;
        color: #fff;
        font-size: 14px;
        font-weight: 700;
        padding-right: 28px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .sheet-arrow {
        display: flex;
        position: absolute;
        right: 14px;
        top: 50%;
        transform: translateY(-50%);
        color: #fff;
        font-size: 18px;
        opacity: 0.9;
        transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* Arrow UP when collapsed, flips DOWN when expanded */
    #user-panel.collapsed .sheet-arrow {
        transform: translateY(-50%) rotate(0deg);
    }
    #user-panel:not(.collapsed) .sheet-arrow {
        transform: translateY(-50%) rotate(180deg);
    }

    /* Cards */
    .calc-card {
        padding: 10px 12px 9px 14px;
    }
    .calc-card .calc-actions {
        opacity: 1;
    }

    .charts-grid {
        grid-template-columns: 1fr;
    }

    .fun-facts-strip {
        grid-template-columns: 1fr;
    }

    .chart-wrap-donut {
        height: 260px;
    }
}

/* ── Upsell banner ──────────────────────────────────────────────────────────── */

.upsell-banner {
    padding: 6px 10px;
    background: #fff3cd;
    color: #856404;
    font-size: 11px;
    text-align: center;
    border-bottom: 1px solid #e0e0a0;
}
.upsell-banner a {
    color: #d2165c;
    font-weight: 600;
    text-decoration: underline;
}

/* ── Inline delete confirmation overlay ─────────────────────────────────────── */

.delete-confirm {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.97);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    z-index: 10;
    border-radius: 2px;
    animation: deleteConfirmFade 0.1s ease;
}
.delete-confirm-msg {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    flex-shrink: 0;
}
.delete-confirm-yes,
.delete-confirm-cancel {
    border: none;
    border-radius: 3px;
    padding: 3px 9px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.delete-confirm-yes {
    background: #dc3545;
    color: #fff;
}
.delete-confirm-yes:hover {
    background: #c82333;
}
.delete-confirm-cancel {
    background: #e9ecef;
    color: #555;
}
.delete-confirm-cancel:hover {
    background: #dee2e6;
}
.delete-confirm-yes:focus,
.delete-confirm-cancel:focus {
    outline: 2px solid #d2165c;
    outline-offset: 2px;
}
@keyframes deleteConfirmFade {
    from { opacity: 0; }
    to   { opacity: 1; }
}
