/**
 * Payments PWA Styles
 *
 * Modern, responsive styles for the payments application.
 */

:root {
    --primary-color: #FF1493;
    --primary-hover: #E6127B;
    --secondary-color: #6c757d;
    --success-color: #28a745;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --light-bg: #f8f9fa;
    --border-color: #dee2e6;
    --text-color: #212529;
    --text-muted: #6c757d;
    --radius: 8px;
    --shadow: 0 2px 4px rgba(0,0,0,0.1);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.15);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background: var(--light-bg);
}

/* =================================================================
   App Container
   ================================================================= */

.payments-app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-content {
    flex: 1;
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* =================================================================
   Navigation
   ================================================================= */

.app-nav {
    background: white;
    box-shadow: var(--shadow);
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-brand a {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-links {
    display: flex;
    gap: 1rem;
}

.nav-link {
    background: none;
    border: none;
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--text-color);
    font-size: 1rem;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.nav-link:hover {
    color: var(--primary-color);
}

.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
}

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

.app-loading,
.plans-loading,
.manage-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* =================================================================
   Plans Page
   ================================================================= */

.plans-container {
    padding: 2rem 0;
}

.plans-container h1 {
    text-align: center;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.payment-method {
    text-align: center;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 0.9rem;
}

.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    margin-top: 2rem;
}

.plan-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    position: relative;
    transition: transform 0.2s, box-shadow 0.2s;
}

.plan-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.plan-card-popular {
    border: 2px solid var(--primary-color);
}

.plan-badge {
    position: absolute;
    top: -12px;
    right: 20px;
    background: var(--primary-color);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: bold;
}

.plan-name {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.plan-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
    min-height: 3rem;
}

.plan-price {
    display: flex;
    align-items: baseline;
    margin-bottom: 1.5rem;
}

.price-amount {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.price-interval {
    font-size: 1rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

.plan-features {
    list-style: none;
    margin-bottom: 1.5rem;
}

.plan-features li {
    padding: 0.5rem 0;
    color: var(--text-color);
}

.plan-button {
    width: 100%;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border: 2px solid var(--primary-color);
    background: white;
    color: var(--primary-color);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
}

.plan-button:hover {
    background: var(--primary-color);
    color: white;
}

.plan-button-popular {
    background: var(--primary-color);
    color: white;
}

.plan-button-popular:hover {
    background: var(--primary-hover);
}

/* =================================================================
   Checkout Page
   ================================================================= */

.checkout-container {
    max-width: 600px;
    margin: 0 auto;
    padding: 2rem 0;
}

.checkout-summary {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 1.5rem;
}

.checkout-summary h2 {
    margin-bottom: 0.5rem;
}

.checkout-description {
    color: var(--text-muted);
    margin-bottom: 1.5rem;
}

.checkout-price {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    padding: 1rem 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1rem;
}

.price-label {
    font-weight: 600;
}

.checkout-provider {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.checkout-error {
    background: #fee;
    border: 1px solid var(--danger-color);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.5rem;
    color: var(--danger-color);
}

.checkout-actions {
    display: flex;
    gap: 1rem;
    flex-direction: column;
    margin-bottom: 1.5rem;
}

.checkout-security {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.text-small {
    font-size: 0.8rem;
}

/* =================================================================
   Manage Subscription Page
   ================================================================= */

.manage-container {
    max-width: 800px;
    margin: 0 auto;
    padding: 2rem 0;
}

.manage-no-subscription {
    text-align: center;
    padding: 4rem 2rem;
}

.subscription-card {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.subscription-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.85rem;
    font-weight: 600;
}

.status-active {
    background: #d4edda;
    color: #155724;
}

.status-canceled {
    background: #f8d7da;
    color: #721c24;
}

.status-trialing {
    background: #d1ecf1;
    color: #0c5460;
}

.subscription-details {
    border-top: 1px solid var(--border-color);
    padding-top: 1rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-color);
}

.detail-label {
    font-weight: 600;
}

.detail-value {
    color: var(--text-muted);
}

.trial-notice,
.renewal-notice,
.cancel-notice {
    display: block;
    padding: 0.75rem;
    border-radius: var(--radius);
    margin-top: 1rem;
}

.trial-notice {
    background: #d1ecf1;
    color: #0c5460;
}

.renewal-notice {
    background: #d4edda;
    color: #155724;
}

.cancel-notice {
    background: #fff3cd;
    color: #856404;
}

.subscription-actions {
    margin-top: 1.5rem;
    display: flex;
    gap: 1rem;
}

/* =================================================================
   Transaction History
   ================================================================= */

.transaction-history {
    margin-top: 2rem;
}

.transactions-table {
    width: 100%;
    background: white;
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.transactions-table th,
.transactions-table td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.transactions-table th {
    background: var(--light-bg);
    font-weight: 600;
}

.transactions-table tbody tr:hover {
    background: var(--light-bg);
}

.status-success {
    color: var(--success-color);
    font-weight: 600;
}

.status-failed {
    color: var(--danger-color);
    font-weight: 600;
}

.status-pending {
    color: var(--warning-color);
    font-weight: 600;
}

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

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal-content {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    max-width: 500px;
    width: 90%;
    box-shadow: var(--shadow-lg);
}

.modal-content h2 {
    margin-bottom: 1rem;
}

.cancel-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

/* =================================================================
   Buttons
   ================================================================= */

.btn-primary,
.btn-secondary,
.btn-danger,
.btn-text {
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background: #5a6268;
}

.btn-danger {
    background: var(--danger-color);
    color: white;
}

.btn-danger:hover:not(:disabled) {
    background: #c82333;
}

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

.btn-text:hover {
    text-decoration: underline;
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-checkout {
    width: 100%;
}

/* =================================================================
   Footer
   ================================================================= */

.app-footer {
    text-align: center;
    padding: 2rem;
    background: white;
    border-top: 1px solid var(--border-color);
    margin-top: auto;
}

.app-footer p {
    margin: 0.5rem 0;
    color: var(--text-muted);
}

.app-footer a {
    color: var(--text-muted);
    text-decoration: none;
}

.app-footer a:hover {
    color: var(--primary-color);
}

.copyright {
    font-size: 0.85rem;
}

/* =================================================================
   Install Prompt
   ================================================================= */

.install-prompt {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.1);
    padding: 1rem;
    z-index: 999;
}

.install-prompt-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 600px;
    margin: 0 auto;
}

.btn-primary-small,
.btn-text-small {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
}

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

@media (max-width: 768px) {
    .app-nav {
        flex-direction: column;
        gap: 1rem;
    }

    .nav-links {
        width: 100%;
        justify-content: center;
    }

    .plans-grid {
        grid-template-columns: 1fr;
    }

    .app-content {
        padding: 1rem;
    }

    .subscription-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }

    .detail-row {
        flex-direction: column;
        gap: 0.25rem;
    }

    .install-prompt-content {
        flex-direction: column;
        gap: 0.5rem;
    }
}

@media (prefers-color-scheme: dark) {
    /* Dark mode support - optional */
    /* Uncomment to enable */
    /*
    :root {
        --light-bg: #1a1a1a;
        --text-color: #e0e0e0;
        --text-muted: #a0a0a0;
        --border-color: #333;
    }
    */
}
