* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    /* Colors */
    --primary-blue: #3b82f6;
    --primary-orange: #ff8c42;
    --status-active: #10b981;
    --status-paused: #f59e0b;
    --status-cancelled: #ef4444;
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --border-color: #e5e7eb;
    --text-primary: #111827;
    --text-secondary: #6b7280;

    /* Mobile-optimized spacing */
    --space-xs: 0.5rem;
    --space-sm: 0.75rem;
    --space-md: 1rem;
    --space-lg: 1.25rem;
    --space-xl: 1.5rem;

    /* Touch-friendly sizes */
    --touch-target: 48px;
    --button-height: 48px;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-full: 9999px;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 2px 4px 0 rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 12px 0 rgba(0, 0, 0, 0.15);
}

html {
    font-size: 16px;
}

body {
    font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI",
        sans-serif;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    padding-bottom: 2rem;
}

/* Header - Mobile First */
.header {
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-sm);
}

.header-content {
    display: flex;

    align-items: center;
}

.back-button {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-blue);
    text-decoration: none;
    font-size: 0.9375rem;
    font-weight: 500;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    min-height: var(--touch-target);
    touch-action: manipulation;
}

.back-button:active {
    background-color: var(--bg-secondary);
}

.user-profile {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: linear-gradient(
        135deg,
        var(--primary-blue),
        var(--primary-orange)
    );
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    touch-action: manipulation;
}

.user-profile:active {
    transform: scale(0.95);
}

/* Container - Mobile First */
.container {
    padding: 1rem;
    max-width: 100%;
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.25rem;
    margin-top: 0.5rem;
}

/* Card - Mobile Optimized */
.card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
}

.card-header {
    font-size: 0.6875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* Subscription Card - Mobile First */
.plan-name {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.plan-price {
    font-size: 1.125rem;
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.billing-date {
    font-size: 0.875rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.5;
}

/* Payment Info - Touch Optimized */
.payment-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-top: 1rem;
    min-height: var(--touch-target);
}

.card-icon {
    width: 44px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--primary-blue);
    color: white;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.625rem;
    flex-shrink: 0;
}

.card-number {
    font-size: 0.9375rem;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
}

.edit-icon {
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.5rem;
    margin: -0.5rem;
    touch-action: manipulation;
}

.edit-icon:active {
    color: var(--primary-blue);
    transform: scale(0.95);
}

/* Status Badge - Prominent */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: 0.875rem;
    font-weight: 600;
    margin-top: 1rem;
}

.status-badge.active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-badge.paused {
    background-color: #fef3c7;
    color: #92400e;
}

.status-badge.cancelled {
    background-color: #fee2e2;
    color: #991b1b;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background-color: currentColor;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* Buttons - Touch Optimized */
.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    text-decoration: none;
    transition: all 0.2s ease;
    min-height: var(--button-height);
    width: 100%;
    touch-action: manipulation;
    user-select: none;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background-color: var(--primary-blue);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    background-color: #2563eb;
    box-shadow: var(--shadow-sm);
}

.btn-warning {
    background-color: var(--status-paused);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-warning:active {
    background-color: #d97706;
    box-shadow: var(--shadow-sm);
}

.btn-success {
    background-color: var(--status-active);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-success:active {
    background-color: #059669;
    box-shadow: var(--shadow-sm);
}

.btn-secondary {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}

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

.btn-danger {
    background-color: transparent;
    border-color: var(--status-cancelled);
    color: var(--status-cancelled);
}

.btn-danger:active {
    background-color: #fef2f2;
}

/* Action Buttons */
.action-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.management-section {
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border-color);
}

.management-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Payment Method */
.payment-method-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    min-height: var(--touch-target);
}

.payment-method-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
}

.payment-method-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.payment-type {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text-primary);
}

.payment-expiry {
    font-size: 0.8125rem;
    color: var(--text-secondary);
}

.add-payment {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-blue);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.75rem;
    margin: -0.75rem;
    touch-action: manipulation;
}

.add-payment:active {
    opacity: 0.7;
}

/* Details Rows */
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
    gap: 1rem;
}

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

.detail-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    flex-shrink: 0;
}

