/**
 * Teams Feature Styles
 * Scoped under .pp-teams-wrap (My Team tab) and .pp-admin-teams-wrap (Admin Teams tab)
 */

/* =========================================================================
   Shared Utilities
   ========================================================================= */

.pp-teams-wrap,
.pp-admin-teams-wrap {
    font-family: inherit;
}

.pp-teams-wrap .section-heading,
.pp-admin-teams-wrap .section-heading {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    margin: 24px 0 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e5e7eb;
}

/* =========================================================================
   Stats Grid
   ========================================================================= */

.team-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

@media (max-width: 640px) {
    .team-stats-grid {
        grid-template-columns: 1fr;
    }
}

.team-stat-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    text-align: center;
}

.team-stat-value {
    font-size: 28px;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
}

.team-stat-label {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 4px;
}

/* =========================================================================
   Invite Link Card
   ========================================================================= */

.invite-link-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 24px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.invite-link-label {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    white-space: nowrap;
}

.invite-link-url {
    flex: 1;
    font-size: 13px;
    color: #2563eb;
    word-break: break-all;
    font-family: monospace;
}

.invite-link-actions {
    display: flex;
    gap: 8px;
}

.btn-copy-invite,
.btn-regen-invite {
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 5px;
    cursor: pointer;
    border: 1px solid #d1d5db;
    background: #fff;
    color: #374151;
    transition: background 0.15s, border-color 0.15s;
}

.btn-copy-invite:hover,
.btn-regen-invite:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-copy-invite.copied {
    background: #d1fae5;
    border-color: #6ee7b7;
    color: #065f46;
}

/* =========================================================================
   Team Members Table
   ========================================================================= */

.team-members-table-wrap {
    overflow-x: auto;
    margin-bottom: 24px;
}

.team-members-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.team-members-table th {
    background: #f9fafb;
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.team-members-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.team-members-table tr:last-child td {
    border-bottom: none;
}

.team-members-table tr:hover td {
    background: #f9fafb;
}

/* Role badges */
.member-role-leader {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #dbeafe;
    color: #1e40af;
}

.member-role-member {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #d1fae5;
    color: #065f46;
}

/* Split badge */
.split-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
    font-weight: 600;
    background: #fef9c3;
    color: #854d0e;
    cursor: pointer;
}

.split-badge:hover {
    background: #fde68a;
}

/* Inline split edit form */
.split-edit-form {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 6px;
}

.split-edit-form.active {
    display: flex;
}

.split-edit-form input[type="number"] {
    width: 60px;
    padding: 4px 8px;
    font-size: 12px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
}

.split-edit-form .btn-save-split,
.split-edit-form .btn-cancel-split {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
}

.split-edit-form .btn-save-split {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.split-edit-form .btn-save-split:hover {
    background: #1d4ed8;
}

.split-edit-form .btn-cancel-split {
    background: #fff;
    color: #374151;
    border-color: #d1d5db;
}

/* Action buttons in table */
.btn-remove-member {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    background: #fff;
    color: #dc2626;
    border: 1px solid #fca5a5;
    transition: background 0.15s;
}

.btn-remove-member:hover {
    background: #fee2e2;
}

/* =========================================================================
   Add Member Modal
   ========================================================================= */

.add-member-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.add-member-modal-overlay.active {
    display: flex;
}

.add-member-modal {
    background: #fff;
    border-radius: 10px;
    padding: 28px;
    width: 100%;
    max-width: 480px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
}

.add-member-modal h3 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 700;
    color: #111827;
}

.add-member-modal label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.add-member-modal input[type="text"],
.add-member-modal input[type="number"] {
    width: 100%;
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-sizing: border-box;
    margin-bottom: 12px;
}

.agent-search-results {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    max-height: 180px;
    overflow-y: auto;
    margin-bottom: 12px;
    display: none;
}

.agent-search-results.active {
    display: block;
}

.agent-search-result-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
    transition: background 0.1s;
}

.agent-search-result-item:last-child {
    border-bottom: none;
}

.agent-search-result-item:hover,
.agent-search-result-item.selected {
    background: #eff6ff;
    color: #1e40af;
}

.agent-search-result-item .agent-email {
    font-size: 11px;
    color: #6b7280;
    display: block;
}

.add-member-modal .modal-footer {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 8px;
}

.btn-add-member-submit {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    background: #2563eb;
    color: #fff;
    border: none;
    transition: background 0.15s;
}

.btn-add-member-submit:hover {
    background: #1d4ed8;
}

.btn-modal-cancel {
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    transition: background 0.15s;
}

