/* ============================================================
   TXT to PDF — txt-to-pdf.css
   Prefix: ttp-   Accent: #8B5CF6 (violet)
   ============================================================ */

.ttp-section {
    --tool-accent: #8B5CF6;
    --tool-accent-rgb: 139, 92, 246;
    padding: 40px 0 80px;
}

.ttp-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 18px;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.22);
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #8B5CF6;
    margin-bottom: 12px;
}

/* Main panel */
.ttp-main-panel {
    background: #FFFFFF;
    border: 1px solid rgba(100, 116, 139, 0.14);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Input area */
.ttp-input-area {
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

/* Drag & drop overlay */
.ttp-drop-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: rgba(139, 92, 246, 0.06);
    border: 2px dashed #8B5CF6;
    border-radius: 10px;
    color: #8B5CF6;
    font-size: 1rem;
    font-weight: 600;
    pointer-events: none;
}

.ttp-drop-overlay[hidden] {
    display: none;
}

.ttp-drop-icon {
    font-size: 2rem;
}

.ttp-input-area--drag .ttp-textarea {
    opacity: 0.3;
}

/* Counts row */
.ttp-counts-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.ttp-count-item {
    font-size: 0.75rem;
    color: var(--text-tertiary, #9CA3AF);
}

.ttp-count-sep {
    font-size: 0.75rem;
    color: var(--text-tertiary, #9CA3AF);
    opacity: 0.5;
}

.ttp-input-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
}

.ttp-input-label {
    font-size: 0.78125rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ttp-input-actions {
    display: flex;
    gap: 8px;
}

.ttp-ghost-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 11px;
    border: 1px solid rgba(100, 116, 139, 0.25);
    border-radius: 6px;
    background: #F8FAFC;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
    text-decoration: none;
}

.ttp-ghost-btn:hover {
    border-color: #8B5CF6;
    color: #8B5CF6;
}

.ttp-textarea {
    width: 100%;
    box-sizing: border-box;
    min-height: 280px;
    padding: 14px;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 10px;
    background: #FFFFFF;
    color: var(--text-primary);
    font-size: 0.875rem;
    line-height: 1.6;
    font-family: 'Courier New', Courier, monospace;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s;
}

.ttp-textarea:focus {
    border-color: #8B5CF6;
    outline: none;
}

/* Options grid */
.ttp-options-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px 14px;
    padding: 14px 18px;
    background: #F8FAFC;
    border: 1px solid rgba(100, 116, 139, 0.14);
    border-radius: 12px;
}

.ttp-field {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.ttp-label {
    font-size: 0.78125rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ttp-select {
    padding: 8px 30px 8px 12px;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 8px;
    background: #FFFFFF;
    color: var(--text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    outline: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath fill='%236B7280' d='M12 15.5l-6-6h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    transition: border-color 0.15s;
}

.ttp-select:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Advanced accordion */
.ttp-advanced {
    border: 1px solid rgba(100, 116, 139, 0.14);
    border-radius: 12px;
    overflow: hidden;
}

.ttp-advanced-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 13px 18px;
    background: #F8FAFC;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    user-select: none;
    transition: background 0.15s;
}

.ttp-advanced-toggle::-webkit-details-marker {
    display: none;
}

.ttp-advanced-toggle:hover {
    background: rgba(139, 92, 246, 0.05);
}

.ttp-advanced[open] .ttp-advanced-toggle {
    border-bottom: 1px solid rgba(100, 116, 139, 0.14);
}

.ttp-caret {
    margin-left: auto;
    transition: transform 0.2s;
}

.ttp-advanced[open] .ttp-caret {
    transform: rotate(180deg);
}

.ttp-advanced-body {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    background: #FFFFFF;
}

.ttp-adv-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ttp-adv-group-label {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.ttp-adv-hint {
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--text-tertiary, #9CA3AF);
    text-transform: none;
    letter-spacing: 0;
}

.ttp-adv-hint code {
    background: rgba(139, 92, 246, 0.1);
    color: #8B5CF6;
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.75rem;
}

.ttp-adv-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
}

.ttp-field--grow {
    flex: 1;
    min-width: 180px;
}

.ttp-text-input {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 12px;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 8px;
    background: #FFFFFF;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
    transition: border-color 0.15s;
}

.ttp-text-input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

/* Password input wrapper */
.ttp-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.ttp-password-wrap .ttp-text-input {
    padding-right: 40px;
}

.ttp-pwd-toggle {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1rem;
    line-height: 1;
    transition: color 0.15s;
}

.ttp-pwd-toggle:hover {
    color: #8B5CF6;
}

/* Alignment button group */
.ttp-align-group {
    display: inline-flex;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 8px;
    overflow: hidden;
    background: #FFFFFF;
}

.ttp-align-btn {
    flex: 1;
    padding: 7px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    line-height: 1;
}

.ttp-align-btn+.ttp-align-btn {
    border-left: 1px solid rgba(100, 116, 139, 0.22);
}

.ttp-align-btn:hover {
    background: rgba(139, 92, 246, 0.07);
    color: #8B5CF6;
}

.ttp-align-btn--active {
    background: #8B5CF6;
    color: #fff;
}

.ttp-align-btn--active:hover {
    background: #7C3AED;
    color: #fff;
}

/* Orientation toggle */
.ttp-orient-toggle {
    display: inline-flex;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 8px;
    overflow: hidden;
    background: #FFFFFF;
}

.ttp-orient-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 10px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s, color 0.15s;
}

.ttp-orient-btn+.ttp-orient-btn {
    border-left: 1px solid rgba(100, 116, 139, 0.22);
}

.ttp-orient-btn:hover {
    background: rgba(139, 92, 246, 0.07);
    color: #8B5CF6;
}

.ttp-orient-btn--active {
    background: #8B5CF6;
    color: #fff;
}

.ttp-orient-btn--active:hover {
    background: #7C3AED;
    color: #fff;
}

/* Color picker */
.ttp-color-wrap {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 10px;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 8px;
    background: #FFFFFF;
    cursor: pointer;
    transition: border-color 0.15s;
}

.ttp-color-wrap:focus-within {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ttp-color-input {
    width: 24px;
    height: 24px;
    border: none;
    padding: 0;
    background: none;
    cursor: pointer;
    border-radius: 4px;
    overflow: hidden;
}

.ttp-color-input::-webkit-color-swatch-wrapper {
    padding: 0;
}

.ttp-color-input::-webkit-color-swatch {
    border: none;
    border-radius: 4px;
}

.ttp-color-input::-moz-color-swatch {
    border: none;
    border-radius: 4px;
}

.ttp-color-hex {
    font-size: 0.8125rem;
    font-family: 'Courier New', monospace;
    color: var(--text-secondary);
    user-select: none;
}

/* Progress */
.ttp-progress-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ttp-progress-wrap[hidden] {
    display: none;
}

.ttp-progress-bar {
    flex: 1;
    height: 6px;
    background: rgba(100, 116, 139, 0.14);
    border-radius: 3px;
    overflow: hidden;
}

.ttp-progress-fill {
    height: 100%;
    width: 0;
    background: #8B5CF6;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.ttp-progress-text {
    font-size: 0.8125rem;
    color: var(--text-secondary);
    white-space: nowrap;
    min-width: 160px;
}

.ttp-status {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
}

.ttp-status[hidden] {
    display: none;
}

.ttp-status--success {
    background: rgba(22, 163, 74, 0.08);
    border: 1px solid rgba(22, 163, 74, 0.25);
    color: #15803D;
}

.ttp-status--error {
    background: rgba(220, 38, 38, 0.08);
    border: 1px solid rgba(220, 38, 38, 0.25);
    color: #B91C1C;
}

.ttp-status--info {
    background: rgba(139, 92, 246, 0.06);
    border: 1px solid rgba(139, 92, 246, 0.2);
    color: #7C3AED;
}

/* Action bar */
.ttp-action-bar {
    display: flex;
    align-items: flex-end;
    gap: 16px;
    flex-wrap: wrap;
    padding: 14px 18px;
    background: #F8FAFC;
    border: 1px solid rgba(100, 116, 139, 0.14);
    border-radius: 12px;
}

.ttp-output-wrap {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1;
    min-width: 200px;
}

.ttp-output-label {
    font-size: 0.78125rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.ttp-output-input {
    padding: 8px 12px;
    border: 1px solid rgba(100, 116, 139, 0.22);
    border-radius: 8px;
    background: #FFFFFF;
    color: var(--text-primary);
    font-size: 0.875rem;
    outline: none;
}

.ttp-output-input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.1);
}

.ttp-btn-apply {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    background: #8B5CF6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.ttp-btn-apply:hover {
    background: #7C3AED;
}

.ttp-btn-apply:disabled {
    background: var(--text-tertiary, #9CA3AF);
    cursor: not-allowed;
}

@media (max-width: 600px) {
    .ttp-section {
        padding: 24px 0 60px;
    }

    .ttp-options-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

    .ttp-btn-apply {
        justify-content: center;
    }
}