/* ═══════════════════════════════════════════════════════════
   GRUPY TERAPEUTYCZNE — Shortcode [grupa_terapeutyczna]
   ═══════════════════════════════════════════════════════════ */

:root {
    --gt-primary: #2563eb;
    --gt-primary-hover: #1d4ed8;
    --gt-success: #059669;
    --gt-danger: #dc2626;
    --gt-text: #1f2937;
    --gt-text-muted: #6b7280;
    --gt-bg: #ffffff;
    --gt-bg-soft: #f9fafb;
    --gt-border: #e5e7eb;
    --gt-radius: 12px;
    --gt-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --gt-shadow-lg: 0 10px 40px rgba(0,0,0,0.12);
}

/* Loader */
.gt-loader { text-align: center; padding: 60px 20px; color: var(--gt-text-muted); font-size: 15px; }
.gt-spinner { display: inline-block; width: 20px; height: 20px; border: 2px solid var(--gt-border); border-top-color: var(--gt-primary); border-radius: 50%; animation: gt-spin 0.6s linear infinite; vertical-align: middle; margin-right: 8px; }
@keyframes gt-spin { to { transform: rotate(360deg); } }

/* Empty state */
.gt-empty { text-align: center; padding: 60px 20px; }
.gt-empty-icon { font-size: 48px; margin-bottom: 12px; }
.gt-empty p { color: var(--gt-text-muted); font-size: 16px; margin: 0; }

/* Lista */
.gt-list { max-width: 800px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

/* ─── KARTA GRUPY ─── */
.gt-card {
    background: var(--gt-bg);
    border: 1px solid var(--gt-border);
    border-radius: var(--gt-radius);
    box-shadow: var(--gt-shadow);
    overflow: hidden;
    transition: box-shadow 0.2s;
}
.gt-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,0.08); }

.gt-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 20px;
    padding: 24px;
}
.gt-card-info { flex: 1; min-width: 0; }
.gt-card-title { margin: 0 0 4px; font-size: 22px; font-weight: 700; color: var(--gt-text); line-height: 1.3; }
.gt-card-leader { font-size: 14px; color: var(--gt-text-muted); margin-bottom: 12px; }

.gt-card-meta { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 14px; color: var(--gt-text); }
.gt-icon { margin-right: 2px; }

/* CTA kolumna */
.gt-card-cta {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    min-width: 180px;
    flex-shrink: 0;
}

/* Wolne miejsca */
.gt-spots { font-size: 13px; font-weight: 600; color: var(--gt-success); text-align: center; display: flex; align-items: center; justify-content: center; gap: 6px; }
.gt-spots-dot { width: 8px; height: 8px; background: var(--gt-success); border-radius: 50%; display: inline-block; }
.gt-spots-full { color: var(--gt-danger); }
.gt-spots-full .gt-spots-dot { background: var(--gt-danger); }