.btn-modal-cancel:hover {
    background: #f9fafb;
}

/* =========================================================================
   Leader Earnings Table
   ========================================================================= */

.leader-earnings-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.leader-earnings-table th {
    background: #f9fafb;
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
}

.leader-earnings-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.leader-earnings-table tr:last-child td {
    border-bottom: none;
}

/* Status pills */
.earning-status-pending_payout {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #fef9c3;
    color: #854d0e;
}

.earning-status-paid {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #d1fae5;
    color: #065f46;
}

/* =========================================================================
   Admin Teams Tab
   ========================================================================= */

.pp-admin-teams-wrap .teams-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.pp-admin-teams-wrap .teams-table th {
    background: #f9fafb;
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #6b7280;
    border-bottom: 2px solid #e5e7eb;
    white-space: nowrap;
}

.pp-admin-teams-wrap .teams-table td {
    padding: 10px 14px;
    border-bottom: 1px solid #f3f4f6;
    vertical-align: middle;
}

.pp-admin-teams-wrap .teams-table tr:last-child td {
    border-bottom: none;
}

.pp-admin-teams-wrap .teams-table tr:hover td {
    background: #f9fafb;
}

.team-status-active {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #d1fae5;
    color: #065f46;
}

.team-status-inactive {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 600;
    background: #f3f4f6;
    color: #6b7280;
}

/* Admin teams toolbar */
.pp-admin-teams-wrap .teams-toolbar {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.pp-admin-teams-wrap .teams-toolbar input[type="text"] {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    min-width: 220px;
}

.pp-admin-teams-wrap .teams-toolbar select {
    padding: 8px 12px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
}

/* Expanded team detail row */
.team-detail-row td {
    background: #f9fafb !important;
    padding: 16px 20px !important;
}

.team-detail-inner {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

/* =========================================================================
   Join Our Team — Public Landing Page
   ========================================================================= */

.pp-join-team-wrap {
    max-width: 1000px;
    margin: 0 auto;
    padding: 0 20px 60px;
    font-family: inherit;
}

/* Hero */
.pp-join-team-hero {
    text-align: center;
    padding: 60px 20px 40px;
}

.pp-join-team-hero h1 {
    font-size: 36px;
    font-weight: 800;
    color: #111827;
    margin-bottom: 16px;
    line-height: 1.2;
}

.pp-join-team-hero p {
    font-size: 18px;
    color: #6b7280;
    max-width: 600px;
    margin: 0 auto 28px;
}

.btn-start-team {
    display: inline-block;
    padding: 14px 36px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    background: #2563eb;
    color: #fff;
    border: none;
    transition: background 0.15s, transform 0.1s;
    text-decoration: none;
}

.btn-start-team:hover {
    background: #1d4ed8;
    transform: translateY(-1px);
    color: #fff;
    text-decoration: none;
}

/* How it works — 3-column */
.pp-how-it-works {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
    padding: 40px 0;
    border-top: 1px solid #e5e7eb;
    border-bottom: 1px solid #e5e7eb;
    margin-bottom: 40px;
}

@media (max-width: 640px) {
    .pp-how-it-works {
        grid-template-columns: 1fr;
    }
}

.pp-how-it-works-step {
    text-align: center;
    padding: 20px;
}

.pp-how-it-works-step .step-icon {
    font-size: 36px;
    margin-bottom: 12px;
}

.pp-how-it-works-step h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 8px;
    color: #111827;
}

.pp-how-it-works-step p {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
}

/* Benefits grid */
.pp-benefits-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 48px;
}

@media (max-width: 640px) {
    .pp-benefits-grid {
        grid-template-columns: 1fr;
    }
}

.pp-benefit-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
}

.pp-benefit-card h4 {
    font-size: 14px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 6px;
}

.pp-benefit-card p {
    font-size: 13px;
    color: #6b7280;
    margin: 0;
    line-height: 1.5;
}

/* Invite join card */
.pp-invite-join-card {
    background: #eff6ff;
    border: 2px solid #bfdbfe;
    border-radius: 10px;
    padding: 32px;
    text-align: center;
    margin-bottom: 40px;
}

.pp-invite-join-card h2 {
    font-size: 24px;
    font-weight: 700;
    color: #1e40af;
    margin-bottom: 8px;
}

.pp-invite-join-card p {
    font-size: 15px;
    color: #3730a3;
    margin-bottom: 20px;
}

