/* ============================================================
   SUBSCRIPTION PAGE STYLES
   ============================================================ */

/* Page */
.sub-page {
    width: 100%;
}

.sub-header {
    margin-bottom: 28px;
}

.sub-title {
    font-size: 24px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px 0;
}

.sub-subtitle {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

/* Toast banners */
.sub-toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
    max-width: 380px;
}

.sub-toast-success { background: #ECFDF5; color: #10B981; border: 1px solid #A7F3D0; }
.sub-toast-neutral { background: #F9FAFB; color: #6B7280; border: 1px solid #E5E7EB; }
.sub-toast-error { background: #FEF2F2; color: #EF4444; border: 1px solid #FECACA; }

.sub-toast-close {
    margin-left: auto;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    font-size: 16px;
    padding: 0 2px;
    line-height: 1;
}

/* Current plan card */
.sub-current-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 20px 24px;
    margin-bottom: 32px;
}

.sub-current-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 16px;
}

.sub-current-label {
    font-size: 12px;
    font-weight: 500;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: block;
    margin-bottom: 4px;
}

.sub-current-tier {
    font-size: 20px;
    font-weight: 700;
    color: #111827;
    margin: 0;
}

.sub-status-badge {
    font-size: 12px;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 9999px;
}

.sub-status-badge--active { background: #ECFDF5; color: #10B981; }
.sub-status-badge--free { background: #EEF2FF; color: #6366F1; }
.sub-status-badge--pastdue { background: #FEF2F2; color: #EF4444; }
.sub-status-badge--cancelled { background: #F3F4F6; color: #6B7280; }
.sub-status-badge--expired { background: #FEF2F2; color: #EF4444; }

.sub-current-grid {
    display: flex;
    gap: 32px;
    padding: 16px 0;
    border-top: 1px solid #F3F4F6;
    border-bottom: 1px solid #F3F4F6;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.sub-current-stat {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sub-current-stat-label {
    font-size: 12px;
    color: #6B7280;
    font-weight: 500;
}

.sub-current-stat-value {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

.sub-current-stat-limit {
    font-size: 14px;
    font-weight: 400;
    color: #9CA3AF;
}

.sub-current-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.sub-portal-btn {
    padding: 8px 16px;
    background: #6366F1;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 150ms;
}

.sub-portal-btn:hover { background: #4F46E5; }

.sub-cancel-btn {
    padding: 8px 16px;
    background: transparent;
    color: #EF4444;
    border: 1px solid #FCA5A5;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 150ms;
}

.sub-cancel-btn:hover {
    background: #FEF2F2;
    border-color: #EF4444;
}

/* Plans grid */
.sub-plans-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 360px));
    justify-content: center;
    gap: 16px;
    align-items: start;
    margin-bottom: 48px;
}

@media (max-width: 600px) {
    .sub-plans-grid {
        grid-template-columns: 1fr;
    }
}

.sub-plan-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px 20px;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: box-shadow 150ms, border-color 150ms;
}

.sub-plan-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.sub-plan-card--popular {
    border-color: #6366F1;
    box-shadow: 0 0 0 1px #6366F1;
}

.sub-plan-card--current {
    border-color: #10B981;
    box-shadow: 0 0 0 1px #10B981;
}

.sub-popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: #6366F1;
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 12px;
    border-radius: 9999px;
    white-space: nowrap;
}

.sub-plan-header {
    margin-bottom: 16px;
}

.sub-plan-name {
    font-size: 16px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 4px 0;
}

.sub-plan-desc {
    font-size: 12px;
    color: #6B7280;
    margin: 0;
    line-height: 1.4;
}

.sub-plan-price {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-bottom: 4px;
}

.sub-plan-amount {
    font-size: 36px;
    font-weight: 800;
    color: #111827;
    line-height: 1;
}

.sub-plan-period {
    font-size: 13px;
    color: #6B7280;
    margin-left: 2px;
}

.sub-plan-employees {
    font-size: 12px;
    font-weight: 600;
    color: #6366F1;
    background: #EEF2FF;
    padding: 4px 10px;
    border-radius: 6px;
    display: inline-block;
    margin: 12px 0 16px;
}

.sub-plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 20px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.sub-plan-feature {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #374151;
}

.sub-plan-feature--excluded {
    color: #D1D5DB;
}

.sub-feature-check { color: #10B981; flex-shrink: 0; }
.sub-feature-x { color: #D1D5DB; flex-shrink: 0; }

.sub-plan-action { margin-top: auto; }

.sub-plan-btn {
    width: 100%;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms;
    border: none;
    text-align: center;
    text-decoration: none;
    display: block;
}

.sub-plan-btn--primary {
    background: #6366F1;
    color: white;
}

.sub-plan-btn--primary:hover { background: #4F46E5; }

.sub-plan-btn--outline {
    background: transparent;
    color: #374151;
    border: 1px solid #E5E7EB;
}

.sub-plan-btn--outline:hover {
    border-color: #6366F1;
    color: #6366F1;
}

.sub-plan-btn--current {
    background: #F3F4F6;
    color: #9CA3AF;
    cursor: not-allowed;
}

/* FAQ section */
.sub-faq {
    margin-bottom: 48px;
}

.sub-faq-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 20px 0;
}

.sub-faq-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
}

.sub-faq-item {
    border-bottom: 1px solid #F3F4F6;
    padding: 16px 20px;
}

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

.sub-faq-q {
    font-size: 14px;
    font-weight: 600;
    color: #111827;
    margin: 0 0 6px 0;
}

.sub-faq-a {
    font-size: 13px;
    color: #6B7280;
    margin: 0;
    line-height: 1.5;
}

/* Cancel / upgrade modals */
.sub-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
}

.sub-modal {
    background: #FFFFFF;
    border-radius: 16px;
    padding: 32px;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.sub-modal-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
}

.sub-modal-icon-danger { background: #FEF2F2; color: #EF4444; }
.sub-modal-icon-primary { background: #EEF2FF; color: #6366F1; }

.sub-modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 8px 0;
}

.sub-modal-body {
    font-size: 14px;
    color: #6B7280;
    margin: 0 0 24px 0;
    line-height: 1.5;
}

.sub-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* Skeleton loading */
.sub-skeleton-panel {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
}

.sk-block {
    background: #F3F4F6;
    border-radius: 6px;
    margin-bottom: 12px;
    animation: sk-pulse 1.5s ease-in-out infinite;
}

.sk-h3 { height: 28px; width: 60%; }
.sk-badge { height: 20px; width: 80px; border-radius: 9999px; }
.sk-line { height: 16px; width: 80%; }
.sk-bar { height: 8px; border-radius: 9999px; }
.sk-h4 { height: 24px; width: 40%; }

.sk-cards {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 360px));
    justify-content: center;
    gap: 16px;
    margin-top: 24px;
}

.sk-card-lg {
    background: #F3F4F6;
    border-radius: 12px;
    height: 320px;
    animation: sk-pulse 1.5s ease-in-out infinite;
}

@keyframes sk-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Error state */
.sub-error-state {
    text-align: center;
    padding: 48px 24px;
    color: #6B7280;
    font-size: 14px;
}

/* btn helpers used by modals */
.btn {
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: all 150ms;
}

.btn-primary { background: #6366F1; color: white; }
.btn-primary:hover { background: #4F46E5; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-outline { background: transparent; color: #374151; border: 1px solid #E5E7EB; }
.btn-outline:hover { border-color: #6366F1; color: #6366F1; }
.btn-outline:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-danger { background: #EF4444; color: white; }
.btn-danger:hover { background: #DC2626; }
.btn-danger:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-spinner {
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Mobile */
@media (max-width: 768px) {
    .sub-current-grid { gap: 16px; }
    .sub-modal-actions { flex-direction: column; }
    .sub-modal-actions .btn { width: 100%; justify-content: center; }
}

/* Invoice history */
.sub-invoices {
    margin-bottom: 48px;
}

.sub-invoices-title {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    margin: 0 0 20px 0;
}

.sub-invoices-card {
    background: #FFFFFF;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
}

.sub-invoices-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 48px 24px;
    color: #9CA3AF;
    font-size: 14px;
    text-align: center;
}

.sub-inv-skeleton {
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

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

.sub-inv-table thead tr {
    border-bottom: 1px solid #F3F4F6;
}

.sub-inv-table th {
    padding: 12px 16px;
    text-align: left;
    font-size: 11px;
    font-weight: 600;
    color: #6B7280;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.sub-inv-table tbody tr {
    border-bottom: 1px solid #F9FAFB;
    transition: background 100ms;
}

.sub-inv-table tbody tr:last-child { border-bottom: none; }

.sub-inv-table tbody tr:hover { background: #F9FAFB; }

.sub-inv-table td {
    padding: 14px 16px;
    color: #374151;
    vertical-align: middle;
}

.sub-inv-number {
    font-weight: 500;
    color: #111827 !important;
    font-family: monospace;
    font-size: 12px;
}

.sub-inv-period {
    color: #6B7280 !important;
}

.sub-inv-amount {
    font-weight: 600;
    color: #111827 !important;
}

.sub-inv-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 9999px;
    text-transform: capitalize;
}

.sub-inv-badge--paid { background: #ECFDF5; color: #10B981; }
.sub-inv-badge--open { background: #FEF3C7; color: #D97706; }
.sub-inv-badge--void { background: #F3F4F6; color: #9CA3AF; }
.sub-inv-badge--failed { background: #FEF2F2; color: #EF4444; }
.sub-inv-badge--draft { background: #F3F4F6; color: #6B7280; }

.sub-inv-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.sub-inv-link {
    font-size: 12px;
    font-weight: 500;
    color: #6366F1;
    text-decoration: none;
    padding: 3px 8px;
    border: 1px solid #E0E7FF;
    border-radius: 5px;
    transition: all 150ms;
}

.sub-inv-link:hover {
    background: #EEF2FF;
    border-color: #6366F1;
}

.sub-inv-more {
    padding: 12px 16px;
    border-top: 1px solid #F3F4F6;
    text-align: center;
}

.sub-inv-more-btn {
    background: none;
    border: none;
    color: #6366F1;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: background 150ms;
}

.sub-inv-more-btn:hover { background: #EEF2FF; }

@media (max-width: 768px) {
    .sub-inv-table th:nth-child(2),
    .sub-inv-table td:nth-child(2) { display: none; }
}

/* -- Seats: pending downgrade, and the upgrade's two ways to pay -- */
.sub-pending-downgrade {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--warn-soft);
    color: var(--text);
    font-size: 14px;
}

.sub-confirm-payment {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--warn-soft);
    color: var(--text);
    font-size: 14px;
}

.sub-confirm-payment p {
    flex: 1 1 240px;
    margin: 0;
}

.sub-confirm-payment .sub-portal-btn {
    text-decoration: none;
}

.sub-pay-options {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.sub-pay-option {
    display: grid;
    gap: 2px;
    text-align: left;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

.sub-pay-option--selected {
    border-color: var(--brand);
    background: var(--brand-faint);
}

.sub-pay-option:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.sub-pay-option-title {
    font-weight: 600;
}

.sub-pay-option-amount {
    font-size: 18px;
    font-weight: 600;
}

.sub-pay-option-note {
    font-size: 13px;
    color: var(--text-2);
}
