/* TeamTab Styles */

/* Container */
.team-management-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: var(--bg-primary);
    overflow: hidden;
}

/* Header */
.team-header {
    background: var(--bg-secondary);
    border-bottom: var(--border-light);
    flex-shrink: 0;
}

.team-header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px;
}

.team-header-left {
    flex: 1;
}

.team-header-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.team-header-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
}

.team-header-separator {
    color: var(--text-tertiary);
}

.team-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.team-type-badge.verified {
    background: rgb(16 185 129 / 10%);
    color: #10b981;
}

.team-type-badge.pending {
    background: rgb(245 158 11 / 10%);
    color: #f59e0b;
}

.team-type-badge.invite-only {
    background: rgb(232 194 82 / 10%);
    color: #4a66e6;
}

/* Tabs */
.team-tabs {
    display: flex;
    gap: 0;
    padding: 0 24px;
    overflow-x: auto;
}

.team-tab {
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
    white-space: nowrap;
}

.team-tab:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.team-tab.active {
    color: var(--brand-primary);
    border-bottom-color: var(--brand-primary);
}

/* Content */
.team-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Overview */
.overview-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg-secondary);
    border: var(--border-light);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgb(0 0 0 / 10%);
}

.stat-icon {
    width: 48px;
    height: 48px;
    background: var(--brand-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.stat-content {
    flex: 1;
}

.stat-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.stat-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
}

/* Cards */
.team-card {
    background: var(--bg-secondary);
    border: var(--border-light);
    border-radius: 12px;
    overflow: hidden;
}

.team-card.danger-card {
    border-color: rgb(239 68 68 / 30%);
}

.card-header {
    padding: 20px;
    border-bottom: var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    padding: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 14px;
    color: var(--text-primary);
}

.info-link {
    color: var(--brand-primary);
    text-decoration: none;
}

.info-link:hover {
    text-decoration: underline;
}

.text-secondary {
    color: var(--text-secondary);
}

/* Members */
.members-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.members-section {
    padding: 0 20px 20px;
}

.members-section:first-of-type {
    padding-top: 0;
}

.members-section-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

.members-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
}

.member-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    transition: all 0.2s;
}

.member-row:hover {
    background: var(--bg-hover);
}

.member-avatar {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: var(--brand-gradient);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.member-badge-you {
    background: var(--brand-light);
    color: var(--brand-primary);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
}

.member-meta {
    font-size: 12px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.member-separator {
    color: var(--text-tertiary);
}

.role-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}

.role-badge.role-owner {
    background: rgb(139 92 246 / 10%);
    color: #4a66e6;
}

.role-badge.role-admin {
    background: rgb(232 194 82 / 10%);
    color: #4a66e6;
}

.role-badge.role-member {
    background: rgb(107 114 128 / 10%);
    color: #6b7280;
}

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

/* Settings */
.settings-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: var(--border-light);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-item-info {
    flex: 1;
}

.settings-item-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.settings-item-value {
    font-size: 14px;
    color: var(--text-secondary);
}

.settings-item-description {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.code-block {
    background: var(--bg-primary);
    padding: 4px 8px;
    border-radius: 4px;
    font-family: Monaco, Menlo, monospace;
    font-size: 13px;
    color: var(--brand-primary);
}

.status-badge {
    padding: 4px 12px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.status-verified {
    background: rgb(16 185 129 / 10%);
    color: #10b981;
}

.status-pending {
    background: rgb(245 158 11 / 10%);
    color: #f59e0b;
}

/* Activity */
.activity-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.activity-entry {
    display: flex;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: var(--border-light);
    transition: all 0.2s;
}

.activity-entry:last-child {
    border-bottom: none;
}

.activity-entry:hover {
    background: var(--bg-hover);
}

.activity-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-primary);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.activity-content {
    flex: 1;
}

.activity-description {
    font-size: 14px;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.activity-time {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Empty State */
.empty-state {
    padding: 60px 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.empty-state-icon {
    width: 64px;
    height: 64px;
    color: var(--text-tertiary);
    opacity: 0.5;
    margin-bottom: 8px;
}

.empty-state-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.empty-state-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 16px;
    max-width: 400px;
}

.no-team-container {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    padding: 40px;
}

.no-team-content {
    text-align: center;
    max-width: 400px;
}

.no-team-icon {
    font-size: 64px;
    margin-bottom: 20px;
}

.no-team-content h2 {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.no-team-content p {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-danger,
.btn-link,
.btn-icon,
.btn-copy {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: var(--brand-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgb(0 0 0 / 15%);
}

.btn-secondary {
    background: var(--bg-hover);
    color: var(--text-primary);
    border: var(--border-light);
}

.btn-secondary:hover {
    background: var(--bg-active);
}

.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-danger:hover {
    background: #dc2626;
}

/* Disabled state for confirm buttons (used by RemoveMemberModal type-Remove gating) */
.btn-primary[disabled],
.btn-danger[disabled],
.btn-secondary[disabled] {
    opacity: 0.55;
    cursor: not-allowed;
    pointer-events: none;
}

/* Inline spinner used inside confirm buttons while a modal action is in flight */
.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid rgb(255 255 255 / 35%);
    border-top-color: #fff;
    animation: spin 0.7s linear infinite;
    margin-right: 8px;
    vertical-align: -2px;
}

.btn-secondary .btn-spinner {
    border: 2px solid rgb(0 0 0 / 18%);
    border-top-color: var(--text-primary, #111827);
}

.btn-link {
    background: transparent;
    color: var(--brand-primary);
    padding: 0;
}

.btn-link:hover {
    text-decoration: underline;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-hover);
    border: var(--border-light);
}

.btn-icon:hover {
    background: var(--bg-active);
}

.btn-icon.btn-danger {
    background: rgb(239 68 68 / 10%);
    color: #ef4444;
}

.btn-icon.btn-danger:hover {
    background: rgb(239 68 68 / 20%);
}

.btn-copy {
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bg-primary);
    color: var(--text-secondary);
}

/* Modals */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgb(0 0 0 / 50%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.modal-container {
    background: var(--bg-secondary);
    border-radius: 12px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgb(0 0 0 / 30%);
}

.modal-container.modal-large {
    max-width: 700px;
}

.modal-header {
    padding: 20px 24px;
    border-bottom: var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-hover);
    border-radius: 6px;
    font-size: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-active);
    color: var(--text-primary);
}

.modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    padding: 16px 24px;
    border-top: var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 12px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-primary);
    border: var(--border-light);
    border-radius: 6px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-primary);
    transition: all 0.2s;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--brand-primary);
    box-shadow: 0 0 0 3px var(--brand-light);
}

