/* ------------------------------------------------
   Global Utilities
   ------------------------------------------------ */
.hide {
    display: none !important;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ------------------------------------------------
   Layout Container
   ------------------------------------------------ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

.plan-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.plan-content {
    width: 100%;
}

#content {
    animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* ------------------------------------------------
   Loading Spinner
   ------------------------------------------------ */
.spinner-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    gap: 16px;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top-color: #006c64;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

    to {
        transform: rotate(360deg);
    }
}

/* ------------------------------------------------
   Back Button
   ------------------------------------------------ */
.back-button {
    display: flex;
    align-items: center;
    gap: .4rem;
    position: fixed;
    bottom: 12px;
    left: 12px;
    background: #006c64;
    color: #d1fae5;
    font-weight: 700;
    font-size: 14px;
    border-radius: 99px;
    padding: 1rem;
    text-decoration: none;
    z-index: 999999;
    transition: all 0.2s ease;
}

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

.back-button:hover svg path {
    stroke: #ededed;
}

.back-button:active {
    animation: pulse-click 180ms ease-out;
}

@keyframes pulse-click {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.25);
    }

    50% {
        transform: scale(0.92);
        box-shadow: 0 0 6px 4px rgba(255, 255, 255, 0.15);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.0);
    }
}

/* ------------------------------------------------
   Toast Notification System
   ------------------------------------------------ */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
}

