/* =============================================
   TEXT TOOLS - FULLY SELF-CONTAINED STYLESHEET
   No dependency on tool.css. Uses the same CSS
   custom properties already defined site-wide in
   calcleaf.css (--navy, --teal, --border, etc.)
   ============================================= */

.tool-wrap { max-width: var(--container, 1080px); margin: 0 auto; padding: 0 20px 64px; }

/* Breadcrumb styling now lives solely in the global calcleaf.css,
   so it's shared and consistent across Calculators, Text Tools,
   and Pdf Tools. */

/* ---------------- Tool switcher tabs (top of page) ---------------- */
.tool-tabs-bar {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 14px;
    border-bottom: 2px solid var(--border);
    padding-bottom: 0;
}
.tool-tab {
    padding: 10px 16px;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text2);
    text-decoration: none;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    white-space: nowrap;
    transition: color 0.2s, border-color 0.2s;
}
.tool-tab:hover { color: var(--navy); }
.tool-tab.active {
    color: var(--teal);
    border-bottom-color: var(--teal);
}

/* ---------------- Full-width tool (no sidebar split) ---------------- */
/* ---------------- Two-column tool page layout (sticky sidebar) ---------------- */
.tool-page-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.tool-main-col { flex: 1; min-width: 0; }
.tool-sidebar-col {
    flex: 0 0 300px;
    position: sticky;
    top: 90px;
}
.tool-sidebar-col .tool-search-box { margin-bottom: 16px; }
.tool-ad-placeholder {
    background: var(--light);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    min-height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

@media (max-width: 900px) {
    .tool-sidebar-col { display: none; }
    .tool-page-layout { flex-direction: column; }
}
.tool-below-row {
    display: flex;
    gap: 20px;
    margin-top: 20px;
    align-items: stretch;
}
.tool-below-row .tool-search-box { flex: 0 0 34%; margin-bottom: 0; }
.tool-below-row .tool-sidebar-categories { flex: 1; margin-bottom: 0; }
.tool-below-row .tool-sidebar-categories .sidebar-links {
    display: flex;
    flex-wrap: wrap;
    padding: 10px;
}
.tool-below-row .tool-sidebar-categories .sidebar-links li { flex: 0 0 auto; }
.tool-below-row .tool-sidebar-categories .sidebar-links li a {
    border-left: none;
    border-radius: 20px;
    padding: 8px 14px;
    background: var(--light);
    margin: 4px;
}
.tool-below-row .tool-sidebar-categories .sidebar-links li a:hover { padding-left: 14px; background: var(--border); }
.tool-below-row .tool-sidebar-categories .sidebar-links li a.active { background: #f0fdf9; }

/* Share box shown inline in the same row as search, when related tools are hidden */
.tool-below-row .tool-share-inrow { flex: 1; margin-top: 0; margin-bottom: 0; }
.tool-below-row .tool-quick-feedback-inrow { flex: 1; margin-top: 0; margin-bottom: 0; }

/* ---------------- Share (standalone, last section on the page) ---------------- */
.tool-share-final { margin-top: 20px; }

/* ---------------- Tool box / header ---------------- */
.tool-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 16px;
    border-left: 4px solid var(--teal);
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,0.06));
}
.tool-header { margin-bottom: 6px; }
.tool-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}
.tool-header-title {
    font-size: 24px;
    font-weight: 700;
    color: var(--navy);
    letter-spacing: -0.4px;
    margin: 0;
}
.tool-header-desc {
    font-size: 16px;
    color: var(--text2);
    line-height: 1.6;
    margin: 0;
    max-width: 100%;
}

/* ---------------- Sidebar links (related tools) ---------------- */
.sidebar-links { list-style: none; margin: 0; padding: 8px 0; }
.sidebar-links li a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    font-size: 13.5px;
    color: var(--text2);
    text-decoration: none;
    border-left: 3px solid transparent;
    transition: background 0.2s, color 0.2s, border-color 0.2s, padding-left 0.2s;
}
.sidebar-link-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    color: var(--teal);
}
.sidebar-link-icon svg { width: 15px; height: 15px; }
.sidebar-links li a:hover {
    background: var(--light);
    color: var(--navy);
    border-left-color: var(--teal);
    padding-left: 20px;
}
.sidebar-links li a.active {
    background: transparent;
    color: var(--teal);
    font-weight: 600;
    border-left-color: var(--teal);
}