.form-textarea {
    resize: vertical;
}

.form-value {
    padding: 10px 12px;
    background: var(--bg-primary);
    border: var(--border-light);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-secondary);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
}

.checkbox-label input[type='checkbox'] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* Info Boxes */
.info-box,
.warning-box,
.error-box,
.success-box {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: 13px;
    margin-top: 16px;
}

.info-box {
    background: rgb(232 194 82 / 10%);
    color: #4a66e6;
    border: 1px solid rgb(232 194 82 / 20%);
}

.warning-box {
    background: rgb(245 158 11 / 10%);
    color: #f59e0b;
    border: 1px solid rgb(245 158 11 / 20%);
}

.error-box {
    background: rgb(239 68 68 / 10%);
    color: #ef4444;
    border: 1px solid rgb(239 68 68 / 20%);
}

.success-box {
    background: rgb(16 185 129 / 10%);
    color: #10b981;
    border: 1px solid rgb(16 185 129 / 20%);
}

.info-box ol,
.info-box ul {
    margin: 8px 0 0;
    padding-left: 20px;
}

.info-box li {
    margin-bottom: 4px;
}

/* DNS Record Box */
.dns-record-box {
    background: var(--bg-primary);
    border: var(--border-light);
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.dns-record-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: var(--border-light);
}

.dns-record-item:last-child {
    border-bottom: none;
}

.dns-record-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    min-width: 80px;
}

.dns-record-value {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 12px;
}

.dns-record-value code {
    flex: 1;
    background: var(--bg-secondary);
    padding: 8px 12px;
    border-radius: 6px;
    font-family: Monaco, Menlo, monospace;
    font-size: 13px;
    color: var(--brand-primary);
    word-break: break-all;
}

.dns-token {
    font-size: 12px !important;
}

/* Mobile Responsive */
@media (width <= 768px) {
    .team-header-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .team-header-title {
        font-size: 24px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .settings-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    /* The invite code row should keep the Copy button to the right of
       the code, even on mobile, so it stays accessible without scrolling
       or wrapping below. */
    .settings-item.settings-item-invite {
        flex-direction: row;
        align-items: center;
        gap: 12px;
    }

    .settings-item.settings-item-invite .settings-item-info {
        flex: 1;
        min-width: 0;
    }

    .settings-item.settings-item-invite .code-block {
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        display: inline-block;
        vertical-align: middle;
    }

    .settings-item.settings-item-invite .btn-secondary {
        flex-shrink: 0;
    }

    .modal-container {
        max-width: 100%;
        margin: 0;
        border-radius: 12px 12px 0 0;
        max-height: 85vh;
    }

    .member-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .member-row {
        flex-wrap: wrap;
    }

    .member-info {
        flex-basis: 100%;
    }
}

/* ==================================
   UPGRADE PLAN MODAL
   ================================== */
.modal-wide {
    max-width: 820px;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

@media (width <= 768px) {
    .plans-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (width <= 480px) {
    .plans-grid {
        grid-template-columns: 1fr;
    }
}

.plan-card {
    border: 1px solid var(--border-light);
    border-radius: 10px;
    padding: 20px 16px;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    position: relative;
    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.plan-card:hover {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 12px rgb(212 175 55 / 10%);
}

.plan-current {
    border-color: var(--brand-primary);
    background: rgb(212 175 55 / 4%);
}

.plan-popular {
    border-color: var(--brand-primary);
    box-shadow: 0 4px 16px rgb(212 175 55 / 15%);
}

.plan-popular-badge {
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--brand-primary);
    color: white;
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 10px;
    white-space: nowrap;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.plan-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.plan-price {
    margin-bottom: 4px;
}

.plan-amount {
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.5px;
}

.plan-amount-custom {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-primary);
}

.plan-period {
    font-size: 13px;
    color: var(--text-tertiary);
    font-weight: 400;
}

.plan-seats {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-light);
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 16px;
    flex: 1;
}

.plan-feature {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 3px 0;
}

.plan-feature svg {
    color: #10b981;
    flex-shrink: 0;
}

.plan-cta {
    width: 100%;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.plan-cta-primary {
    background: var(--brand-primary);
    color: white;
}

.plan-cta-primary:hover {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.plan-cta-secondary {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border: 1px solid var(--border-light);
}

.plan-cta-secondary:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
}

.plan-cta-current {
    background: var(--bg-secondary);
    color: var(--text-tertiary);
    cursor: default;
}

.plan-cta-current:disabled {
    opacity: 0.6;
}