.toast {
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    padding: 16px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    min-width: 320px;
    opacity: 0;
    transform: translateX(400px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-left: 4px solid #e2e8f0;
}

.toast-enter {
    opacity: 0;
    transform: translateX(400px);
}

.toast-show {
    opacity: 1;
    transform: translateX(0);
}

.toast-exit {
    opacity: 0;
    transform: translateX(400px);
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.toast-icon ion-icon {
    font-size: 20px;
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-message {
    font-size: 14px;
    line-height: 1.5;
    color: #1a202c;
    word-wrap: break-word;
}

.toast-close {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border: none;
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background-color 0.2s;
    color: #006760;
}

.toast-close:hover {
    background-color: #f1f5f9;
}

.toast-close ion-icon {
    font-size: 18px;
}

/* Toast Type Variants */
.toast-success {
    border-left-color: #198e67;
    background: linear-gradient(to right, #ecfdf5 0%, white 100%);
}

.toast-success .toast-icon {
    background: #d1fae5;
    color: #059669;
}

.toast-error {
    border-left-color: #ef4444;
    background: linear-gradient(to right, #fef2f2 0%, white 100%);
}

.toast-error .toast-icon {
    background: #fee2e2;
    color: #dc2626;
}

.toast-warning {
    border-left-color: #f59e0b;
    background: linear-gradient(to right, #fffbeb 0%, white 100%);
}

.toast-warning .toast-icon {
    background: #fef3c7;
    color: #d97706;
}

.toast-info {
    border-left-color: #006760;
    background: linear-gradient(to right, #eff6ff 0%, white 100%);
}

.toast-info .toast-icon {
    background: #dbeafe;
    color: #006760;
}

.toast-loading {
    border-left-color: #8b5cf6;
    background: linear-gradient(to right, #f5f3ff 0%, white 100%);
}

.toast-loading .toast-icon {
    background: #ede9fe;
    color: #7c3aed;
}

.toast-loading .toast-icon ion-icon {
    animation: spin 1s linear infinite;
}

/* ------------------------------------------------
   Alert Container (Legacy Support)
   ------------------------------------------------ */
.alert-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9998;
    max-width: 400px;
}

.alert {
    background: white;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: flex-start;
    gap: 12px;
    animation: slideIn 0.3s ease;
    border-left: 4px solid #e2e8f0;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }

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

.alert-info {
    border-left-color: #269e96;
    background: linear-gradient(to right, #eff6ff 0%, white 100%);
}

.alert-success {
    border-left-color: #006c64;
    background: linear-gradient(to right, #ecfdf5 0%, white 100%);
}

.alert-error {
    border-left-color: #ef4444;
    background: linear-gradient(to right, #fef2f2 0%, white 100%);
}

.alert-warning {
    border-left-color: #f59e0b;
    background: linear-gradient(to right, #fffbeb 0%, white 100%);
}

.close-btn {
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #006760;
    line-height: 1;
    padding: 0;
    margin-left: auto;
}

.close-btn:hover {
    color: #1a202c;
}

/* ------------------------------------------------
   Premium Subscription Status Card
   ------------------------------------------------ */
.subscription-status-card {
    background: linear-gradient(135deg, #006c64 0%, #005750 100%);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 40px;
    color: white;
    box-shadow: 0 20px 60px rgba(102, 126, 234, 0.3);
    position: relative;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.subscription-status-card::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    pointer-events: none;
}

.subscription-status-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 70px rgba(102, 126, 234, 0.4);
}

.subscription-status-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
    position: relative;
    z-index: 1;
}

.subscription-icon {
    width: 64px;
    height: 64px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.subscription-icon ion-icon {
    font-size: 32px;
    color: white;
}

.subscription-info {
    flex: 1;
    min-width: 0;
}

.subscription-title {
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.9;
    margin: 0 0 8px 0;
}

.subscription-plan-name {
    font-size: 28px;
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.status-badge {
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    backdrop-filter: blur(10px);
    white-space: nowrap;
}

.status-badge ion-icon {
    font-size: 18px;
}

.status-active {
    background: rgba(16, 185, 129, 0.2);
    color: #d1fae5;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-inactive {
    background: rgba(251, 191, 36, 0.2);
    color: #fef3c7;
    border: 1px solid rgba(251, 191, 36, 0.3);
}

.subscription-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    position: relative;
    z-index: 1;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.detail-item ion-icon {
    font-size: 24px;
    color: rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
}

.detail-item>div {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}

.detail-label {
    font-size: 12px;
    opacity: 0.8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 16px;
    font-weight: 600;
}

.expiry-warning {
    margin-top: 20px;
    padding: 16px;
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 12px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    z-index: 1;
}

.expiry-warning ion-icon {
    font-size: 24px;
    flex-shrink: 0;
}

/* ------------------------------------------------
   Page Header
   ------------------------------------------------ */
.header {
    text-align: center;
    margin-bottom: 48px;
}

.header h1 {
    font-size: 36px;
    font-weight: 700;
    margin: 0 0 12px 0;
    background: linear-gradient(135deg, #006c64 0%, #005750 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.subtitle {
    font-size: 14px;
    color: #006760;
    margin: 0;
}

/* ------------------------------------------------
   Plans Grid
   ------------------------------------------------ */
.plans-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 32px;
    margin-bottom: 40px;
}

/* ------------------------------------------------
   Plan Card
   ------------------------------------------------ */
.plan-card {
    background: white;
    border-radius: 20px;
    padding: 32px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 2px solid transparent;
}

.plan-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
}

.plan-card.featured {
    border-color: #006c64;
    position: relative;
    background: linear-gradient(to bottom, rgba(102, 126, 234, 0.05) 0%, white 100%);
}

.plan-card.featured::before {
    content: 'MOST POPULAR';
    position: absolute;
    top: -12px;
    right: 20px;
    background: linear-gradient(135deg, #006c64 0%, #005750 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.plan-header {
    text-align: center;
    margin-bottom: 32px;
}

.plan-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #006c64 0%, #005750 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
}

.plan-icon ion-icon {
    font-size: 28px;
    color: white;
}

.plan-name {
    font-size: 24px;
    font-weight: 700;
    margin: 0 0 12px 0;
    color: #1a202c;
}

.plan-price {
    display: flex;
    align-items: first baseline;
    justify-content: center;
    gap: .2rem;
    font-size: 36px;
    font-weight: 800;
    color: #006c64;
    margin: 8px 0;
}

.plan-price .currency {
    font-size: 18px;
    font-weight: 600;
    vertical-align: super;
}

.plan-price .price-value {
    font-size: 24px;
    font-weight: 600;
    vertical-align: super;
}

.plan-duration {
    font-size: 14px;
    color: #006760;
    margin: 0;
}

.plan-features {
    list-style: none;
    padding: 0;
    margin: 0 0 32px 0;
}

.plan-features li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 0;
    color: #475569;
    border-bottom: 1px solid #f1f5f9;
}

.plan-features li:last-child {
    border-bottom: none;
}

.plan-features ion-icon {
    font-size: 20px;
    color: #006c64;
    flex-shrink: 0;
}

.plan-features li span,
.feature-text {
    font-size: 14px;
}

/* ------------------------------------------------
   Plan Button
   ------------------------------------------------ */
.plan-button {
    width: 100%;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.plan-button ion-icon {
    font-size: 20px;
}

.plan-button.primary {
    background: linear-gradient(135deg, #006c64 0%, #005750 100%);
    color: white;
}

.plan-button.primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
}

.plan-button.secondary {
    background: #f1f5f9;
    color: #475569;
}

.plan-button.secondary:hover:not(:disabled) {
    background: #e2e8f0;
}

.plan-button.success {
    background: #167f5c;
    color: white;
    cursor: not-allowed;
}

.plan-button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* ------------------------------------------------
   Payment Modal
   ------------------------------------------------ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.modal-content {
    background: white;
    border-radius: 24px;
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideUp 0.3s ease;
}

@keyframes modalSlideUp {
    from {
        opacity: 0;
        transform: translateY(40px);
    }

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

.modal-header {
    padding: 32px 32px 24px;
    border-bottom: 1px solid #f1f5f9;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-header h2 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.modal-close {
    width: 36px;
    height: 36px;
    border: none;
    background: #f1f5f9;
    border-radius: 99px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: #006760;
    transition: all 0.2s;
    padding-bottom: .6rem;
}

.modal-close:hover {
    background: #e2e8f0;
    transform: scale(1.1);
}

.modal-body {
    padding: 32px;
}

/* ------------------------------------------------
   Payment Summary
   ------------------------------------------------ */
.payment-summary {
    text-align: center;
    margin-bottom: 32px;
    padding: 24px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    border-radius: 16px;
}

.payment-summary p {
    margin: 0 0 8px 0;
    color: #006760;
    font-size: 14px;
}

.payment-summary h3 {
    margin: 0 0 12px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1a202c;
}

.payment-summary .price {
    font-size: 32px;
    font-weight: 800;
    color: #006c64;
    margin: 0;
}

#modal-plan-price {
    font-size: 2rem;
}

/* ------------------------------------------------
   Form Elements
   ------------------------------------------------ */
.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #1a202c;
    margin-bottom: 8px;
}

.form-group label ion-icon {
    font-size: 18px;
    color: #006c64;
}

.form-input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 16px;
    transition: all 0.2s;
    box-sizing: border-box;
}

.form-input:focus {
    outline: none;
    border-color: #006c64;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-input.error {
    border-color: #ef4444;
}

.form-hint {
    display: block;
    margin-top: 6px;
    font-size: 12px;
    color: #006760;
}

.error-message {
    display: block;
    margin-top: 8px;
    font-size: 13px;
    color: #ef4444;
    font-weight: 500;
}

/* ------------------------------------------------
   Payment Info Box
   ------------------------------------------------ */
.payment-info {
    margin-bottom: 24px;
}

.info-box {
    padding: 16px;
    border-radius: 12px;
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.6;
}

.info-mpesa {
    background: #eff6ff;
    border: 1px solid #dbeafe;
    color: #006c64;
}

.info-box ion-icon {
    font-size: 24px;
    flex-shrink: 0;
    margin-top: 2px;
}

.info-box p {
    margin: 0;
}

.info-box strong {
    font-weight: 600;
}

.info-box ol {
    margin: 8px 0 0 0;
    padding-left: 20px;
}

.info-box li {
    margin: 4px 0;
}

/* ------------------------------------------------
   Responsive Design
   ------------------------------------------------ */
@media (max-width: 1024px) {
    .plans-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
        gap: 24px;
    }
}

@media (max-width: 768px) {
    .container {
        padding: 16px;
    }

    .plan-wrapper {
        padding: 20px 0;
    }

    .header h1 {
        font-size: 32px;
    }

    .subtitle {
        font-size: 16px;
    }

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

    .plan-card {
        padding: 24px;
    }

    .modal-content {
        margin: 0;
        border-radius: 20px;
    }

    .modal-header,
    .modal-body {
        padding: 24px;
    }

    .alert-container,
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }

    .toast {
        min-width: 0;
        width: 100%;
    }

    .subscription-status-card {
        padding: 24px;
        margin-bottom: 30px;
    }

    .subscription-status-header {
        flex-direction: column;
        text-align: center;
    }

    .subscription-icon {
        width: 56px;
        height: 56px;
    }

    .subscription-icon ion-icon {
        font-size: 28px;
    }

    .subscription-plan-name {
        font-size: 24px;
    }

    .subscription-details {
        grid-template-columns: 1fr;
    }

    .detail-item {
        padding: 14px;
    }
}

/* ------------------------------------------------
   Print Styles
   ------------------------------------------------ */
@media print {

    .toast-container,
    .modal,
    .alert-container,
    .back-button {
        display: none !important;
    }
}