/**
 * Pricing Page Specific Styles
 * Extends main styles.css with pricing-specific components
 */

/* ============================================
   Pricing Toggles
   ============================================ */

.pricing-tier-options {
    margin: var(--space-lg) 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.pricing-option-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-sm);
    background: var(--bg-secondary);
    border-radius: var(--radius-lg);
}

.pricing-option-toggle label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

.pricing-option-toggle input:checked + label {
    color: var(--primary);
}

/* Toggle Switch Styles */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--gray-300);
    transition: var(--transition-normal);
    border-radius: var(--radius-full);
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-normal);
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: var(--primary);
}

.toggle-switch input:focus + .toggle-slider {
    box-shadow: var(--focus-ring);
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* ============================================
   Pricing Display
   ============================================ */

.pricing-tier-price {
    text-align: center;
    margin: var(--space-lg) 0;
}

.pricing-tier-price-main {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: var(--space-xs);
}

.pricing-tier-price-currency {
    font-size: 1.5rem;
    color: var(--text-secondary);
}

.pricing-tier-price-period {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-left: var(--space-xs);
}

.pricing-tier-price-detail {
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: var(--space-xs);
}

.pricing-tier-savings {
    display: inline-block;
    margin-top: var(--space-sm);
    padding: var(--space-xs) var(--space-sm);
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
}

/* ============================================
   Usage Meter
   ============================================ */

.usage-section {
    padding: var(--space-2xl) 0;
    background: var(--bg-secondary);
}

.usage-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    max-width: 800px;
    margin: 0 auto;
}

.usage-meter {
    margin: var(--space-lg) 0;
}

.usage-meter-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: var(--space-sm);
}

.usage-meter-label {
    font-weight: 600;
    color: var(--text-primary);
}

.usage-meter-value {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.usage-meter-bar {
    width: 100%;
    height: 24px;
    background: var(--gray-200);
    border-radius: var(--radius-full);
    overflow: hidden;
    position: relative;
}

.usage-meter-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-light) 100%);
    border-radius: var(--radius-full);
    transition: width var(--transition-slow), background-color var(--transition-slow);
}

.usage-meter-fill.usage-warning {
    background: linear-gradient(90deg, var(--warning) 0%, #fbbf24 100%);
}

.usage-meter-fill.usage-critical {
    background: linear-gradient(90deg, var(--danger) 0%, #f87171 100%);
}

.usage-meter-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-700);
    pointer-events: none;
}

/* ============================================
   Usage Alerts
   ============================================ */

.usage-alert {
    margin-top: var(--space-lg);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    display: flex;
    align-items: start;
    gap: var(--space-md);
}

.usage-alert-warning {
    background: rgba(245, 158, 11, 0.1);
    border-left: 4px solid var(--warning);
}

.usage-alert-critical {
    background: rgba(239, 68, 68, 0.1);
    border-left: 4px solid var(--danger);
}

.usage-alert-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.usage-alert-content {
    flex: 1;
}

.usage-alert-title {
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.usage-alert-message {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.usage-alert-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
}

/* ============================================
   Subscription Info
   ============================================ */

.subscription-info {
    margin-top: var(--space-xl);
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
}

.subscription-info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--gray-200);
}

.subscription-info-row:last-child {
    border-bottom: none;
}

.subscription-info-label {
    font-weight: 500;
    color: var(--text-secondary);
}

.subscription-info-value {
    font-weight: 600;
    color: var(--text-primary);
}

.subscription-status-badge {
    display: inline-block;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--radius-sm);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.subscription-status-active {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
}

.subscription-status-expired {
    background: rgba(107, 114, 128, 0.1);
    color: var(--text-light);
}

/* ============================================
   Purchase History
   ============================================ */

.purchase-history {
    margin-top: var(--space-xl);
}

.purchase-history-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.purchase-history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.purchase-history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-md);
    transition: background-color var(--transition-fast);
}

.purchase-history-item:hover {
    background: var(--gray-200);
}

.purchase-history-item-details {
    flex: 1;
}

.purchase-history-item-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.purchase-history-item-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.purchase-history-item-amount {
    font-weight: 600;
    color: var(--text-primary);
}

.purchase-history-empty {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

/* ============================================
   Upgrade Modal
   ============================================ */

.upgrade-modal-content {
    text-align: center;
}

.upgrade-modal-icon {
    font-size: 3rem;
    margin-bottom: var(--space-md);
}

.upgrade-modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.upgrade-modal-message {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-xl);
}

.upgrade-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
}

.upgrade-option {
    padding: var(--space-lg);
    background: var(--bg-secondary);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.upgrade-option:hover {
    border-color: var(--primary);
    background: var(--bg-primary);
}

.upgrade-option:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--focus-ring);
}

.upgrade-option-name {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.upgrade-option-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
}

/* ============================================
   Loading States
   ============================================ */

.pricing-loading {
    text-align: center;
    padding: var(--space-2xl);
    color: var(--text-secondary);
}

.pricing-error {
    text-align: center;
    padding: var(--space-xl);
    background: rgba(239, 68, 68, 0.1);
    border-radius: var(--radius-md);
    margin: var(--space-lg) 0;
}

.pricing-error p {
    color: var(--danger);
    margin-bottom: var(--space-md);
}

/* ============================================
   Success Page
   ============================================ */

.success-hero {
    text-align: center;
    padding: var(--space-2xl) 0;
    background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
    color: white;
}

.success-icon {
    font-size: 4rem;
    margin-bottom: var(--space-lg);
    animation: successPulse 1s ease-out;
}

@keyframes successPulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.success-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
}

.success-message {
    font-size: 1.125rem;
    opacity: 0.9;
}

.success-details {
    max-width: 600px;
    margin: var(--space-2xl) auto;
    padding: 0 var(--space-lg);
}

.success-card {
    background: var(--bg-primary);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow-md);
    margin-bottom: var(--space-lg);
}

.success-card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text-primary);
}

.success-card-item {
    display: flex;
    justify-content: space-between;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--gray-200);
}

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

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

.success-card-value {
    font-weight: 600;
    color: var(--text-primary);
}

.success-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    margin-top: var(--space-xl);
}

/* ============================================
   Responsive
   ============================================ */

@media (max-width: 640px) {
    .pricing-tier-price-main {
        font-size: 2rem;
    }

    .upgrade-options {
        grid-template-columns: 1fr;
    }

    .usage-meter-header {
        flex-direction: column;
        align-items: start;
        gap: var(--space-xs);
    }

    .success-icon {
        font-size: 3rem;
    }

    .success-title {
        font-size: 1.5rem;
    }
}

/* ============================================
   Accessibility Enhancements
   ============================================ */

.sr-only-focusable:focus {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .usage-meter-bar {
        border: 2px solid currentColor;
    }

    .upgrade-option {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .usage-meter-fill,
    .toggle-slider,
    .toggle-slider:before,
    .upgrade-option {
        transition: none;
    }

    .success-icon {
        animation: none;
    }
}