/* ---------------- Search box (sidebar) ---------------- */
.tool-search-box {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,0.06));
    overflow: visible;
    margin-bottom: 16px;
    position: relative;
}
.tool-search-label {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: var(--radius) var(--radius) 0 0;
}
.tool-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px;
}
.tool-search-icon {
    position: absolute;
    left: 18px;
    color: var(--muted, #9ca3af);
    pointer-events: none;
}
.tool-search-input-wrap input {
    width: 100%;
    padding: 10px 12px 10px 42px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--navy);
    background: var(--light, #f9fafb);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
    box-sizing: border-box;
}
.tool-search-input-wrap input:focus {
    border-color: var(--teal);
    background: var(--white);
}
.tool-search-results {
    display: none;
    position: absolute;
    left: 16px;
    right: 16px;
    top: calc(100% - 4px);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 12px 28px -10px rgba(16,24,40,0.2);
    max-height: 280px;
    overflow-y: auto;
    z-index: 50;
}
.tool-search-results.open { display: block; }
.tool-search-results a {
    display: block;
    padding: 10px 14px;
    font-size: 13.5px;
    color: var(--text2, #374151);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: background 0.15s, color 0.15s;
}
.tool-search-results a:last-child { border-bottom: none; }
.tool-search-results a:hover { background: #f0fdf9; color: var(--teal); }

/* ---------------- Categories sidebar box ---------------- */
.tool-sidebar-categories {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow, 0 1px 3px rgba(0,0,0,0.06));
    margin-bottom: 16px;
}
.tool-sidebar-title {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}


/* Note: Share is now a single standalone section (.tool-share-final) shown
   on all screen sizes, so no separate mobile-only duplicate is needed. */

/* ---------------- Generic tool form elements ---------------- */
.mort-instruction {
    font-size: 13.5px;
    color: var(--text2);
    background: var(--light);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mort-layout { display: block; }
.mort-inputs { display: flex; flex-direction: column; gap: 16px; }

.tool-group { display: flex; flex-direction: column; gap: 6px; }
.tool-group label { font-size: 13.5px; font-weight: 600; color: var(--navy); }

.tool-input-wrap { position: relative; }
.tool-input-wrap input,
.tool-input-wrap select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--text);
    background: var(--white);
    outline: none;
    box-sizing: border-box;
    font-family: var(--font-main, inherit);
}
.tool-input-wrap input:focus,
.tool-input-wrap select:focus { border-color: var(--teal); }
.tool-input-suffix {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    font-size: 13px;
    pointer-events: none;
}

.tool-actions { display: flex; gap: 10px; margin-top: 4px; }
.tool-btn {
    padding: 10px 22px;
    background: var(--teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main, inherit);
    transition: background 0.2s, transform 0.15s;
}
.tool-btn:hover { background: #00b090; transform: translateY(-1px); }
.tool-reset {
    padding: 10px 18px;
    background: var(--light);
    color: var(--navy);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main, inherit);
    transition: background 0.2s;
}
.tool-reset:hover { background: var(--border); }

/* ---------------- Bottom description ---------------- */
.tool-bottom-desc {
    max-width: 100%;
    margin: 24px auto 0;
    font-size: 15px;
    line-height: 1.75;
    color: var(--text2);
}
.tool-bottom-desc h2 {
    font-size: 19px;
    font-weight: 700;
    color: var(--navy);
    margin: 26px 0 10px;
}
.tool-bottom-desc h2:first-child { margin-top: 0; }
.tool-bottom-desc h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--navy);
    margin: 20px 0 8px;
}
.tool-bottom-desc p { margin: 0 0 14px; }
.tool-bottom-desc ul, .tool-bottom-desc ol { margin: 0 0 14px; padding-left: 22px; }
.tool-bottom-desc li { margin-bottom: 6px; }
.tool-bottom-desc a { color: var(--teal); font-weight: 600; text-decoration: none; }
.tool-bottom-desc a:hover { text-decoration: underline; }
.tool-bottom-desc table { width: 100%; border-collapse: collapse; margin-bottom: 16px; font-size: 14px; }
.tool-bottom-desc th {
    background: var(--light);
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--navy);
    border: 1px solid var(--border);
}
.tool-bottom-desc td { padding: 8px 12px; border: 1px solid var(--border); color: var(--text2); }

/* ---------------- Text-tool specific shared patterns ---------------- */
.text-tool-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-main, inherit);
    color: var(--text);
    background: var(--white);
    outline: none;
    box-sizing: border-box;
    resize: vertical;
    line-height: 1.6;
}
.text-tool-textarea:focus { border-color: var(--teal); }
.text-tool-textarea-mono { font-family: 'Courier New', monospace; }

.text-tool-output {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-main, inherit);
    color: var(--text);
    background: var(--light);
    outline: none;
    box-sizing: border-box;
    resize: vertical;
    line-height: 1.6;
}

.text-tool-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    margin-top: 16px;
}
.text-tool-stat-cell { background: var(--white); padding: 14px 8px; text-align: center; }
.text-tool-stat-num { font-size: 22px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.text-tool-stat-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; margin-top: 4px; }

.text-tool-toolbar { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.text-tool-toolbar-btn {
    padding: 8px 14px;
    background: var(--light);
    color: var(--navy);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main, inherit);
    transition: background 0.2s, border-color 0.2s;
}
.text-tool-toolbar-btn:hover { background: var(--border); }
.text-tool-toolbar-btn.active { background: var(--teal); color: #fff; border-color: var(--teal); }

.text-tool-copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--navy);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main, inherit);
    transition: background 0.2s;
    margin-top: 10px;
}
.text-tool-copy-btn:hover { background: var(--navy2); }
.text-tool-copy-btn.copied { background: var(--teal); }

