/* Perl Formatter – mobile-first, unique layout */

/* --- Tool interface: perl-fmt (unique to this tool) --- */
.perl-fmt {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 2rem;
}

.perl-fmt-wrap {
    background: var(--bs-body-bg, #fff);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.04);
}

.perl-fmt-wrap + .perl-fmt-divider + .perl-fmt-wrap {
    margin-top: 0;
}

.perl-fmt-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 16px;
    padding: 12px 16px;
    min-height: 52px;
    background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.perl-fmt-bar-label {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #334155;
}

.perl-fmt-bar-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.perl-fmt-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 14px;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: 10px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}

.perl-fmt-btn:active {
    transform: scale(0.98);
}

.perl-fmt-btn-primary {
    background: #0d9488;
    color: #fff;
    border-color: #0d9488;
}

.perl-fmt-btn-primary:hover {
    background: #0f766e;
    border-color: #0f766e;
    color: #fff;
}

.perl-fmt-btn-accent {
    background: #0e7490;
    color: #fff;
    border-color: #0e7490;
}

.perl-fmt-btn-accent:hover {
    background: #155e75;
    border-color: #155e75;
    color: #fff;
}

.perl-fmt-btn-ghost {
    background: transparent;
    color: #475569;
    border-color: #cbd5e1;
}

.perl-fmt-btn-ghost:hover {
    background: #f1f5f9;
    color: #0f172a;
    border-color: #94a3b8;
}

.perl-fmt-editor-wrap {
    position: relative;
    min-height: 280px;
    height: 380px;
}

.perl-fmt-editor {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
}

/* Divider between input and output (mobile: visual break) */
.perl-fmt-divider {
    flex: 0 0 auto;
    height: 1px;
    margin: 12px 0;
    background: linear-gradient(90deg, transparent, #cbd5e1, transparent);
}

/* Tablet and up: two columns, taller editors */
@media (min-width: 768px) {
    .perl-fmt {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-rows: 1fr;
        gap: 0 20px;
        align-items: stretch;
        min-height: 420px;
    }

    .perl-fmt-wrap {
        display: flex;
        flex-direction: column;
        min-height: 420px;
    }

    .perl-fmt-divider {
        display: none;
    }

    .perl-fmt-editor-wrap {
        flex: 1;
        min-height: 420px;
        height: auto;
    }
}

@media (min-width: 992px) {
    .perl-fmt-editor-wrap {
        min-height: 480px;
    }

    .perl-fmt-bar {
        padding: 14px 20px;
    }
}