/* ─── PRZYCISKI ─── */
.gt-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; font-size: 14px; font-weight: 600;
    border: none; border-radius: 8px; cursor: pointer;
    transition: all 0.15s; text-decoration: none; text-align: center;
    line-height: 1.4;
}
.gt-btn-primary { background: var(--gt-primary); color: #fff; }
.gt-btn-primary:hover:not(:disabled) { background: var(--gt-primary-hover); }
.gt-btn-primary:disabled { background: #9ca3af; cursor: not-allowed; }
.gt-btn-success { background: var(--gt-success); color: #fff; }
.gt-btn-success:hover { filter: brightness(0.9); }
.gt-btn-ghost { background: transparent; color: var(--gt-primary); border: 1px solid var(--gt-border); }
.gt-btn-ghost:hover { background: var(--gt-bg-soft); border-color: #d1d5db; }
.gt-btn-full { width: 100%; }

/* ─── SZCZEGÓŁY (rozwijane) ─── */
.gt-card-details {
    padding: 0 24px 24px;
    border-top: 1px solid var(--gt-border);
    animation: gt-fade-in 0.3s ease;
}
@keyframes gt-fade-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.gt-description { font-size: 15px; line-height: 1.7; color: var(--gt-text); padding-top: 20px; }
.gt-description p { margin: 0 0 12px; }
.gt-description h3 { margin: 20px 0 8px; font-size: 17px; }
.gt-section-title { font-size: 16px; font-weight: 700; color: var(--gt-text); margin: 24px 0 12px; padding-bottom: 8px; border-bottom: 1px solid var(--gt-border); }

/* Prowadzący */
.gt-leaders-grid { display: flex; flex-direction: column; gap: 12px; }
.gt-leader {
    display: flex; gap: 16px; padding: 16px;
    background: var(--gt-bg-soft); border-radius: 10px; border: 1px solid var(--gt-border);
}
.gt-leader-photo {
    width: 64px; height: 64px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
    border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}
.gt-leader-placeholder {
    width: 64px; height: 64px; border-radius: 50%; flex-shrink: 0;
    background: var(--gt-primary); color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 24px; font-weight: 700;
}
.gt-leader-body { flex: 1; min-width: 0; }
.gt-leader-name { font-size: 15px; font-weight: 700; color: var(--gt-text); }
.gt-leader-title { font-size: 13px; color: var(--gt-text-muted); margin-top: 2px; }
.gt-leader-bio { font-size: 14px; line-height: 1.6; color: #4b5563; margin-top: 8px; }
.gt-leader-bio p { margin: 0 0 6px; }

/* Edycje */
.gt-editions { margin-top: 4px; }
.gt-edition-row {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; border-radius: 8px;
    border: 1px solid var(--gt-border); margin-bottom: 6px; font-size: 14px;
}
.gt-edition-schedule { display: block; font-size: 13px; color: var(--gt-text-muted); }
.gt-edition-right { text-align: right; }
.gt-spots-inline { font-size: 13px; font-weight: 600; color: var(--gt-success); }
.gt-spots-inline.gt-spots-full { color: var(--gt-danger); }

/* ─── MODAL ZAPISU ─── */
.gt-overlay {
    position: fixed; inset: 0; z-index: 99999;
    background: rgba(0,0,0,0.5); backdrop-filter: blur(2px);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-sizing: border-box;
}
.gt-modal {
    background: var(--gt-bg); border-radius: 16px;
    width: 100%; max-width: 480px;
    box-shadow: var(--gt-shadow-lg);
    position: relative; max-height: 90vh; overflow-y: auto;
}
.gt-modal-close {
    position: absolute; top: 12px; right: 16px;
    background: none; border: none; font-size: 28px; color: #9ca3af;
    cursor: pointer; line-height: 1; z-index: 1;
}
.gt-modal-close:hover { color: var(--gt-text); }

.gt-modal-header {
    padding: 28px 28px 0; text-align: center;
}
.gt-modal-header h2 { margin: 0; font-size: 20px; font-weight: 700; color: var(--gt-text); }
.gt-modal-group-name { margin: 6px 0 0; font-size: 14px; color: var(--gt-text-muted); }

.gt-modal-body { padding: 20px 28px 28px; }

/* Pola formularza */
.gt-field { margin-bottom: 16px; }
.gt-field label { display: block; font-size: 13px; font-weight: 600; color: var(--gt-text); margin-bottom: 5px; }
.gt-field label small { font-weight: 400; color: var(--gt-text-muted); }
.gt-field input,
.gt-field textarea,
.gt-field select {
    width: 100%; padding: 10px 14px; font-size: 15px;
    font-family: inherit; color: var(--gt-text);
    background: #fff;
    border: 1px solid var(--gt-border); border-radius: 8px;
    transition: border-color 0.15s, box-shadow 0.15s; box-sizing: border-box;
    display: block;
}
.gt-field textarea {
    min-height: 76px; line-height: 1.5; resize: vertical;
}
.gt-field input::placeholder,
.gt-field textarea::placeholder { color: var(--gt-text-muted); }
.gt-field input:focus,
.gt-field textarea:focus,
.gt-field select:focus { outline: none; border-color: var(--gt-primary); box-shadow: 0 0 0 3px rgba(37,99,235,0.1); }

/* Zgody */
.gt-consents { margin: 20px 0 16px; }
.gt-consent {
    display: flex; align-items: flex-start; gap: 8px;
    font-size: 13px; line-height: 1.5; color: #4b5563;
    margin-bottom: 10px; cursor: pointer;
}
.gt-consent input[type="checkbox"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--gt-primary); }
.gt-consent a { color: var(--gt-primary); }

/* Podsumowanie */
.gt-summary { margin-bottom: 20px; }
.gt-summary-row {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: 10px 0; border-bottom: 1px solid var(--gt-border);
    font-size: 14px;
}
.gt-summary-row span { color: var(--gt-text-muted); }
.gt-summary-row strong { color: var(--gt-text); text-align: right; }

.gt-modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 8px; }

/* Sukces */
.gt-success { text-align: center; padding: 40px 28px !important; }
.gt-success-icon {
    width: 56px; height: 56px; border-radius: 50%;
    background: #d1fae5; color: var(--gt-success);
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 700; margin-bottom: 16px;
}
.gt-success h2 { margin: 0 0 8px; font-size: 22px; }
.gt-success p { font-size: 15px; color: var(--gt-text-muted); line-height: 1.6; margin: 0; }

/* ─── RESPONSYWNOŚĆ ─── */
@media (max-width: 640px) {
    .gt-card-top { flex-direction: column; gap: 16px; }
    .gt-card-cta { min-width: unset; flex-direction: row; flex-wrap: wrap; }
    .gt-card-cta .gt-btn { flex: 1; min-width: 140px; }
    .gt-spots { justify-content: flex-start; }
    .gt-card-title { font-size: 19px; }
    .gt-leader { flex-direction: column; align-items: center; text-align: center; }
    .gt-edition-row { flex-direction: column; gap: 4px; align-items: flex-start; }
    .gt-edition-right { text-align: left; }
    .gt-overlay {
        align-items: flex-start;
        /* Duży dolny padding = zapas do przewinięcia, żeby przycisk zapisu dało się
           wyciągnąć NAD klawiaturę bez jej chowania (kluczowe dla starszych telefonów). */
        padding: max(12px, env(safe-area-inset-top)) 12px calc(env(safe-area-inset-bottom) + 45vh);
        -webkit-overflow-scrolling: touch;
    }
    .gt-modal { max-width: 100%; max-height: none; border-radius: 12px; margin: 0 auto; }
    .gt-modal-body { padding: 16px 20px 20px; }
    .gt-modal-header { padding: 20px 20px 0; }
    .gt-modal-actions { flex-direction: column; }
}

/* ── Zgłoszenie zainteresowania (nie pasują terminy) ── */
.gt-interest {
    display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin-top: 20px; padding: 18px 22px;
    border: 1px dashed rgba(61, 107, 79, .35);
    border-radius: 14px; background: rgba(61, 107, 79, .05);
}
.gt-interest-text { display: flex; flex-direction: column; gap: 3px; }
.gt-interest-text strong { font-size: 15px; color: #234034; }
.gt-interest-text span { font-size: 13px; color: #4a5d50; max-width: 60ch; }
.gt-btn-interest { font-size: 12px; }
.gt-field-row { display: flex; gap: 12px; }
.gt-field-row .gt-field { flex: 1; }
.gt-error { margin: 4px 0 0; color: #b32d2e; font-size: 13px; }
@media (max-width: 560px) { .gt-field-row { flex-direction: column; gap: 0; } }

/* Nota trybu ZAPISY (przedzapisy) w modalu grup */
.gt-przedzapisy-note { margin: 0 0 10px; padding: 8px 12px; background: rgba(61,107,79,.06); border-radius: 8px; font-size: 12.5px; color: #4a5d50; line-height: 1.45; }
