/**
 * teams.css — блок «Моя команда» (dashboard + сторінка профілю) і модальні вікна команд.
 * Самодостатній: не залежить від змінних конкретної сторінки, лише використовує їх як підказку.
 */

.jg-team-block {
    color: var(--text-light, var(--text-primary, #e2e8f0));
}

.jg-team-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    padding: 20px;
}

body.light-theme .jg-team-card {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.1);
    color: #2c3e50;
}

.jg-team-card__title {
    margin: 0 0 6px 0;
    font-size: 1.15rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    word-break: break-word;
}

.jg-team-card__meta {
    margin: 0 0 14px 0;
    font-size: 0.95rem;
    color: var(--text-gray, var(--text-secondary, #94a3b8));
}

.jg-team-card__desc {
    margin: 0 0 14px 0;
    font-size: 0.95rem;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: break-word;
}

.jg-team-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.jg-team-list {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0 0 14px;
}

.jg-team-list-item {
    padding: 12px 0 0;
    border-top: 1px solid rgba(148, 163, 184, 0.35);
}

.jg-team-list-item:first-child {
    padding-top: 0;
    border-top: none;
}

.jg-team-pick-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.jg-team-pick-item {
    margin: 0;
    padding: 12px 14px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    border-radius: 10px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.04);
    transition: border-color 0.15s ease, background 0.15s ease;
}

.jg-team-pick-item:hover,
.jg-team-pick-item.is-selected {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.12);
}

.jg-team-pick-item__name {
    font-weight: 600;
    font-size: 0.98rem;
}

.jg-team-pick-item__meta {
    margin-top: 4px;
    font-size: 0.85rem;
    opacity: 0.8;
}

.badge-team-looking__name {
    display: inline-block;
    margin-right: 8px;
    font-weight: 700;
}

.jg-team-btn {
    appearance: none;
    border: none;
    border-radius: 8px;
    padding: 11px 18px;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
    line-height: 1.2;
}

.jg-team-btn--primary {
    background: #2563eb;
    color: #ffffff;
}

.jg-team-btn--primary:hover:not(:disabled) {
    background: #1d4ed8;
}

/* Ghost на темній модалці: світлий текст, не сірий блок */
.jg-team-btn--ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.jg-team-btn--ghost:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

body.light-theme .jg-team-btn--ghost {
    background: #334155;
    border-color: #475569;
    color: #ffffff;
}

body.light-theme .jg-team-btn--ghost:hover:not(:disabled) {
    background: #475569;
    color: #ffffff;
}

.jg-team-btn--danger {
    background: transparent;
    color: #e74c3c;
    border: 1px solid rgba(231, 76, 60, 0.5);
}

.jg-team-btn--danger:hover:not(:disabled) {
    background: rgba(231, 76, 60, 0.12);
}

.jg-team-btn--sm {
    padding: 7px 12px;
    font-size: 0.85rem;
    white-space: nowrap;
}

