/**
 * Customer Portal Shared Styles
 *
 * @package TFS_Site_Manager
 * @since 2.0.0
 */

/* Layout */
.tfs-customer-portal-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* A grid item's min-width is its content's by default: one long value (a DKIM key) widened the whole page. */
.tfs-customer-portal-layout > * {
    min-width: 0;
}


/* Payment failed banner (TFS_SM_Payment_Banner): spans the whole layout, above sidebar and content */
.tfs-payment-banner {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 20px;
    padding: 14px 18px;
    border: 1px solid #f59e0b;
    border-left-width: 4px;
    border-radius: 6px;
    background: #fffbeb;
    color: #78350f;
    font-size: 14px;
    line-height: 1.5;
}

.tfs-payment-banner.is-offline {
    border-color: #dc2626;
    background: #fef2f2;
    color: #7f1d1d;
}

.tfs-payment-banner__text i {
    margin-right: 6px;
}

.tfs-payment-banner__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

/* Breadcrumb */
.tfs-breadcrumb {
    margin-bottom: 20px;
    padding: 12px 0;
    font-size: 14px;
    color: var(--color-text-muted);
}

/* Phase 13.6 — breadcrumb links neutral gray, NOT brand. */
.tfs-breadcrumb a {
    color: var(--w4l-breadcrumb-color, var(--color-text-muted));
    text-decoration: none;
}

.tfs-breadcrumb a:hover {
    color: var(--w4l-gray-700, var(--color-text-secondary));
    text-decoration: underline;
}

.tfs-breadcrumb .separator {
    margin: 0 8px;
    color: var(--color-text-subtle);
}

.tfs-breadcrumb .current {
    color: var(--color-text-default);
    font-weight: 500;
}

/* Headers */
.tfs-dashboard-header,
.tfs-sites-header,
.tfs-subscriptions-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.tfs-dashboard-header h1,
.tfs-sites-header h1,
.tfs-subscriptions-header h1 {
    margin: 0;
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text-default);
}

.tfs-dashboard-date {
    margin: 5px 0 0 0;
    font-size: 14px;
    color: var(--color-text-muted);
}

.tfs-admin-notice {
    margin: 5px 0 0 0;
    padding: 4px 12px;
    background: var(--color-bg-warning-subtle);
    color: var(--color-text-warning);
    font-size: 13px;
    border-radius: 4px;
    display: inline-block;
}

/* Status Badges */
.tfs-status-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    border-radius: 12px;
    letter-spacing: 0.5px;
}

.tfs-status-badge.status-active {
    background: var(--color-bg-success-subtle);
    color: var(--color-text-success);
}

.tfs-status-badge.status-inactive {
    background: var(--color-bg-danger-subtle);
    color: var(--color-text-danger);
}

.tfs-status-badge.status-maintenance {
    background: var(--color-bg-warning-subtle);
    color: var(--color-text-warning);
}

.tfs-status-badge.status-suspended {
    background: var(--color-border-default);
    color: #383d41;
}

/* Phase 12.8a — domain status chips on site cards. */
.tfs-status-badge.status-provisioning {
    background: var(--color-bg-warning-subtle);
    color: var(--color-text-warning);
}
.tfs-status-badge.status-failed {
    background: var(--color-bg-danger-subtle);
    color: var(--color-text-danger);
}
.tfs-domain-status-badge {
    margin-left: 6px;
    vertical-align: middle;
    font-size: 10px;
    padding: 2px 8px;
}

.tfs-status-badge.status-expired {
    background: var(--color-bg-danger-subtle);
    color: var(--color-text-danger);
}

/* Statistics Cards */
.tfs-dashboard-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 30px;
}

