/* ============================================================
   Tela /tenants — CSS global (NÃO CSS isolation).
   Carregado via <link> em App.razor pra evitar issues de scope.
   Todas as classes .tn-* + variantes pra cards, toggles, dialogs.
   ============================================================ */

/* === Page header === */
.tenants-page .tn-page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.tenants-page .tn-page-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.tenants-page .tn-page-subtitle {
    font-size: 13px;
    color: #888;
    margin: 4px 0 0;
}

/* === Form "New tenant" colapsável === */
.tenants-page .tn-new-form-details {
    background: #fff;
    border: 1px solid #eee;
    border-radius: 10px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.tenants-page .tn-new-form-summary {
    cursor: pointer;
    padding: 12px 16px;
    font-size: 13px;
    font-weight: 600;
    color: #5c6bc0;
    list-style: none;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tenants-page .tn-new-form-summary::-webkit-details-marker { display: none; }

.tenants-page .tn-new-form-hint {
    font-size: 11px;
    font-weight: 400;
    color: #aaa;
}

.tenants-page .tn-new-form-body {
    padding: 12px 16px 16px;
    border-top: 1px solid #f0f0f0;
}

.tenants-page .tn-new-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
}

.tenants-page .tn-field--full { grid-column: 1 / -1; }

.tenants-page .tn-new-form-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

/* === Search bar === */
.tenants-page .tn-search {
    position: relative;
    margin-bottom: 16px;
}

.tenants-page .tn-search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: #bbb;
    font-size: 15px;
    pointer-events: none;
}

.tenants-page .tn-search-input {
    width: 100%;
    padding: 10px 12px 10px 38px;
    border: 1.5px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
    background: #fff;
    font-family: inherit;
}

.tenants-page .tn-search-input:focus { border-color: #5c6bc0; }

/* === Empty / loading state === */
.tenants-page .tn-empty {
    background: #fff;
    border: 1px dashed #ddd;
    border-radius: 10px;
    padding: 32px 16px;
    text-align: center;
    font-size: 13px;
    color: #888;
}

/* === Column header (espelha grid dos cards) === */
.tenants-page .tn-col-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px 70px 90px 80px 80px 80px 76px 76px;
    padding: 8px 16px;
    font-size: 10px;
    font-weight: 700;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    gap: 10px;
    align-items: center;
}

.tenants-page .tn-col-center { text-align: center; }

/* === Card === */
.tenants-page .tn-card {
    background: #fff;
    border-radius: 10px;
    padding: 14px 16px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 70px 70px 90px 80px 80px 80px 76px 76px;
    align-items: center;
    gap: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    border: 1px solid #eee;
    transition: opacity 0.2s, box-shadow 0.2s;
    margin-bottom: 6px;
}

.tenants-page .tn-card.inactive { opacity: 0.55; }

.tenants-page .tn-card-title-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tenants-page .tn-card-name {
    font-size: 14px;
    font-weight: 700;
    color: #1a1a2e;
}

.tenants-page .tn-card-subdomain {
    font-size: 12px;
    color: #5c6bc0;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
}

