/* ═══════════════════════════════════════════════════
   Admin Integrations — Mobile Optimization
   ═══════════════════════════════════════════════════ */

/* ─── Tablet (≤1024px) ───────────────────────────── */
@media (max-width: 1024px) {
    /* Agent-Tools Filter full width */
    #at-agent-filter { max-width: 100% !important; width: 100% !important; }
    .flex.justify-between:has(#at-agent-filter) {
        flex-direction: column; gap: 8px;
    }
}

/* ─── Mobile (≤768px) ────────────────────────────── */
@media (max-width: 768px) {
    /* Integration card actions: better touch targets */
    .int-card-actions {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr);
        gap: 6px !important;
        width: 100%;
    }
    .int-card-actions .btn-sm {
        min-height: 40px;
        padding: 8px 6px;
        font-size: 13px;
        justify-content: center;
        width: 100%;
    }
    /* Int card row better spacing */
    .int-card-row {
        gap: 14px !important;
    }

    /* Payment cards: better mobile spacing */
    #int-tab-content .card[style*="border-left:3px solid #635BFF"],
    #int-tab-content .card[style*="border-left:3px solid #00B67A"] {
        margin-bottom: 4px;
    }
    #int-tab-content .card .card-body .form-label {
        font-size: 13px;
    }
    #int-tab-content .card .card-body .form-input {
        padding: 10px 12px;
    }
    /* Webhook/IPN URL Box mobil */
    #int-tab-content .card .card-body code {
        font-size: 11px !important;
        word-break: break-all;
        line-height: 1.4;
    }

    /* Catalog cards: tighter mobile layout */
    #int-tab-content .grid-2 .card .card-body {
        padding: 12px 14px;
    }
    #int-tab-content .grid-2 .card .flex.gap-2 {
        gap: 6px;
    }

    /* Agent-Tools filter */
    #at-agent-filter {
        width: 100% !important;
        max-width: 100% !important;
    }

    /* Product Mappings: hide low-priority columns */
    #int-tab-content .table-wrap table th:nth-child(4),
    #int-tab-content .table-wrap table td:nth-child(4) {
        display: none;
    }
    /* Tighter table cells */
    #int-tab-content .table-wrap table th,
    #int-tab-content .table-wrap table td {
        padding: 10px 10px;
        font-size: 13px;
    }
    #int-tab-content .table-wrap table {
        min-width: 400px;
    }

    /* Info card at bottom */
    #int-tab-content > .card[style*="border-left:3px solid var(--primary)"] .text-sm {
        font-size: 12px;
        line-height: 1.5;
    }

    /* Page title smaller on mobile */
    #int-tab-content + .page-title,
    .page-title:has(+ #int-tabs) {
        font-size: 18px;
    }

    /* Badges wrap nicely */
    .int-card-info .flex.gap-2 {
        gap: 4px;
    }
    .int-card-info .badge {
        font-size: 11px;
        padding: 2px 7px;
    }

    /* Catalog activate form mobile */
    .cat-inline-form .flex.gap-2 {
        flex-direction: column;
    }
    .cat-inline-form .btn {
        width: 100%;
    }

    /* Active integration inline edit form */
    .int-inline-form .flex.gap-2 {
        flex-direction: column;
    }
    .int-inline-form .btn {
        width: 100%;
    }

    /* Modal on integrations page */
    #int-tab-content .modal {
        max-width: 100%;
    }
}

/* ─── Small Mobile (≤480px) ──────────────────────── */
@media (max-width: 480px) {
    /* Action buttons 2x2 grid */
    .int-card-actions {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
    }
    .int-card-actions .btn-sm {
        min-height: 42px;
        font-size: 12px;
    }

    /* Payment card buttons stack */
    #int-tab-content .card .flex.gap-2:has(.btn-primary) {
        flex-direction: column;
    }
    #int-tab-content .card .flex.gap-2:has(.btn-primary) .btn {
        width: 100%;
        justify-content: center;
    }

    /* Table even tighter */
    #int-tab-content .table-wrap table {
        min-width: 320px;
    }
    #int-tab-content .table-wrap table th:nth-child(3),
    #int-tab-content .table-wrap table td:nth-child(3) {
        display: none;
    }

    /* KPI grid for tools tab already 1col via app.css */

    /* Badges smaller */
    .int-card-info .badge {
        font-size: 10px;
        padding: 2px 6px;
    }

    /* Provider logos smaller */
    #int-tab-content .card .flex span[style*="font-size:28px"] {
        font-size: 22px !important;
    }
    #int-tab-content .card .flex span[style*="font-size:24px"] {
        font-size: 20px !important;
    }
}