.tfs-stat-card {
    background: var(--w4l-surface, #ffffff);
    border: 1px solid var(--w4l-gray-200, var(--color-border-default));
    border-radius: var(--w4l-radius, 8px);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tfs-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Phase 13.5 — UNIFORM neutral-gray icon chip.
 *
 * Previously (13.4) we rotated brand/sky/cyan/teal per card. User
 * feedback: too noisy, looked unprofessional. Industry archetypes
 * (Linear, Vercel, Stripe) keep all icons MONOCHROME (gray-500 glyph
 * on gray-100 chip) and use the brand color only on intentional
 * accents — CTAs, active links, selected nav.
 *
 * If a future component wants a brand-tinted icon (e.g. "this site is
 * featured"), it adds `.is-active` or `.tfs-stat-icon--brand` and we
 * override per-component, never per nth-child. */
.tfs-stat-icon {
    font-size: 24px;
    color: var(--w4l-gray-500, var(--color-text-muted));
    background: var(--w4l-gray-100, var(--color-bg-surface-hover));
    width: 48px;
    height: 48px;
    border-radius: var(--w4l-radius-md, 12px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Optional brand-tinted variant — only when explicitly opted in. */
.tfs-stat-icon.is-active,
.tfs-stat-icon--brand {
    color: var(--w4l-brand-700, #b91c1c);
    background: var(--w4l-brand-50, #fef2f2);
}

.tfs-stat-content {
    flex: 1;
}

.tfs-stat-content h3 {
    margin: 0;
    font-size: 28px;
    font-weight: 700;
    color: var(--color-text-default);
}

.tfs-stat-content p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.tfs-account-status {
    font-size: 16px !important;
    text-transform: capitalize !important;
}

/* Action Cards */
.tfs-dashboard-actions {
    margin-bottom: 30px;
}

.tfs-dashboard-actions h2 {
    margin: 0 0 20px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-default);
}

.tfs-action-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.tfs-action-card {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-default);
    border-radius: 8px;
    padding: 24px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.tfs-action-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Phase 13.6 — action-card icon stays NEUTRAL; the action card is its
 * own visual unit, the icon decorates it but isn't the CTA. */
.tfs-action-card i {
    font-size: 36px;
    color: var(--w4l-gray-500, var(--color-text-muted));
    margin-bottom: 16px;
}

.tfs-action-card h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-default);
}

.tfs-action-card p {
    margin: 0 0 16px 0;
    font-size: 14px;
    color: var(--color-text-muted);
    line-height: 1.5;
}

.tfs-action-card select.tfs-site-selector {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--color-border-default);
    border-radius: 4px;
    font-size: 14px;
}

/* Buttons */
.tfs-btn {
    display: inline-block;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tfs-btn-primary {
    background: var(--w4l-brand);
    color: var(--color-text-inverse);
    border-color: var(--w4l-brand);
}

.tfs-btn-primary:hover {
    background: var(--w4l-brand-hover);
    border-color: var(--w4l-brand-hover);
    color: var(--color-text-inverse);
}

.tfs-btn-secondary {
    background: var(--color-action-filled-secondary);
    color: var(--color-action-filled-secondary-text);
    border-color: var(--color-action-filled-secondary);
}

.tfs-btn-secondary:hover {
    background: var(--color-action-filled-secondary-hover);
    border-color: var(--color-action-filled-secondary-hover);
    color: var(--color-action-filled-secondary-text);
}

.tfs-btn-outline {
    background: transparent;
    color: var(--color-action-filled-secondary);
    border-color: var(--color-action-filled-secondary);
}

.tfs-btn-outline:hover {
    background: var(--color-action-filled-secondary);
    color: var(--color-action-filled-secondary-text);
    border-color: var(--color-action-filled-secondary);
}

.tfs-subscription-cancel-btn.tfs-btn-outline,
.tfs-btn-outline.tfs-subscription-cancel-btn {
    color: var(--color-text-danger);
    border-color: var(--color-text-danger);
}

.tfs-subscription-cancel-btn.tfs-btn-outline:hover,
.tfs-btn-outline.tfs-subscription-cancel-btn:hover {
    background: var(--color-text-danger);
    border-color: var(--color-text-danger);
    color: var(--color-text-inverse);
}

.tfs-dashboard-wrapper a:not(.tfs-btn):not(.tfs-view-all),
.tfs-user-subscriptions-wrapper a:not(.tfs-btn),
.tfs-subscription-details-wrapper a:not(.tfs-btn),
.tfs-billing-wrapper a:not(.tfs-btn),
.tfs-my-sites-wrapper a:not(.tfs-btn),
.tfs-user-sites-wrapper a:not(.tfs-btn) {
    color: var(--color-text-link);
    text-decoration: none;
    transition: color 0.15s ease;
}

.tfs-dashboard-wrapper a:not(.tfs-btn):not(.tfs-view-all):hover,
.tfs-user-subscriptions-wrapper a:not(.tfs-btn):hover,
.tfs-subscription-details-wrapper a:not(.tfs-btn):hover,
.tfs-billing-wrapper a:not(.tfs-btn):hover,
.tfs-my-sites-wrapper a:not(.tfs-btn):hover,
.tfs-user-sites-wrapper a:not(.tfs-btn):hover {
    color: var(--color-text-link-hover);
    text-decoration: underline;
}

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

.tfs-btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

.tfs-btn.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Section Header with View All Link */
.tfs-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.tfs-section-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-default);
}

/* Phase 13.6 — "View all" inline link uses deep-crimson token (not the
 * bright CTA red) so it reads as a body link, not a button. */
.tfs-view-all {
    color: var(--w4l-link-color, #7f1d1d);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
}
.tfs-view-all:hover {
    color: var(--w4l-link-hover-color, #b91c1c);
    text-decoration: underline;
}

.tfs-view-all:hover {
    text-decoration: underline;
}

/* Empty State */
.tfs-empty-state {
    text-align: center;
    padding: 60px 20px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-default);
    border-radius: 8px;
}

.tfs-empty-state i {
    color: var(--color-text-subtle);
    margin-bottom: 20px;
}

.tfs-empty-state h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text-default);
}

.tfs-empty-state p {
    margin: 0 0 24px 0;
    font-size: 15px;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* Tablet Responsive */
@media (max-width: 1024px) {
    .tfs-dashboard-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .tfs-customer-portal-layout {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }

    .tfs-dashboard-header,
    .tfs-sites-header,
    .tfs-subscriptions-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 15px;
    }

    .tfs-dashboard-header h1,
    .tfs-sites-header h1,
    .tfs-subscriptions-header h1 {
        font-size: 24px;
    }

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

    .tfs-action-cards {
        grid-template-columns: 1fr;
    }

    .tfs-section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}

/* Dashboard: spacing above Active Subscriptions */
.tfs-dashboard-section-subscriptions {
    margin-top: 24px;
}

/* ── Billing History Page ─────────────────────────────────── */
.tfs-billing-wrapper {
    max-width: 900px;
}

.tfs-billing-header {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--color-border-default);
}

