/* ==========================================================================
   1. Główny kontener i typografia
   ========================================================================== */
.basap-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #334155;
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
    box-sizing: border-box;
}

.basap-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 24px;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    margin-bottom: 30px;
}

.basap-card h2 {
    font-size: 22px;
    margin: 0 0 6px 0;
    color: #0f172a;
    font-weight: 700;
}

.basap-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

/* ==========================================================================
   2. Struktura tabeli i wymuszenie równych proporcji (Bez scrolla)
   ========================================================================== */
.basap-table-wrapper {
    width: 100%;
    overflow-x: auto; /* Zapewnia responsywność na urządzeniach mobilnych */
}

.basap-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed; /* Wymusza sztywne i stałe trzymanie proporcji kolumn */
    min-width: 850px; /* Bezpieczna szerokość minimalna, by komórki były czytelne */
}

/* Podział proporcji kolumn dla układu 2-zadaniowego */
.basap-th-main {
    width: 36%;
    text-align: left;
}

.basap-th-sub {
    display: block;
    font-size: 11px;
    font-weight: normal;
    color: #64748b;
    margin-top: 4px;
}

.basap-th-task {
    width: 32%;
}

.basap-table th, 
.basap-table td {
    border: 1px solid #e2e8f0;
    padding: 14px 16px;
    vertical-align: top;
    font-size: 13.5px;
    word-wrap: break-word; /* Bezpieczne zawijanie długich ciągów tekstu */
    box-sizing: border-box;
}

.basap-table th {
    background-color: #f8fafc;
    color: #0f172a;
}

/* Wiersze rozdzielające poszczególne etapy audytu */
.basap-row-section-divider td {
    background: #f1f5f9;
    color: #1e293b;
    font-size: 14px;
    font-weight: 700;
    padding: 12px 16px;
    border-top: 2px solid #cbd5e1;
    border-bottom: 2px solid #cbd5e1;
}

/* ==========================================================================
   3. Pola wejściowe (Edytowalne z ręki nagłówki i pytania)
   ========================================================================== */
.basap-input-header {
    width: 100%;
    padding: 8px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-weight: 600;
    text-align: center;
    color: #1e293b;
    background: #ffffff;
    box-sizing: border-box;
}

.basap-editable-question {
    width: 100%;
    font-weight: 700;
    font-size: 13.5px;
    color: #0f172a;
    border: 1px solid transparent;
    background: transparent;
    padding: 4px;
    margin: 0;
    border-radius: 4px;
    cursor: pointer;
    box-sizing: border-box;
    white-space: normal; /* Pozwala na zawijanie pytań wewnątrz inputa */
}

.basap-editable-question:hover {
    border-color: #cbd5e1;
    background: #f8fafc;
}

.basap-input-header:focus,
.basap-editable-question:focus, 
.basap-select:focus, 
.basap-textarea:focus {
    border-color: #3b82f6;
    background: #ffffff;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.basap-q-cell p {
    font-size: 12px;
    color: #64748b;
    margin: 6px 0 0 4px;
    line-height: 1.4;
}

/* ==========================================================================
   4. Formularze, Selecty i Opisy (Subteksty)
   ========================================================================== */
.basap-select, 
.basap-textarea, .basap-current-lvl-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background-color: #ffffff;
    color: #334155;
    font-size: 13px;
    box-sizing: border-box;
}

.basap-textarea {
    resize: vertical;
    min-height: 85px;
    line-height: 1.4;
}

.basap-subtext {
    font-size: 11.5px;
    color: #64748b;
    font-style: italic;
    margin: 6px 0 0 2px;
    line-height: 1.3;
}

/* ==========================================================================
   5. Wyniki, Podsumowanie i Badge Rekomendacji
   ========================================================================== */
.basap-row-total {
    background-color: #f8fafc;
    font-weight: bold;
}

.basap-score-display {
    text-align: center;
    font-size: 15px;
    color: #0f172a;
    font-weight: 700;
    vertical-align: middle !important;
}

.basap-badge {
    display: block;
    padding: 6px 12px;
    border-radius: 20px;
    color: #ffffff;
    font-weight: 600;
    font-size: 12px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Kolory progów rekomendacji */
.basap-badge.lvl-1 { background-color: #64748b; }
.basap-badge.lvl-2 { background-color: #10b981; } /* Zielony */
.basap-badge.lvl-3 { background-color: #f59e0b; } /* Pomarańczowy */
.basap-badge.lvl-4 { background-color: #e11d48; } /* Czerwony */

/* Kolorowanie stanów luk technologicznych */
.basap-text-danger { color: #e11d48; font-weight: 700; }
.basap-text-success { color: #10b981; font-weight: 700; }
.basap-text-muted { color: #94a3b8; font-style: italic; }

/* ==========================================================================
   6. Sekcja Formularza (Lead-Magnet & AJAX Response)
   ========================================================================== */
.basap-form-row td {
    padding: 20px 16px;
    background: #ffffff;
}

.basap-mail-form-container {
    padding: 20px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px dashed #cbd5e1;
}

.basap-form-fields {
    display: flex;
    gap: 15px;
    margin-bottom: 14px;
}

.basap-form-fields input[type="email"] {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.basap-form-fields button {
    background: #2563eb;
    color: #ffffff;
    border: none;
    padding: 10px 24px;
    border-radius: 6px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s ease, transform 0.1s ease;
    box-sizing: border-box;
    white-space: nowrap;
}

.basap-form-fields button:hover {
    background: #1d4ed8;
}

.basap-form-fields button:active {
    transform: scale(0.98);
}

.basap-form-fields button:disabled {
    background: #94a3b8;
    cursor: not-allowed;
    transform: none;
}

.basap-form-consents {
    font-size: 12px;
    color: #475569;
    line-height: 1.5;
}

.basap-consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.basap-consent-label input[type="checkbox"] {
    margin-top: 3px;
    width: 15px;
    height: 15px;
    cursor: pointer;
}

#basap-form-response {
    margin-top: 12px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.4;
}

#basap-form-response.success { 
    color: #10b981; 
}

#basap-form-response.error { 
    color: #e11d48; 
}

/* ==========================================================================
   7. Legenda i dolne objaśnienia
   ========================================================================== */
.basap-legenda {
    margin-top: 24px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 18px;
    border-radius: 8px;
    font-size: 12.5px;
    color: #475569;
    line-height: 1.5;
}

.basap-legenda strong {
    color: #0f172a;
}

/* Wrapper pomocniczy eliminujący błędy przesunięć wewnątrz edytora Gutenberg admin */
.basap-block-editor-holder {
    width: 100%;
    clear: both;
}