/* ========================================
   MANAGE PLAN PAGE STYLES
   Standalone page - no SPA shell
   ======================================== */

/* Override body styles for standalone page */
body {
    background: #f8fafc;
    min-height: 100vh;
    padding: 0;
    margin: 0;
}

/* Loading Overlay */
.plan-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.plan-loading-content {
    text-align: center;
}

.plan-loading-content p {
    margin-top: 1rem;
    color: var(--text-light);
    font-size: 0.875rem;
}

/* Main Container */
.plan-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

/* Back Navigation */
.plan-back-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2rem;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-dark);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}

.back-button:hover {
    background: var(--bg-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: translateX(-4px);
}

.back-button svg {
    transition: transform 0.2s ease;
}

.back-button:hover svg {
    transform: translateX(-2px);
}

.clinic-name-display {
    font-size: 0.875rem;
    color: var(--text-light);
    font-weight: 500;
}

/* Header Section */
.plan-header {
    text-align: center;
    margin-bottom: 1.5rem;
}

.plan-header-content {
    max-width: 600px;
    margin: 0 auto;
}

.plan-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 0.75rem 0;
}

.plan-subtitle {
    font-size: 1.125rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.6;
}

/* Alert Messages */
.alert {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

.alert-success {
    background: #f0fdf4;
    border: 1px solid #86efac;
    color: #166534;
}

.alert-success svg {
    color: #22c55e;
}

.alert-warning {
    background: #fffbeb;
    border: 1px solid #fcd34d;
    color: #92400e;
}

.alert-warning svg {
    color: #f59e0b;
}

/* Current Plan Banner */
.current-plan-banner {
    background: #eff6ff;
    border: 1px solid #93c5fd;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 2rem;
    text-align: center;
}

.current-plan-info {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: #1e40af;
    font-size: 0.9375rem;
}

.current-plan-info svg {
    color: #2563eb;
    flex-shrink: 0;
}

.current-plan-info strong {
    font-weight: 600;
}

.plan-status {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.plan-status.active {
    background: rgba(34, 197, 94, 0.15);
    color: #15803d;
}

.plan-status.past_due {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
}

.plan-status.canceled {
    background: rgba(107, 114, 128, 0.15);
    color: #4b5563;
}

/* View Only Notice */
.view-only-notice {
    background: #fef3c7;
    border: 1px solid #fcd34d;
    border-radius: 12px;
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    color: #92400e;
    font-size: 0.875rem;
}

.view-only-notice svg {
    color: #d97706;
    flex-shrink: 0;
}

/* ========================================
   TAB NAVIGATION
   ======================================== */

.plan-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    background: white;
    padding: 0.5rem;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.5rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--text-light);
    font-size: 0.9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    background: var(--bg-light);
    color: var(--text-dark);
}

.tab-btn.active {
    background: var(--primary);
    color: white;
}

.tab-btn svg {
    flex-shrink: 0;
}

/* Tab Content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* ========================================
   PRICING GRID & CARDS
   ======================================== */

.pricing-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    margin-bottom: 3rem;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

@media (max-width: 1024px) {
    .pricing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

@media (max-width: 768px) {
    .pricing-grid {
        grid-template-columns: 1fr;
    }
    
    .plan-title {
        font-size: 2rem;
    }
    
    .plan-tabs {
        flex-direction: column;
    }
}

/* Pricing Card */
.pricing-card {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s ease;
}

.pricing-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

/* Popular Card */
.pricing-card.popular {
    border: 2px solid var(--primary);
    box-shadow: 0 8px 30px rgba(37, 99, 235, 0.15);
}

.pricing-card.popular:hover {
    box-shadow: 0 16px 50px rgba(37, 99, 235, 0.2);
}

.popular-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--primary);
    color: white;
    padding: 0.375rem 1.25rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Current Plan Card */
.pricing-card.current-plan {
    border: 2px solid var(--success);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.15);
}

/* Hide popular badge when it's the current plan */
.pricing-card.current-plan .popular-badge {
    display: none;
}

.pricing-card.current-plan::after {
    content: 'Current Plan';
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--success);
    color: white;
    padding: 0.375rem 1rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Card Header */
.card-header {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.tier-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
}

.tier-badge.essentials {
    background: rgba(107, 114, 128, 0.1);
    color: #4b5563;
}

.tier-badge.professional {
    background: rgba(37, 99, 235, 0.1);
    color: #2563eb;
}

.tier-badge.enterprise {
    background: rgba(139, 92, 246, 0.1);
    color: #7c3aed;
}

.tier-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-dark);
    margin: 0 0 0.5rem 0;
}

