/**
 * html-to-pdf.css
 * HTML to PDF Tool — Prefix: hp-  Accent: #8B5CF6  RGB: 139, 92, 246
 */

/* ============================================================
   ACCENT OVERRIDE
   ============================================================ */
.hp-section {
    --tool-accent: #8B5CF6;
    --tool-accent-rgb: 139, 92, 246;
}

/* ============================================================
   MODE TABS
   ============================================================ */
.hp-mode-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: #F1F5F9;
    border-radius: 12px;
    width: fit-content;
    margin: 20px 20px 0;
}

.hp-mode-tab {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    border: none;
    background: transparent;
    border-radius: 9px;
    cursor: pointer;
    color: var(--text-secondary, #64748b);
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
    white-space: nowrap;
}

.hp-mode-tab:hover {
    color: var(--text-primary, #0f172a);
}

.hp-mode-tab.hp-mode-tab--active {
    background: #FFFFFF;
    color: var(--tool-accent);
    box-shadow: 0 1px 5px rgba(0, 0, 0, 0.1);
}

.hp-mode-tab i {
    font-size: 0.9375rem;
    flex-shrink: 0;
}

/* ============================================================
   MODE PANELS
   ============================================================ */
.hp-mode-panel {
    padding: 16px 20px 4px;
}

/* ============================================================
   CODE EDITOR
   ============================================================ */
.hp-code-editor {
    width: 100%;
    min-height: 260px;
    font-family: var(--tool-font-mono, 'Fira Code', 'Cascadia Code', 'Consolas', monospace);
    font-size: 0.8125rem;
    line-height: 1.65;
    color: #1e293b;
    background: #f8fafc;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 10px;
    padding: 14px 16px;
    resize: vertical;
    outline: none;
    transition: border-color 0.18s, box-shadow 0.18s;
    box-sizing: border-box;
    tab-size: 2;
}

.hp-code-editor:focus {
    border-color: rgba(var(--tool-accent-rgb), 0.45);
    box-shadow: 0 0 0 3px rgba(var(--tool-accent-rgb), 0.1);
}

.hp-code-editor::placeholder {
    color: #94a3b8;
}

/* ============================================================
   FETCH BAR
   ============================================================ */
.hp-fetch-bar {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.hp-fetch-input-wrap {
    position: relative;
    flex: 1;
}

.hp-fetch-url-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 1rem;
    pointer-events: none;
}

.hp-fetch-url-input {
    padding-left: 36px !important;
    width: 100%;
    box-sizing: border-box;
}

.hp-fetch-btn {
    background: rgba(var(--tool-accent-rgb), 0.07);
    color: var(--tool-accent);
    border-color: rgba(var(--tool-accent-rgb), 0.28);
    flex-shrink: 0;
}

.hp-fetch-btn:hover:not(:disabled) {
    background: rgba(var(--tool-accent-rgb), 0.13);
    border-color: rgba(var(--tool-accent-rgb), 0.45);
}

.hp-fetch-hint {
    font-size: 0.8rem;
    color: #94a3b8;
    margin: 8px 0 0;
    line-height: 1.5;
}

/* ============================================================
   OPTIONS BAR
   ============================================================ */
.hp-options-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 20px;
    align-items: center;
    padding: 12px 20px;
    background: #F8FAFC;
    border-top: 1px solid rgba(100, 116, 139, 0.1);
    border-bottom: 1px solid rgba(100, 116, 139, 0.1);
    margin-top: 16px;
}

.hp-custom-dims {
    display: flex;
    align-items: center;
    gap: 6px;
}

.hp-dim-input {
    width: 76px;
    text-align: center;
}

.hp-dim-sep {
    color: #94a3b8;
    font-size: 0.9rem;
    font-weight: 500;
}

.hp-dim-unit {
    font-size: 0.8125rem;
    color: #94a3b8;
    font-weight: 500;
}

.hp-margin-input {
    width: 68px;
    text-align: center;
}

/* ============================================================
   PREVIEW AREA
   ============================================================ */
.hp-preview-wrap {
    margin: 0 20px 0;
    border: 1px solid rgba(100, 116, 139, 0.18);
    border-radius: 10px;
    overflow: hidden;
    margin-top: 16px;
}

.hp-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 9px 14px;
    background: #F1F5F9;
    border-bottom: 1px solid rgba(100, 116, 139, 0.14);
}

.hp-preview-bar-label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary, #64748b);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.hp-preview-bar-hint {
    font-size: 0.75rem;
    color: #94a3b8;
}

.hp-preview-iframe-wrap {
    height: 360px;
    overflow: auto;
    background: #ffffff;
}

.hp-preview-iframe {
    width: 100%;
    height: 100%;
    border: none;
    display: block;
}

/* ============================================================
   BOTTOM BAR (filename + actions)
   ============================================================ */
.hp-bottom-bar {
    padding: 16px 20px 0;
}

.hp-filename-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
}

.hp-filename-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text-secondary, #64748b);
    white-space: nowrap;
}

.hp-filename-input {
    flex: 1;
    max-width: 280px;
}

/* ============================================================
   ACTION BAR
   ============================================================ */
.hp-action-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding-bottom: 20px;
    border-top: 1px solid rgba(100, 116, 139, 0.1);
    padding-top: 14px;
    margin-top: 0;
}

.hp-actions-right {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
.hp-progress-wrap {
    padding: 0 20px 4px;
}

.hp-progress-bar {
    height: 4px;
    background: rgba(var(--tool-accent-rgb), 0.12);
    border-radius: 2px;
    overflow: hidden;
}

.hp-progress-fill {
    height: 100%;
    background: var(--tool-accent);
    border-radius: 2px;
    transition: width 0.3s ease;
    width: 0%;
}

/* status inside card gets some breathing room */
.hp-section .tool-status {
    margin: 0 20px 20px;
}

/* ============================================================
   EDITOR ACTIONS (below code textarea)
   ============================================================ */
.hp-editor-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* ============================================================
   UTILITY
   ============================================================ */
.hp-hidden {
    display: none !important;
}

/* Spinner animation (for icons during async operations) */
.hp-spin {
    animation: hp-rotate 0.65s linear infinite;
    display: inline-block;
}

@keyframes hp-rotate {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 640px) {
    .hp-mode-tabs {
        margin: 16px 14px 0;
        width: auto;
    }

    .hp-mode-panel {
        padding: 12px 14px 4px;
    }

    .hp-options-bar {
        gap: 10px 14px;
        padding: 12px 14px;
    }

    .hp-custom-dims {
        flex-wrap: wrap;
    }

    .hp-fetch-bar {
        flex-direction: column;
    }

    .hp-fetch-btn {
        width: 100%;
        justify-content: center;
    }

    .hp-preview-wrap {
        margin: 16px 14px 0;
    }

    .hp-preview-iframe-wrap {
        height: 280px;
    }

    .hp-bottom-bar {
        padding: 14px 14px 0;
    }

    .hp-action-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .hp-actions-right {
        margin-left: 0;
        width: 100%;
    }

    .hp-actions-right .tool-btn {
        flex: 1;
        justify-content: center;
    }

    .hp-filename-input {
        max-width: 100%;
    }

    .hp-section .tool-status {
        margin: 0 14px 16px;
    }

    .hp-progress-wrap {
        padding: 0 14px 4px;
    }
}