.text-tool-error-msg { font-size: 13px; color: #dc2626; margin: 8px 0 0; }

/* ---------------- Shared label row (label + action buttons) ---------------- */
.ct-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ct-label-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ct-label-row .text-tool-copy-btn { margin-top: 0; }

/* ---------------- Shared "View Full" trigger button ---------------- */
.ct-viewfull-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: var(--white);
    color: var(--navy);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main, inherit);
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
}
.ct-viewfull-btn:hover { background: var(--light); border-color: var(--teal); color: var(--teal); }

/* ---------------- Shared Full View Modal ---------------- */
.ct-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.ct-modal-overlay.open { display: flex; }
.ct-modal-box {
    background: var(--white);
    border-radius: 12px;
    width: 100%;
    max-width: 720px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 50px -12px rgba(0,0,0,0.35);
}
.ct-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    color: var(--navy);
    border-bottom: 1px solid var(--border);
}
.ct-modal-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ct-modal-copy-btn {
    padding: 6px 12px;
    background: var(--teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-main, inherit);
    transition: background 0.2s;
    white-space: nowrap;
}
.ct-modal-copy-btn:hover { background: #00b090; }
.ct-modal-close {
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: var(--muted);
    cursor: pointer;
    padding: 0 4px;
}
.ct-modal-close:hover { color: var(--navy); }
.ct-modal-body {
    padding: 18px;
    overflow-y: auto;
    font-size: 14px;
    line-height: 1.7;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
}

/* ---------------- FAQ Accordion ---------------- */
.tool-faq-section {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px 28px;
    margin-top: 20px;
}
.tool-faq-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--navy);
    margin: 0 0 16px;
}
.tool-faq-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tool-faq-item {
    border: 1px solid var(--border);
    border-radius: 10px;
    overflow: hidden;
}
.tool-faq-question {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    background: var(--light);
    border: none;
    text-align: left;
    font-size: 15px;
    font-weight: 600;
    color: var(--navy);
    cursor: pointer;
    font-family: var(--font-main, inherit);
    transition: background 0.2s;
}
.tool-faq-question:hover { background: var(--border); }
.tool-faq-icon {
    flex-shrink: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--teal);
    transition: transform 0.2s;
}
.tool-faq-item.open .tool-faq-icon { transform: rotate(45deg); }
.tool-faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
    background: var(--white);
}
.tool-faq-item.open .tool-faq-answer { max-height: 500px; }
.tool-faq-answer p {
    margin: 0;
    padding: 16px 18px;
    font-size: 14.5px;
    line-height: 1.7;
    color: var(--text2);
}

/* ---------------- Responsive ---------------- */
@media (max-width: 900px) {
    .tool-below-row { flex-direction: column; }
    .tool-below-row .tool-search-box { flex: 0 0 100%; width: 100%; }
    .tool-wrap { padding: 16px 16px 40px; }
    .tool-header-title { font-size: 20px; }
}
@media (max-width: 600px) {
    .text-tool-stats-grid { grid-template-columns: repeat(2, 1fr); }
    .tool-box { padding: 16px; }
    .tool-faq-section { padding: 16px; }
}


/* ---------------- Floating Search Icon (additive, fixed to viewport edge) ---------------- */
.floating-search-wrap {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 900;
    display: flex;
    align-items: center;
}
.floating-search-btn {
    width: 48px;
    height: 48px;
    background: var(--white);
    border: 1px solid var(--border);
    border-right: none;
    border-radius: 10px 0 0 10px;
    box-shadow: -2px 2px 10px rgba(0,0,0,0.12);
    color: var(--teal);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.floating-search-btn:hover { background: var(--light); }
.floating-search-wrap.open .floating-search-btn {
    color: var(--navy);
    background: var(--light);
}
.floating-search-panel {
    position: absolute;
    right: 48px;
    top: 50%;
    transform: translateY(-50%) translateX(12px);
    width: 320px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: -4px 4px 24px rgba(0,0,0,0.15);
    padding: 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, transform 0.2s;
    overflow: visible;
}
.floating-search-wrap.open .floating-search-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}
.floating-search-panel .tool-search-label {
    padding: 12px 16px;
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
    background: linear-gradient(135deg, var(--navy) 0%, var(--navy2) 100%);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 10px 10px 0 0;
}
.floating-search-panel .tool-search-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    padding: 16px;
}
.floating-search-panel .tool-search-results {
    position: static;
    display: none;
    border: none;
    border-top: 1px solid var(--border);
    border-radius: 0 0 10px 10px;
    box-shadow: none;
    max-height: 240px;
}
.floating-search-panel .tool-search-results.open { display: block; }

@media (max-width: 600px) {
    .floating-search-panel { width: 260px; }
}