.tier-description {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.5;
}

/* Card Pricing */
.card-pricing {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
}

.price-amount {
    font-size: 3rem;
    font-weight: 700;
    color: var(--text-dark);
    line-height: 1;
}

.price-period {
    font-size: 1rem;
    color: var(--text-light);
    font-weight: 400;
}

/* Feature List */
.feature-list {
    list-style: none;
    padding: 0;
    margin: 0 0 2rem 0;
    flex: 1;
}

.feature-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    color: var(--text-dark);
}

.feature-item.included .feature-icon {
    color: var(--success);
    flex-shrink: 0;
    margin-top: 2px;
}

.feature-item.not-included {
    color: var(--text-light);
}

.feature-item.not-included .feature-icon {
    color: #d1d5db;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Card Footer */
.card-footer {
    margin-top: auto;
}

.plan-btn {
    width: 100%;
    padding: 0.875rem 1.5rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 10px;
    transition: all 0.2s ease;
    text-align: center;
    justify-content: center;
}

.plan-btn {
    background: var(--primary);
    color: white;
    border: none;
}

.plan-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(37, 99, 235, 0.3);
}

/* Current Plan Button */
.pricing-card.current-plan .plan-btn {
    background: var(--success);
    color: white;
    border: none;
    cursor: default;
    pointer-events: none;
}

/* Disabled state for receptionists */
.plan-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ========================================
   SECTION CARDS (Payment & Billing tabs)
   ======================================== */

.payment-section,
.billing-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.section-card {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 2rem;
}

.section-header {
    margin-bottom: 1.5rem;
}

.section-header h3 {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 0.5rem 0;
}

.section-header p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

/* No Payment / No Billing States */
.no-payment-method,
.no-billing-history {
    text-align: center;
    padding: 2rem;
    color: var(--text-light);
}

.no-payment-method svg,
.no-billing-history svg {
    color: #d1d5db;
    margin-bottom: 1rem;
}

.no-payment-method p,
.no-billing-history p {
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-dark);
    margin: 0 0 0.25rem 0;
}

.no-payment-method span,
.no-billing-history span {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Has Payment Method */
.has-payment-method {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.card-display {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.card-icon {
    width: 56px;
    height: 56px;
    background: var(--bg-light);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--primary);
}

.card-details {
    display: flex;
    flex-direction: column;
}

.card-brand {
    font-weight: 600;
    color: var(--text-dark);
}

.card-info {
    font-size: 0.875rem;
    color: var(--text-light);
}

/* Has Billing History */
.has-billing-history {
    text-align: center;
    padding: 1rem;
}

.billing-portal-note {
    color: var(--text-light);
    margin-bottom: 1rem;
}

/* ========================================
   FAQ SECTION
   ======================================== */

.faq-section {
    background: white;
    border-radius: 16px;
    border: 1px solid var(--border);
    padding: 2rem;
    margin-bottom: 2rem;
}

.faq-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 1.5rem 0;
    text-align: center;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
}

@media (max-width: 768px) {
    .faq-grid {
        grid-template-columns: 1fr;
    }
}

.faq-item h4 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-dark);
    margin: 0 0 0.5rem 0;
}

.faq-item p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
    line-height: 1.6;
}

/* Contact Section */
.contact-section {
    text-align: center;
    padding: 1.5rem;
}

.contact-section p {
    font-size: 0.875rem;
    color: var(--text-light);
    margin: 0;
}

.contact-section a {
    color: var(--primary);
    font-weight: 500;
    text-decoration: none;
}

.contact-section a:hover {
    text-decoration: underline;
}

/* Billing Portal CTA */
.billing-portal-cta {
    text-align: center;
    padding: 2rem;
}

.billing-portal-cta svg {
    color: var(--primary);
    margin-bottom: 1rem;
}

.billing-portal-cta p {
    color: var(--text-light);
    margin-bottom: 1.5rem;
    font-size: 0.9375rem;
}

#billingPortalBtn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.5rem;
}

#billingPortalBtn svg {
    color: white !important;
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

/* ========================================
   LOADING & ANIMATION STATES
   ======================================== */

/* Loading state for buttons */
.plan-btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.plan-btn.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.plan-btn:not(.btn-primary).loading::after {
    border: 2px solid rgba(37, 99, 235, 0.3);
    border-top-color: var(--primary);
}

/* Animation */
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Fade in animation for cards */
.pricing-card {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.pricing-card:nth-child(1) {
    animation-delay: 0.1s;
}

.pricing-card:nth-child(2) {
    animation-delay: 0.2s;
}

.pricing-card:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Tab content fade */
.tab-content {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}