.jg-team-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.jg-team-empty__text {
    margin: 0 0 16px 0;
    color: var(--text-gray, var(--text-secondary, #94a3b8));
    font-size: 0.98rem;
}

.jg-team-skeleton {
    color: var(--text-gray, var(--text-secondary, #94a3b8));
    font-size: 0.95rem;
}

.jg-team-error {
    color: #e74c3c;
    font-size: 0.95rem;
}

/* --- Учасники --- */

.jg-team-members {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.jg-team-member {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

body.light-theme .jg-team-member {
    background: rgba(15, 23, 42, 0.03);
    border-color: rgba(15, 23, 42, 0.08);
}

.jg-team-member__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: rgba(52, 152, 219, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color, #3498db);
    font-weight: 700;
    text-transform: uppercase;
}

.jg-team-member__info {
    flex: 1 1 auto;
    min-width: 0;
}

.jg-team-member__name {
    font-weight: 600;
    word-break: break-word;
}

.jg-team-member__title {
    font-size: 0.88rem;
    color: var(--text-gray, var(--text-secondary, #94a3b8));
    word-break: break-word;
}

.jg-team-member__role {
    font-size: 0.78rem;
    font-weight: 700;
    padding: 3px 9px;
    border-radius: 999px;
    white-space: nowrap;
    flex-shrink: 0;
}

.jg-team-member__role--owner {
    background: rgba(52, 152, 219, 0.18);
    color: #3498db;
}

.jg-team-member__role--member {
    background: rgba(148, 163, 184, 0.18);
    color: #94a3b8;
}

/* --- Модальні вікна --- */

.jg-team-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100001;
    padding: 20px;
    box-sizing: border-box;
    overflow-y: auto;
}

body.light-theme .jg-team-modal {
    background: rgba(0, 0, 0, 0.5);
}

.jg-team-modal__dialog {
    background: #1a2744;
    color: #e8eef7;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
}

body.light-theme .jg-team-modal__dialog {
    background: #ffffff;
    color: #2c3e50;
    border-color: rgba(15, 23, 42, 0.08);
    box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
}

.jg-team-modal__header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

body.light-theme .jg-team-modal__header {
    border-bottom-color: rgba(15, 23, 42, 0.08);
}

.jg-team-modal__title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    flex: 1 1 auto;
    min-width: 0;
    word-break: break-word;
}

.jg-team-modal__close {
    appearance: none;
    background: rgba(15, 23, 42, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #ffffff;
    width: 30px;
    height: 30px;
    min-width: 30px;
    border-radius: 50%;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

body.light-theme .jg-team-modal__close {
    background: #334155;
    border-color: #475569;
    color: #ffffff;
}

.jg-team-modal__close:hover {
    background: rgba(231, 76, 60, 0.9);
    border-color: transparent;
    color: #ffffff;
}

.jg-team-modal__body {
    padding: 20px;
    overflow-y: auto;
}

.jg-team-modal__footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

body.light-theme .jg-team-modal__footer {
    border-top-color: rgba(15, 23, 42, 0.08);
}

.jg-team-field {
    margin-bottom: 16px;
}

.jg-team-field label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
}

.jg-team-field input,
.jg-team-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.35);
    color: inherit;
    font-size: 16px; /* 16px — щоб iOS не зумив форму */
    font-family: inherit;
}

body.light-theme .jg-team-field input,
body.light-theme .jg-team-field textarea {
    background: #ffffff;
    border-color: #d8dee9;
}

.jg-team-field textarea {
    min-height: 92px;
    resize: vertical;
}

.jg-team-field__hint {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--text-gray, #94a3b8);
}

.jg-team-field__error {
    margin-top: 6px;
    font-size: 0.85rem;
    color: #e74c3c;
    min-height: 1em;
}

.jg-team-recruiting {
    margin: 12px 0 18px;
    padding: 12px;
    border-radius: 10px;
    background: rgba(52, 152, 219, 0.08);
    border: 1px solid rgba(52, 152, 219, 0.2);
}

.jg-team-recruiting__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    cursor: pointer;
}

.jg-team-looking-for {
    margin: 8px 0 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: #2980b9;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 8px;
}

.jg-team-looking-for__label {
    font-weight: 700;
    color: #7dd3fc;
}

body.light-theme .jg-team-looking-for__label {
    color: #1e4f7a;
}

.jg-team-looking-chips {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.jg-team-looking-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(96, 165, 250, 0.22) !important;
    border: 1px solid rgba(147, 197, 253, 0.45) !important;
    color: #e0f2fe !important;
    -webkit-text-fill-color: #e0f2fe !important;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.3;
    word-break: break-word;
}

.jg-team-looking-chip--more {
    opacity: 0.85;
    font-weight: 700;
}

body.light-theme .jg-team-looking-chip {
    background: rgba(37, 99, 235, 0.12) !important;
    border-color: rgba(37, 99, 235, 0.28) !important;
    color: #1d4ed8 !important;
    -webkit-text-fill-color: #1d4ed8 !important;
}

.jg-team-looking-chip--editable {
    padding-right: 4px;
    background: rgba(148, 163, 184, 0.28) !important;
    border-color: rgba(203, 213, 225, 0.5) !important;
    color: #f8fafc !important;
    -webkit-text-fill-color: #f8fafc !important;
}

body.light-theme .jg-team-looking-chip--editable {
    background: #e8eef8 !important;
    border-color: #bfd0ea !important;
    color: #1e3a5f !important;
    -webkit-text-fill-color: #1e3a5f !important;
}

.jg-team-looking-chip__text {
    color: inherit !important;
    -webkit-text-fill-color: inherit !important;
    background: transparent !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
    padding: 0 !important;
}

.jg-team-looking-chip__remove {
    appearance: none;
    border: none !important;
    background: transparent !important;
    outline: none !important;
    box-shadow: none !important;
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    cursor: pointer;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.jg-team-looking-chip__remove:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #f8fafc !important;
}

body.light-theme .jg-team-looking-chip__remove {
    color: #64748b !important;
}

body.light-theme .jg-team-looking-chip__remove:hover {
    background: rgba(15, 23, 42, 0.08);
    color: #0f172a !important;
}

.jg-team-tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    min-height: 42px;
    padding: 6px 8px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.45) !important;
    background: rgba(15, 23, 42, 0.35) !important;
    cursor: text;
    box-sizing: border-box;
}

body.light-theme .jg-team-tags {
    background: #ffffff !important;
    border-color: #cbd5e1 !important;
}

.jg-team-tags__list {
    display: contents;
}

.jg-team-tags__input {
    flex: 1 1 140px;
    min-width: 140px;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    box-shadow: none !important;
    outline: none;
    padding: 4px 2px !important;
    margin: 0;
    font-size: 0.92rem;
    color: #f1f5f9 !important;
    -webkit-text-fill-color: #f1f5f9 !important;
    min-height: 28px;
}

.jg-team-tags__input::placeholder {
    color: #94a3b8 !important;
    -webkit-text-fill-color: #94a3b8 !important;
    opacity: 1 !important;
}

body.light-theme .jg-team-tags__input {
    color: #0f172a !important;
    -webkit-text-fill-color: #0f172a !important;
}

body.light-theme .jg-team-tags__input::placeholder {
    color: #64748b !important;
    -webkit-text-fill-color: #64748b !important;
}

.jg-team-looking-editor {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.jg-team-looking-editor .jg-team-tags {
    flex: 1 1 auto;
}

.jg-team-looking-editor .jg-team-btn {
    flex: 0 0 auto;
    margin-top: 2px;
}

.jg-team-join-requests .jg-team-member {
    flex-wrap: wrap;
}

/* Sidebar: «Моя команда» трохи помітніша, без нового кольору */
.sidebar-menu .sidebar-team-item > a {
    font-weight: 600;
}

.sidebar-menu .sidebar-team-item > a .menu-icon {
    color: var(--primary-color, #3498db);
}

.jg-team-modal-action-btn {
    appearance: none;
    border: 1px solid rgba(52, 152, 219, 0.45);
    border-radius: 10px;
    padding: 0 16px;
    min-height: 42px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1 1 160px;
    margin: 0;
    box-sizing: border-box;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.jg-team-modal-action-btn__icon {
    font-size: 1rem;
    line-height: 1;
}

.jg-team-modal-action-btn--secondary {
    background: #334155 !important;
    background-color: #334155 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

.jg-team-modal-action-btn--secondary:hover {
    background: #475569 !important;
    background-color: #475569 !important;
    border-color: #64748b !important;
    color: #ffffff !important;
}

.jg-team-modal-action-btn--secondary span,
.jg-team-modal-action-btn--secondary .jg-team-modal-action-btn__icon {
    background: transparent;
    color: inherit;
}

.jg-team-modal-action-btn--primary {
    background: var(--primary-color, #2563eb);
    border-color: transparent;
    color: #fff;
}

.jg-team-modal-action-btn--primary:hover {
    background: var(--primary-hover, #1d4ed8);
}

body.light-theme .jg-team-modal-action-btn--secondary {
    background: #334155 !important;
    background-color: #334155 !important;
    color: #ffffff !important;
    border-color: #475569 !important;
}

.message-sender-name {
    font-size: 0.78rem;
    font-weight: 600;
    color: #3498db;
    margin: 0 0 4px 2px;
}

#jg-team-chat-nav-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.45);
    backdrop-filter: blur(2px);
}

#jg-team-chat-nav-overlay[hidden] {
    display: none !important;
}

.jg-team-chat-nav-overlay__card {
    min-width: 220px;
    max-width: 90vw;
    padding: 22px 26px;
    border-radius: 14px;
    background: #fff;
    color: #1e293b;
    font-weight: 600;
    font-size: 0.95rem;
    text-align: center;
    box-shadow: 0 12px 40px rgba(15, 23, 42, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.jg-team-chat-nav-overlay__spinner {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 3px solid rgba(52, 152, 219, 0.25);
    border-top-color: #3498db;
    animation: jg-team-chat-spin 0.7s linear infinite;
}

@keyframes jg-team-chat-spin {
    to { transform: rotate(360deg); }
}

.jg-team-invite-link {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex-wrap: wrap;
}

.jg-team-invite-link input {
    flex: 1 1 220px;
    min-width: 0;
}

.jg-team-section-label {
    margin: 22px 0 10px 0;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-gray, #94a3b8);
}

.jg-team-section-label:first-child {
    margin-top: 0;
}

@media (max-width: 520px) {
    /* Вузький екран: роль і дія переносяться під імʼя, щоб не рвати слова */
    .jg-team-member {
        flex-wrap: wrap;
        row-gap: 8px;
    }

    .jg-team-member__info {
        flex-basis: calc(100% - 56px);
    }

    .jg-team-member__role,
    .jg-team-member .jg-team-btn {
        margin-left: 56px;
    }

    .jg-team-member__role + .jg-team-btn {
        margin-left: 0;
    }
}

@media (max-width: 600px) {
    .jg-team-modal {
        padding: 0;
        align-items: flex-end;
    }

    .jg-team-modal__dialog {
        max-width: none;
        max-height: 100vh;
        height: 100%;
        border-radius: 0;
        border: none;
    }

    .jg-team-actions .jg-team-btn,
    .jg-team-modal__footer .jg-team-btn {
        flex: 1 1 100%;
    }
}