.tenants-page .tn-card-subdomain-suffix { color: #aaa; }

/* === Path labels === */
.tenants-page .tn-path {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-top: 2px;
    min-width: 0;
}

.tenants-page .tn-path-key {
    font-size: 10px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 54px;
    flex-shrink: 0;
}

.tenants-page .tn-path-value {
    font-size: 11px;
    color: #777;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* === Badge === */
.tn-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    background: #e8eaf6;
    color: #3949ab;
    letter-spacing: 0.02em;
}

.tn-badge.green {
    background: #e8f5e9;
    color: #2e7d32;
}

.tn-badge.tn-badge--danger {
    background: #ffebee;
    color: #c62828;
}

/* Tier badges — modalidade do produto entregue (PR product-tier).
   Cores conforme spec v3: SMB verde · Enterprise indigo · Mixed amber. */
.tn-badge.tn-tier-smb {
    background: #e8f5e9;
    color: #2e7d32;
}

.tn-badge.tn-tier-enterprise {
    background: #e8eaf6;
    color: #3949ab;
}

.tn-badge.tn-tier-mixed {
    background: #fff8e1;
    color: #b07000;
}

.tenants-page .tn-todas {
    font-size: 11px;
    color: #bbb;
}

/* === Toggle switch === */
.tenants-page .tn-toggle {
    display: inline-flex;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px 0;
}

.tenants-page .tn-toggle[disabled] { cursor: not-allowed; }

.tenants-page .tn-toggle-track {
    width: 36px;
    height: 20px;
    border-radius: 10px;
    position: relative;
    transition: background 0.2s;
}

.tenants-page .tn-toggle-track.on { background: #5c6bc0; }
.tenants-page .tn-toggle-track.off { background: #ccc; }
.tenants-page .tn-toggle-track.disabled { opacity: 0.5; }

.tenants-page .tn-toggle-thumb {
    width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #fff;
    position: absolute;
    top: 2px;
    transition: left 0.2s;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.tenants-page .tn-toggle-track.on .tn-toggle-thumb { left: 18px; }
.tenants-page .tn-toggle-track.off .tn-toggle-thumb { left: 2px; }

/* === Buttons (config + delete) === */
.tenants-page .tn-btn-config {
    padding: 6px 12px;
    border: 1.5px solid #ddd;
    border-radius: 6px;
    background: #fafafa;
    font-size: 11px;
    font-weight: 700;
    color: #555;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.15s;
    font-family: inherit;
    width: 100%;
}

.tenants-page .tn-btn-config:hover {
    border-color: #5c6bc0;
    color: #5c6bc0;
}

.tenants-page .tn-btn-delete {
    padding: 6px 12px;
    border: 1.5px solid #ffcdd2;
    border-radius: 6px;
    background: #fff5f5;
    font-size: 11px;
    font-weight: 700;
    color: #c62828;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    transition: all 0.15s;
    font-family: inherit;
    width: 100%;
}

.tenants-page .tn-btn-delete:hover {
    background: #e53935;
    color: #fff;
    border-color: #e53935;
}

/* === Form fields (compartilhado com modais) === */
.tn-field { margin-bottom: 16px; }

.tn-field-label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #555;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.tn-field-label-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.tn-field-label-row .tn-field-label { margin-bottom: 0; }

.tn-field-label code {
    background: #fff5f5;
    border: 1px solid #ffcdd2;
    padding: 1px 6px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    color: #c62828;
    font-weight: 700;
}

.tn-field-input,
.tn-field-textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
    font-family: inherit;
}

.tn-field-input:focus,
.tn-field-textarea:focus { border-color: #5c6bc0; }

.tn-field-input:disabled { background: #fafafa; cursor: not-allowed; }

.tn-field-textarea {
    resize: vertical;
    line-height: 1.6;
}

.mono {
    font-family: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace !important;
    font-size: 13px;
}

.tn-field-help {
    font-size: 11px;
    color: #aaa;
    margin-top: 3px;
    display: block;
    line-height: 1.5;
}

.tn-field-help code {
    background: #f5f5f5;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #c62828;
}

.tn-btn-save {
    padding: 9px 20px;
    border: none;
    border-radius: 7px;
    background: #5c6bc0;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(92, 107, 192, 0.3);
    font-family: inherit;
}

.tn-btn-save:disabled {
    background: #c5cae9;
    cursor: not-allowed;
    box-shadow: none;
}

/* === Dialog (TenantConfigDialog + TenantDeleteDialog) — comuns === */
.tn-modal-title-line {
    display: flex;
    align-items: center;
    gap: 10px;
}

.tn-modal-title-text {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

.tn-modal-subtitle {
    font-size: 13px;
    color: #888;
    margin-top: 4px;
}

.tn-modal-body {
    padding: 4px 0;
}

.tn-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    width: 100%;
}

.tn-divider {
    border-top: 1px dashed #e0e0e0;
    margin: 20px 0 16px;
    position: relative;
}

.tn-divider span {
    position: absolute;
    top: -10px;
    left: 12px;
    background: #fff;
    padding: 0 8px;
    font-size: 11px;
    color: #999;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tn-btn-cancel {
    padding: 9px 20px;
    border: 1.5px solid #ddd;
    border-radius: 7px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: #666;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s;
}

.tn-btn-cancel:hover:not(:disabled) { border-color: #999; }
.tn-btn-cancel:disabled { opacity: 0.5; cursor: not-allowed; }

/* === Delete dialog específicos === */
.tn-delete-title-line {
    display: flex;
    align-items: center;
    gap: 12px;
}

.tn-delete-icon {
    font-size: 28px;
    line-height: 1;
}

.tn-delete-title-text {
    font-size: 17px;
    font-weight: 700;
    color: #1a1a2e;
}

.tn-delete-body { padding: 4px 0; }

.tn-delete-warning {
    background: #ffebee;
    border: 1px solid #ffcdd2;
    color: #c62828;
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 16px;
}

.tn-delete-tenant { margin-bottom: 16px; }

.tn-delete-tenant-label {
    font-size: 11px;
    font-weight: 600;
    color: #555;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    display: block;
    margin-bottom: 6px;
}

.tn-delete-tenant-chips {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.tn-delete-tenant-name {
    font-size: 13px;
    color: #666;
}

.tn-delete-paths {
    background: #f5f5f5;
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 12px;
    color: #555;
    line-height: 1.5;
    margin-bottom: 16px;
}

.tn-delete-paths-list {
    list-style: none;
    padding: 0;
    margin: 6px 0 0;
}

.tn-delete-paths-list li { padding: 2px 0; }

.tn-delete-paths-list code {
    background: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    border: 1px solid #ddd;
    font-family: 'JetBrains Mono', 'Cascadia Code', monospace;
    font-size: 11px;
    color: #333;
}

.tn-btn-delete-confirm {
    padding: 9px 24px;
    border: none;
    border-radius: 7px;
    background: #e53935;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(229, 57, 53, 0.3);
    font-family: inherit;
}

.tn-btn-delete-confirm:disabled {
    background: #ef9a9a;
    cursor: not-allowed;
    box-shadow: none;
}