.detail-value {
    font-size: 0.875rem;
    color: var(--text-primary);
    font-weight: 500;
    text-align: right;
    word-break: break-word;
}

.update-info {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-blue);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    padding: 0.75rem;
    margin-left: -0.75rem;
    touch-action: manipulation;
}

.update-info:active {
    opacity: 0.7;
}

/* Invoice Section */
.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.search-icon {
    width: 24px;
    height: 24px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 0.5rem;
    margin: -0.5rem;
    touch-action: manipulation;
}

.search-icon:active {
    color: var(--primary-blue);
}

/* Mobile Invoice Cards */
.invoice-card {
    background-color: var(--bg-secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 0.75rem;
}

.invoice-header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.invoice-date {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-primary);
}

.invoice-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #d1fae5;
    color: #065f46;
}

.invoice-details-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.invoice-plan {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.invoice-amount {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.view-all {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    color: var(--primary-blue);
    font-size: 0.9375rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1rem;
    padding: 0.75rem;
    touch-action: manipulation;
}

.view-all:active {
    opacity: 0.7;
}

.header_logo {
    width: 150px;
}
.header_logo img {
    width: 100%;
}
/* Footer */
.footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.5rem 1rem;
    margin-top: 2rem;
    font-size: 0.8125rem;
    color: var(--text-secondary);
    text-align: center;
    background-color: #FFFFFF;
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
}

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

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    padding: 0.5rem;
    touch-action: manipulation;
}

.footer-link:active {
    color: var(--primary-blue);
}

/* Modal - Mobile Full Screen */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    align-items: flex-end;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.modal.active {
    display: flex;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background-color: var(--bg-primary);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 1.5rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(100%);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    font-size: 1.375rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    line-height: 1.3;
}

.modal-body {
    font-size: 0.9375rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.modal-warning {
    background-color: #fef3c7;
    border-left: 4px solid var(--status-paused);
    padding: 1rem;
    border-radius: var(--radius-md);
    margin: 1rem 0;
    font-size: 0.875rem;
    color: #92400e;
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.pause-duration-select {
    margin: 1rem 0;
}

.pause-duration-select label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pause-duration-select select {
    width: 100%;
    padding: 0.875rem;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9375rem;
    font-family: inherit;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    min-height: var(--touch-target);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L6 6L11 1' stroke='%236B7280' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    padding-right: 3rem;
}

/* Toast - Mobile Optimized */
.toast {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    right: 1rem;
    background-color: var(--text-primary);
    color: white;
    padding: 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: none;
    align-items: center;
    gap: 0.75rem;
    animation: slideInUp 0.3s ease;
    z-index: 2000;
}

.toast.active {
    display: flex;
}

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(100px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.toast-icon {
    width: 28px;
    height: 28px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1rem;
    flex-shrink: 0;
}

.toast-icon.success {
    background-color: var(--status-active);
}

.toast-icon.error {
    background-color: var(--status-cancelled);
}

.toast-message {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.4;
}

/* Loading State */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.6;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 3px solid transparent;
    border-top-color: var(--primary-blue);
    border-radius: var(--radius-full);
    animation: spin 0.6s linear infinite;
}

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

/* Safe Area - iOS */
@supports (padding: max(0px)) {
    .header {
        padding-top: max(1rem, env(safe-area-inset-top));
    }

    .container {
        padding-left: max(1rem, env(safe-area-inset-left));
        padding-right: max(1rem, env(safe-area-inset-right));
    }

    .modal-content {
        padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    }

    body {
        padding-bottom: max(2rem, env(safe-area-inset-bottom));
    }
}

/* Desktop Adjustments */
@media (min-width: 768px) {
    .container {
        max-width: 640px;
        margin: 0 auto;
        padding: 2rem 1rem;
    }

    .modal-content {
        border-radius: var(--radius-lg);
        max-width: 500px;
        max-height: 80vh;
    }

    .modal {
        align-items: center;
    }

    .toast {
        left: auto;
        right: 2rem;
        bottom: 2rem;
        max-width: 400px;
    }

    .action-buttons {
        flex-direction: row;
    }

    .btn {
        width: auto;
        min-width: 160px;
    }
}
