/* ============================================================
   HTML to PDF / Markdown Converter - style.css  (htp- prefix)
   Load AFTER custom_styles.css
   ============================================================ */

.tool-description { max-width: 800px; }

/* ---- Mode Switcher ---------------------------------------- */
.htp-mode-switcher {
    display: flex;
    gap: 4px;
    background: var(--card-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 4px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.htp-mode-btn {
    flex: 1;
    min-width: 110px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 9px 10px;
    border: none;
    border-radius: calc(var(--radius-lg) - 4px);
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}
.htp-mode-btn:hover { color: #3399cc; }
.htp-mode-btn.htp-active {
    background: var(--card-bg);
    color: #3399cc;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
}
.htp-mode-btn svg { flex-shrink: 0; }

/* ---- Mode Panels ------------------------------------------ */
.htp-mode-panel { display: none; }
.htp-mode-panel.htp-active { display: block; }

/* ---- URL Input -------------------------------------------- */
.htp-url-input-wrap {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    align-items: stretch;
}
.htp-url-input {
    flex: 1;
    padding: 11px 14px;
    background: var(--input-bg);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.9rem;
    transition: border-color 0.15s;
    min-width: 0;
}
.htp-url-input:focus { outline: none; border-color: #3399cc; }
.htp-url-input::placeholder { color: var(--text-muted); }

/* ---- Upload Zone ----------------------------------------- */
.htp-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    background: var(--card-bg);
    padding: 36px 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 14px;
    position: relative;
}
.htp-upload-zone:hover,
.htp-upload-zone.htp-dragover {
    border-color: #3399cc;
    background: rgba(51, 153, 204, 0.05);
}
.htp-upload-zone .htp-upload-icon {
    color: #3399cc;
    display: block;
    margin: 0 auto 12px;
    width: 44px; height: 44px;
}
.htp-upload-zone h3 {
    margin: 0 0 5px;
    font-size: 1rem;
    color: var(--text-primary);
    font-weight: 600;
}
.htp-upload-zone p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.htp-upload-zone input[type="file"] {
    position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.htp-browse-btn {
    display: inline-block;
    margin-top: 12px;
    padding: 7px 18px;
    background: #3399cc;
    color: #fff;
    border-radius: var(--radius-full);
    font-size: 0.82rem;
    font-weight: 600;
    pointer-events: none;
}

/* ---- File List ------------------------------------------- */
.htp-file-list { margin-bottom: 14px; display: none; }
.htp-file-list.htp-visible { display: block; }
.htp-file-list-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 6px;
    font-size: 0.82rem; font-weight: 600; color: var(--text-secondary);
}
.htp-file-list-header button {
    background: none; border: none; color: var(--text-muted); cursor: pointer;
    font-size: 0.78rem; padding: 2px 6px; border-radius: 4px; transition: color 0.15s;
}
.htp-file-list-header button:hover { color: var(--error-color); }
.htp-file-item {
    display: flex; align-items: center; gap: 9px;
    padding: 8px 11px;
    background: var(--card-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    margin-bottom: 5px; font-size: 0.85rem;
}
.htp-file-item-icon { color: #3399cc; flex-shrink: 0; }
.htp-file-item-name { flex: 1; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; min-width: 0; }
.htp-file-item-size { color: var(--text-muted); font-size: 0.78rem; flex-shrink: 0; }
.htp-file-item-remove { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 2px; line-height: 0; border-radius: 4px; transition: color 0.15s; flex-shrink: 0; }
.htp-file-item-remove:hover { color: var(--error-color); }

/* ---- Options Panel --------------------------------------- */
.htp-options-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    margin-bottom: 14px;
}
.htp-options-panel h3 {
    margin: 0 0 14px;
    font-size: 0.9rem; font-weight: 700; color: var(--text-primary);
    display: flex; align-items: center; gap: 8px;
}
.htp-options-panel h3 svg { color: #3399cc; }

.htp-format-tabs {
    display: flex; gap: 7px; margin-bottom: 14px; flex-wrap: wrap;
}
.htp-format-tab {
    display: flex; align-items: center; gap: 5px;
    padding: 7px 14px;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    background: var(--card-secondary);
    color: var(--text-secondary);
    cursor: pointer; font-size: 0.83rem; font-weight: 500;
    transition: all 0.15s; user-select: none;
}
.htp-format-tab:hover { border-color: #3399cc; color: #3399cc; }
.htp-format-tab.htp-active {
    border-color: #3399cc;
    background: rgba(51,153,204,0.1);
    color: #3399cc; font-weight: 700;
}

/* PDF sub-options */
.htp-pdf-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 12px;
    padding-top: 14px;
    border-top: 1px solid var(--border-light);
}
.htp-pdf-options.htp-hidden { display: none; }

/* Header/footer advanced toggle */
.htp-advanced-toggle {
    display: flex; align-items: center; gap: 6px;
    background: none; border: none; cursor: pointer;
    color: var(--text-muted); font-size: 0.8rem; padding: 8px 0 0;
    transition: color 0.15s; margin-top: 4px;
}
.htp-advanced-toggle:hover { color: #3399cc; }
.htp-advanced-panel {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid var(--border-light);
    margin-top: 12px;
}
.htp-advanced-panel.htp-open { display: grid; }

.htp-field-group { display: flex; flex-direction: column; gap: 5px; }
.htp-field-group label {
    font-size: 0.75rem; font-weight: 700; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.04em;
}
.htp-field-group select,
.htp-field-group input[type="number"],
.htp-field-group input[type="text"] {
    padding: 7px 10px;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.875rem; width: 100%; box-sizing: border-box;
    transition: border-color 0.15s;
    -webkit-appearance: none; appearance: none;
}
.htp-field-group select:focus,
.htp-field-group input:focus { outline: none; border-color: #3399cc; }
.htp-field-group select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 28px; }

/* ---- Primary Button -------------------------------------- */
.htp-convert-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px;
    width: 100%; padding: 13px 24px;
    background: #3399cc; color: #fff;
    border: none; border-radius: var(--radius-full);
    font-size: 0.95rem; font-weight: 700; cursor: pointer;
    transition: background 0.2s, transform 0.1s; margin-bottom: 16px;
}
.htp-convert-btn:hover:not(:disabled) { background: #2277aa; transform: translateY(-1px); }
.htp-convert-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* ---- Progress -------------------------------------------- */
.htp-progress-section {
    display: none; text-align: center; padding: 28px 16px;
    background: var(--card-bg); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); margin-bottom: 16px;
}
.htp-progress-section.htp-visible { display: block; }
.htp-progress-label { font-size: 0.88rem; color: var(--text-secondary); margin: 0 0 10px; font-weight: 500; }
.htp-progress-bar-wrap { background: var(--border-light); border-radius: var(--radius-full); height: 7px; overflow: hidden; margin: 0 auto; max-width: 380px; }
.htp-progress-bar-fill { height: 100%; background: #3399cc; border-radius: var(--radius-full); width: 0%; transition: width 0.4s ease; }
.htp-progress-status { font-size: 0.78rem; color: var(--text-muted); margin: 7px 0 0; }

/* ---- Results --------------------------------------------- */
.htp-results-section { display: none; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 16px; }
.htp-results-section.htp-visible { display: block; }
.htp-results-header { display: flex; align-items: center; gap: 10px; padding: 14px 18px; background: var(--success-bg); border-bottom: 1px solid var(--border-color); }
.htp-results-header svg { color: var(--success-color); }
.htp-results-header span { font-weight: 600; color: var(--text-primary); font-size: 0.9rem; }
.htp-results-body { padding: 18px; }
.htp-result-item { display: flex; align-items: center; gap: 12px; padding: 12px; background: var(--card-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); margin-bottom: 8px; }
.htp-result-item:last-of-type { margin-bottom: 0; }
.htp-result-icon { color: #3399cc; flex-shrink: 0; }
.htp-result-info { flex: 1; min-width: 0; }
.htp-result-name { font-weight: 600; color: var(--text-primary); font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.htp-result-meta { font-size: 0.77rem; color: var(--text-muted); margin-top: 2px; }
.htp-savings-badge { display: inline-block; background: var(--success-bg); color: var(--success-color); font-size: 0.72rem; font-weight: 700; padding: 1px 7px; border-radius: var(--radius-full); margin-left: 6px; }
.htp-download-btn { display: flex; align-items: center; gap: 6px; padding: 7px 14px; background: #3399cc; color: #fff; border: none; border-radius: var(--radius-full); font-size: 0.82rem; font-weight: 600; cursor: pointer; text-decoration: none; transition: background 0.15s; flex-shrink: 0; white-space: nowrap; }
.htp-download-btn:hover { background: #2277aa; color: #fff; }
.htp-convert-another { display: flex; align-items: center; gap: 6px; background: none; border: 1px solid var(--border-color); border-radius: var(--radius-full); padding: 7px 14px; color: var(--text-secondary); font-size: 0.82rem; cursor: pointer; margin-top: 12px; transition: border-color 0.15s, color 0.15s; }
.htp-convert-another:hover { border-color: #3399cc; color: #3399cc; }

/* ---- Error / Notice -------------------------------------- */
.htp-error-msg { display: none; background: var(--error-bg); border: 1px solid var(--error-color); border-radius: var(--radius-md); padding: 11px 14px; color: var(--error-color); font-size: 0.86rem; margin-bottom: 14px; gap: 9px; align-items: flex-start; }
.htp-error-msg.htp-visible { display: flex; }
.htp-error-msg svg { flex-shrink: 0; margin-top: 1px; }
.htp-error-msg-text { flex: 1; }
.htp-error-msg a { color: inherit; font-weight: 600; text-decoration: underline; }
.htp-notice { display: none; background: var(--info-bg); border: 1px solid var(--info-color); border-radius: var(--radius-md); padding: 10px 14px; font-size: 0.82rem; color: var(--info-color); gap: 7px; align-items: flex-start; margin-bottom: 14px; }
.htp-notice.htp-visible { display: flex; }
.htp-notice svg { flex-shrink: 0; }

/* ---- Minify info ----------------------------------------- */
.htp-minify-info { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 10px; }

/* ---- Related Tools --------------------------------------- */
.htp-related-tools { padding: 0 0 8px; }
.htp-related-tools-box { max-width: 900px; margin: 0 auto; padding: 14px 16px; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.htp-related-label { display: flex; align-items: center; gap: 5px; font-size: 0.8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; white-space: nowrap; }
.htp-related-links { display: flex; flex-wrap: wrap; gap: 5px; }
.htp-related-link { display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-full); color: var(--text-secondary); font-size: 0.8rem; font-weight: 500; text-decoration: none; transition: border-color 0.15s, color 0.15s; }
.htp-related-link:hover { border-color: #3399cc; color: #3399cc; }

/* ---- Info Sections --------------------------------------- */
.htp-info-sections { max-width: 900px; margin: 0 auto; padding: 0 16px 40px; display: flex; flex-direction: column; gap: 18px; }
.htp-info-card { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: var(--radius-lg); padding: 22px; }
.htp-info-card h2 { display: flex; align-items: center; gap: 9px; font-size: 1.05rem; font-weight: 700; color: var(--text-primary); margin: 0 0 14px; }
.htp-info-card h2 svg { color: #3399cc; flex-shrink: 0; }
.htp-info-card p { color: var(--text-secondary); line-height: 1.65; margin: 0 0 10px; }
.htp-info-card p:last-child { margin-bottom: 0; }
.htp-info-card a { color: var(--link-color); text-decoration: none; font-weight: 500; }
.htp-info-card a:hover { text-decoration: underline; }
.htp-steps-list { padding-left: 20px; margin: 0 0 10px; color: var(--text-secondary); line-height: 1.65; }
.htp-steps-list li { margin-bottom: 7px; }
.htp-steps-list strong { color: var(--text-primary); }
.htp-format-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 12px; margin: 14px 0; }
.htp-format-item { padding: 13px; background: var(--card-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.htp-format-item svg { color: #3399cc; margin-bottom: 7px; }
.htp-format-item h4 { margin: 0 0 4px; font-size: 0.88rem; font-weight: 700; color: var(--text-primary); }
.htp-format-item p { margin: 0; font-size: 0.81rem; }
.htp-features-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px,1fr)); gap: 12px; margin-top: 4px; }
.htp-feature-item { padding: 13px; background: var(--card-secondary); border: 1px solid var(--border-color); border-radius: var(--radius-md); }
.htp-feature-item svg { color: #3399cc; margin-bottom: 7px; }
.htp-feature-item h4 { margin: 0 0 3px; font-size: 0.86rem; font-weight: 700; color: var(--text-primary); }
.htp-feature-item p { margin: 0; font-size: 0.8rem; color: var(--text-muted); }

/* FAQ */
.htp-faq-list { margin-top: 4px; }
.htp-faq-item { border-bottom: 1px solid var(--border-light); }
.htp-faq-item:last-child { border-bottom: none; }
.htp-faq-question { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 0; background: none; border: none; cursor: pointer; text-align: left; font-size: 0.88rem; font-weight: 600; color: var(--text-primary); transition: color 0.15s; }
.htp-faq-question:hover { color: #3399cc; }
.htp-faq-question svg { color: var(--text-muted); flex-shrink: 0; transition: transform 0.2s; }
.htp-faq-item.active .htp-faq-question svg { transform: rotate(180deg); }
.htp-faq-answer { display: none; padding: 0 0 12px; font-size: 0.86rem; color: var(--text-secondary); line-height: 1.65; }
.htp-faq-answer a { color: var(--link-color); font-weight: 500; }
.htp-faq-answer a:hover { text-decoration: underline; }
.htp-faq-item.active .htp-faq-answer { display: block; }

/* ---- Responsive ----------------------------------------- */
@media (max-width:640px) {
    .htp-mode-btn { font-size: 0.78rem; padding: 8px 6px; min-width: 80px; }
    .htp-pdf-options { grid-template-columns: 1fr 1fr; }
    .htp-advanced-panel { grid-template-columns: 1fr; }
    .htp-result-item { flex-wrap: wrap; }
    .htp-download-btn { width: 100%; justify-content: center; }
}