.tfs-billing-header h1 {
    margin: 0 0 4px;
    font-size: 1.5rem;
    color: var(--color-text-strong);
}

.tfs-billing-header p {
    margin: 0;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}

.tfs-billing-section {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-default);
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 24px;
}

.tfs-billing-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.tfs-billing-section-header h2 {
    margin: 0;
    font-size: 1.1rem;
    color: var(--color-text-strong);
}

.tfs-billing-section-header h2 i {
    margin-right: 8px;
    color: var(--color-text-secondary);
}

.tfs-billing-table {
    width: 100%;
    border-collapse: collapse;
}

.tfs-billing-table th {
    padding: 10px 12px;
    text-align: left;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--color-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 2px solid var(--color-border-default);
    background: var(--color-bg-surface-muted);
}

.tfs-billing-table td {
    padding: 12px;
    vertical-align: middle;
    border-bottom: 1px solid var(--color-bg-surface-muted);
    font-size: 0.9rem;
    color: var(--color-text-default);
}

.tfs-billing-table tr:last-child td {
    border-bottom: none;
}

.tfs-billing-actions {
    display: flex;
    gap: 6px;
}

@media (max-width: 640px) {
    .tfs-billing-table th,
    .tfs-billing-table td {
        padding: 8px;
        font-size: 0.8rem;
    }
    .tfs-billing-actions {
        flex-direction: column;
    }
}

/* DNS records that stopped working (views/partials/dns-problem-notice.php): dashboard, site page, Domain tab */
.tfs-dns-notice {
    margin: 0 0 20px;
    padding: 14px 18px;
    border: 1px solid #dc2626;
    border-left-width: 4px;
    border-radius: 6px;
    background: #fef2f2;
    color: #7f1d1d;
    font-size: 14px;
    line-height: 1.5;
}

.tfs-dns-notice p {
    margin: 0 0 8px;
}

.tfs-dns-notice__title i {
    margin-right: 6px;
}

.tfs-dns-notice__site {
    margin-left: 6px;
    opacity: 0.8;
}

.tfs-dns-notice__list,
.tfs-dns-notice__steps {
    margin: 0 0 12px 20px;
    padding: 0;
}

.tfs-dns-notice__list li,
.tfs-dns-notice__steps li {
    margin-bottom: 4px;
}

.tfs-dns-notice code {
    word-break: break-all;
}

.tfs-dns-notice .tfs-domain-dns-table {
    background: #ffffff;
    color: var(--color-text-default);
}