.btn-join-via-invite {
    display: inline-block;
    padding: 12px 32px;
    font-size: 15px;
    font-weight: 700;
    border-radius: 8px;
    cursor: pointer;
    background: #1e40af;
    color: #fff;
    border: none;
    transition: background 0.15s;
}

.btn-join-via-invite:hover {
    background: #1e3a8a;
    color: #fff;
}

/* =========================================================================
   Wizard Overlay
   ========================================================================= */

.pp-join-team-wizard-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    z-index: 10000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.pp-join-team-wizard-overlay.active {
    display: flex;
}

.pp-join-team-wizard {
    background: #fff;
    border-radius: 12px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.2);
}

.pp-wizard-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid #e5e7eb;
}

.pp-wizard-header h2 {
    margin: 0 0 16px;
    font-size: 20px;
    font-weight: 700;
    color: #111827;
}

/* Step indicators */
.pp-wizard-steps {
    display: flex;
    gap: 0;
}

.pp-wizard-step {
    flex: 1;
    text-align: center;
    font-size: 12px;
    font-weight: 600;
    color: #9ca3af;
    padding: 6px 4px;
    position: relative;
}

.pp-wizard-step::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: #e5e7eb;
    border-radius: 2px;
}

.pp-wizard-step.active {
    color: #2563eb;
}

.pp-wizard-step.active::after {
    background: #2563eb;
}

.pp-wizard-step.done {
    color: #059669;
}

.pp-wizard-step.done::after {
    background: #059669;
}

.pp-wizard-body {
    padding: 24px 28px;
}

.pp-wizard-pane {
    display: none;
}

.pp-wizard-pane.active {
    display: block;
}

.pp-wizard-pane label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 4px;
}

.pp-wizard-pane input[type="text"],
.pp-wizard-pane input[type="email"],
.pp-wizard-pane input[type="password"],
.pp-wizard-pane textarea {
    width: 100%;
    padding: 9px 12px;
    font-size: 13px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    box-sizing: border-box;
    margin-bottom: 14px;
    transition: border-color 0.15s;
}

.pp-wizard-pane input:focus,
.pp-wizard-pane textarea:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.pp-wizard-pane .field-error {
    font-size: 11px;
    color: #dc2626;
    margin-top: -10px;
    margin-bottom: 10px;
    display: none;
}

.pp-wizard-pane .field-error.active {
    display: block;
}

.pp-wizard-footer {
    padding: 16px 28px 24px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    border-top: 1px solid #f3f4f6;
}

.btn-wizard-next,
.btn-wizard-submit {
    padding: 10px 24px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    background: #2563eb;
    color: #fff;
    border: none;
    transition: background 0.15s;
}

.btn-wizard-next:hover,
.btn-wizard-submit:hover {
    background: #1d4ed8;
}

.btn-wizard-back {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    background: #fff;
    color: #374151;
    border: 1px solid #d1d5db;
    transition: background 0.15s;
}

.btn-wizard-back:hover {
    background: #f9fafb;
}

.btn-wizard-close {
    position: absolute;
    top: 16px;
    right: 20px;
    font-size: 22px;
    color: #9ca3af;
    cursor: pointer;
    background: none;
    border: none;
    line-height: 1;
}

.btn-wizard-close:hover {
    color: #374151;
}

/* Review pane summary */
.wizard-review-summary {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 16px;
    font-size: 13px;
    color: #374151;
    line-height: 1.8;
}

.wizard-review-summary strong {
    color: #111827;
}

.wizard-agreement-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    color: #374151;
    margin-bottom: 4px;
}

.wizard-agreement-wrap input[type="checkbox"] {
    margin-top: 2px;
    flex-shrink: 0;
}

/* Wizard success state */
.pp-wizard-success {
    text-align: center;
    padding: 32px 0;
}

.pp-wizard-success .success-icon {
    font-size: 48px;
    margin-bottom: 16px;
}

.pp-wizard-success h3 {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin-bottom: 8px;
}

.pp-wizard-success p {
    font-size: 14px;
    color: #6b7280;
    margin-bottom: 20px;
}

/* General loading/error notice */
.pp-teams-notice {
    padding: 10px 14px;
    border-radius: 6px;
    font-size: 13px;
    margin-bottom: 12px;
    display: none;
}

.pp-teams-notice.active {
    display: block;
}

.pp-teams-notice.success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #6ee7b7;
}

.pp-teams-notice.error {
    background: #fee2e2;
    color: #991b1b;
    border: 1px solid #fca5a5;
}

.pp-teams-notice.info {
    background: #dbeafe;
    color: #1e40af;
    border: 1px solid #93c5fd;
}
