/* Subscription page specific styles - imports handled by main.css */

/* Core Layout */
:root {
    --navbar-height: 60px;
    --viewport-height: 100vh;
    --container-padding: 1rem;
    --card-spacing: 1.5rem;
    --border-radius: 10px;
}

/* Body Base Styles */
body {
    font-family: 'Montserrat', sans-serif;
    background: transparent;
    color: var(--text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.6;
    transition: var(--theme-transition);
    min-height: 100vh;
}

/* Explicit dark theme styles */
[data-theme="dark"] body,
body[data-theme="dark"] {
    background-color: transparent;
    color: var(--text-primary);
}

/* Loading & Authentication States
   ---------------------------- */

/* Loading State */
body.is-loading {
    visibility: visible !important;
    opacity: 1 !important;
}

body.is-loading .auth-loading {
    display: flex !important;
}

/* Hide content during loading */
body.is-loading .main-content-wrapper,
body.is-loading .navbar {
    visibility: hidden !important;
    opacity: 0 !important;
    transition: none !important;
}

/* Once loaded, ensure visibility is restored */
body:not(.is-loading) .main-content-wrapper,
body:not(.is-loading) .navbar {
    visibility: visible !important;
    opacity: 1 !important;
    transition: opacity 0.3s ease !important;
}

/* User Menu */
.user-menu {
    position: relative;
}

.user-menu::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    height: 10px;
}

.user-menu-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    padding: 8px;
    transition: var(--theme-transition);
    border-radius: 6px;
}

.user-menu-toggle:hover {
    background-color: var(--hover-bg);
}

.user-menu-toggle i {
    font-size: 1.5rem;
}

.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    min-width: 220px;
    box-shadow: var(--card-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
    padding: 0;
    overflow: hidden;
}

.user-menu:hover .user-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.user-menu-header {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    background: none;
}

.user-menu-header i {
    font-size: 1.2rem;
    width: 20px;
    text-align: center;
    margin-right: 12px;
}

.user-menu-divider {
    height: 1px;
    background-color: var(--border-color);
    margin: 0;
}

.user-menu-item {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 12px 16px;
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    text-decoration: none;
    text-align: left;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.user-menu-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    margin-right: 12px;
    color: inherit;
}

.user-menu-item span {
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-menu-item:hover {
    background-color: var(--hover-bg);
    text-decoration: none;
}

.user-menu-item.danger {
    color: var(--danger-color);
}

.user-menu-item.danger:hover {
    background-color: var(--danger-color);
    color: var(--white);
}

/* Loading Indicator */
.auth-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--bg-color);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 9999;
    flex-direction: column;
    gap: 1.5rem;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--spinner-border-color);
    border-radius: 50%;
    border-top-color: var(--spinner-border-top-color);
    animation: spin 1s ease-in-out infinite;
}

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

}

/* Authentication States */
.auth-only {
    display: none !important;
}

.unauth-only {
    display: block !important;
}

body.is-authenticated .auth-only {
    display: block !important;
}

body.is-authenticated .unauth-only {
    display: none !important;
}

/* Inline elements need special handling */
a.auth-only,
button.auth-only,
span.auth-only,
.navbar-links a.auth-only {
    display: none !important;
}

a.unauth-only,
button.unauth-only,
span.unauth-only,
.navbar-links a.unauth-only {
    display: inline-block !important;
}

body.is-authenticated a.auth-only,

body.is-authenticated button.auth-only,
body.is-authenticated span.auth-only,
body.is-authenticated .navbar-links a.auth-only {
    display: inline-block !important;
}

body.is-authenticated a.unauth-only,
body.is-authenticated button.unauth-only,
body.is-authenticated span.unauth-only,
body.is-authenticated .navbar-links a.unauth-only {
    display: none !important;
}

/* Navigation
   ---------------------------- */

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--navbar-height);
    background: var(--navbar-bg);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    z-index: 1000;
    box-shadow: var(--navbar-shadow);
    transition: var(--theme-transition);
}

/* Explicit dark theme navbar */
[data-theme="dark"] .navbar,
body[data-theme="dark"] .navbar {
    background-color: var(--navbar-bg);
    border-bottom-color: var(--border-color);
}

.navbar-logo {
    display: flex;
    align-items: center;
    text-decoration: none;
}

.navbar-logo img {
    height: 30px;
}

.navbar-title {
    margin-left: 10px;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--navbar-text);
    background: var(--navbar-text);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

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

.navbar-links a {
    color: var(--navbar-text);
    text-decoration: none;
    font-weight: 500;
    padding: 0.5rem 0.75rem;
    border-radius: 6px;
    transition: var(--theme-transition);
}

.navbar-links a:hover {
    background: var(--hover-bg);
}

.navbar-links a.current {
    color: var(--primary-color);
    position: relative;
}

.navbar-links a.current::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--primary-color);
}

.navbar-links .button {
    padding: 0.5rem 1rem;
    background: transparent;
    border: 1px solid var(--border-color);
    color: var(--navbar-text);
    border-radius: 6px;
    transition: var(--theme-transition);
}

.navbar-links .button.primary {
    background: var(--primary-color);
    color: white;
    border: none;
}

.mobile-menu-button {
    display: none;
    background: transparent;
    border: none;
    color: var(--navbar-text);
    font-size: 1.5rem;
    cursor: pointer;
}

/* Theme Toggles
   ---------------------------- */

/* Theme Toggle Button */
.theme-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 8px;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    width: 36px;
    height: 36px;
    margin-left: 15px;
    flex-shrink: 0;
    overflow: visible;
}

.theme-toggle:hover {
    background: var(--card-hover);
    transform: translateY(-1px);
    box-shadow: var(--card-shadow-hover);
}

.theme-toggle:active {
    transform: translateY(0);
}

.theme-toggle i {
    font-size: 18px;
    color: var(--primary-color);
    position: absolute;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Theme Icons */
.theme-icon-light {
    color: var(--theme-icon-light-color);
    /* Light theme icon color */
    filter: var(--gold-glow);
}

.theme-icon-dark {
    color: var(--theme-icon-dark-color);
    /* Dark theme icon color */
    filter: var(--silver-glow);
}

/* Theme Icon Visibility */

[data-theme="light"] .theme-icon-light {
    display: block;
}

[data-theme="light"] .theme-icon-dark {
    display: none;
}

[data-theme="dark"] .theme-icon-light {
    display: none;
}

[data-theme="dark"] .theme-icon-dark {
    display: block;
}

/* Main Content
   ---------------------------- */

.main-content-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    padding-top: calc(var(--navbar-height) + var(--container-padding));
    padding-bottom: var(--container-padding);
    padding-left: 1rem;
    padding-right: 1rem;
    box-sizing: border-box;
    min-height: 100vh;
    background: transparent;
}

/* Pricing Components
   ---------------------------- */

.pricing-container {
    max-width: 1500px;
    margin: 2rem auto 4rem;
    padding: 0 1rem;
    width: 100%;
    box-sizing: border-box;
}

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

.pricing-header h1 {
    font-size: 2.5rem;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
    font-weight: 700;
}

.pricing-header p {
    color: var(--muted-text);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.6;
}

/* No Plans Available Message */
.no-plans-container {
    text-align: center;
    max-width: 600px;
    margin: 3rem auto;
    padding: 3rem 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    box-shadow: var(--card-shadow);
    transition: var(--theme-transition);
}

.no-plans-icon {
    font-size: 3.5rem;
    margin-bottom: 1.5rem;
    animation: float 3s ease-in-out infinite;
}

.no-plans-container h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
    background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.no-plans-container p {
    color: var(--muted-text);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.no-plans-container .button {
    display: inline-block;
    padding: 0.875rem 2rem;
    font-size: 1rem;
    font-weight: 600;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s ease;
}

@keyframes float {

    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Call to Action Text */
.cta-text {
    margin-top: 1.5rem;
    padding: 1rem;
    background-color: var(--primary-overlay-medium);
    border-radius: 8px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.cta-text p {
    color: var(--text-primary);
    font-size: 1.1rem;
    margin: 0;
}

.cta-text strong {
    color: var(--primary-color);
    font-weight: 600;
}

/* Billing Toggle */
.billing-toggle-container {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 2rem auto 3rem;
    padding: 0.5rem;
    background: var(--card-bg);
    border-radius: 30px;
    width: fit-content;
    border: 1px solid var(--border-color);
    position: relative;
    transition: all var(--transition-normal);
    box-shadow: var(--card-shadow);
}

.billing-toggle-container:hover {
    box-shadow: var(--shadow-md);
    transform: var(--scale-hover);
}

.toggle-label {
    margin-right: 1rem;
    font-weight: 500;
    color: var(--secondary-color);
}

.billing-option {
    padding: 0.75rem 2rem;
    cursor: pointer;
    border-radius: 25px;
    color: var(--text-primary);
    transition: all 0.3s ease;
    font-weight: 500;
}

.billing-option.active {
    background: var(--primary-color);
    color: white;
}

.savings-badge {
    position: absolute;
    top: -10px;
    right: -15px;
    background-color: var(--success-color);
    color: white;
    padding: 0.3rem 0.7rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    box-shadow: var(--elevation-low);
    display: none;
}

.savings-badge.yearly-only {
    display: block;
}

/* Pricing Grid and Cards */
.pricing-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin-top: 3rem;
    justify-content: center;
    width: 100%;
    max-width: 1500px;
    margin-left: none;
    margin-right: auto;
    box-sizing: border-box;
}

.pricing-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 2rem;
    position: relative;
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    transition: transform 0.3s, border-color 0.3s;
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* Recommended Plan Styling */
.recommended-plan {
    border: 2px solid var(--success-color);
    box-shadow: var(--plan-premium-glow);
    transform: scale(1.02);
    z-index: 1;
}

.recommended-badge {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--success-color);
    color: white;
    padding: 0.4rem 1.2rem;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--elevation-low);
}

.pricing-card:hover {
    transform: translateY(-5px);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.recommended-plan:hover {
    transform: translateY(-5px) scale(1.02);
}

.pricing-card .content {
    flex-grow: 1;
}

.plan-name {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
}

/* Price Display */
.price-display {
    margin: 2rem 0;
}

.price-amount {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--text-primary);
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
}

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

[data-theme="dark"] .price-amount.selected-price,
body.dark-theme .price-amount.selected-price {
    color: var(--price-selected-color);
}

/*For the dollar/currency character*/
.price-amount .currency {
    font-size: 1.5rem;
}

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

/* Features List */
.features-list {
    list-style: none;
    padding: 0;
    margin: 2rem 0;
}

.features-list li {
    color: var(--text-primary);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
}

[data-theme="dark"] .features-list li,
body.dark-theme .features-list li {
    color: var(--text-primary);
}

/* Badges and Indicators */
.trial-badge {
    position: relative;
    top: -5rem;
    right: -17.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--trial-badge-bg);
    border: 1px solid var(--trial-badge-border);
    border-radius: 12px;
    color: var(--trial-badge-text);
}

.trial-icon {
    font-size: 1.2rem;
}

.trial-text {
    font-weight: 600;
}

/* Hide the badge when the corresponding price is hidden */
.monthly-price[style*="display: none"] .current-plan-badge,
.yearly-price[style*="display: none"] .current-plan-badge {
    display: none !important;
}

/* Highlight the current active plan card */
.current-plan-product {
    position: relative;
    border: 2px solid var(--primary-color);
    background: var(--surface-elevated);
    box-shadow: var(--primary-shadow-subtle);
    transform: scale(1.02);
    transition: transform var(--transition-smooth), box-shadow var(--transition-normal);
}

/* Action Buttons */
.button-container {
    margin-top: auto;
    padding-top: 1.5rem;
    text-align: center;
}

/* Fix button alignment issues by ensuring all nested divs are properly centered */
.button-container>div {
    display: flex;
    justify-content: center;
    width: 100%;
}

.subscription-action-button {
    width: 100%;
    max-width: 90%;
    padding: 1rem;
    border: none;
    border-radius: 8px;
    background: var(--primary-color) !important;
    color: white !important;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.button-help-text {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    color: var(--secondary-color);
    text-align: center;
    line-height: 1.4;
    max-width: 90%;

    /* --- Fix centering alignment --- */
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Pulse animation for important buttons */
@keyframes pulse {
    0% {
        box-shadow: var(--pulse-start);
    }

    70% {
        box-shadow: var(--pulse-mid);
    }

    100% {
        box-shadow: var(--pulse-end);
    }
}

.pulse-button {
    animation: pulse 2s infinite;
}

.subscription-action-button:hover {
    background: var(--primary-hover) !important;
    transform: var(--hover-lift);
    box-shadow: var(--button-shadow-light);
    text-decoration: none;
    transition: all var(--transition-smooth);
}

.subscription-action-button:active {
    transform: var(--active-press);
    transition: transform 0.1s ease;
}

/* Enhanced pricing card interactions */
.pricing-card {
    transition: all var(--transition-smooth);
}

.pricing-card:hover {
    transform: var(--hover-lift);
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
}

.recommended-plan:hover {
    transform: var(--hover-lift) var(--scale-hover);
}

[data-theme="dark"] .subscription-action-button:hover,
body.dark-theme .subscription-action-button:hover {
    box-shadow: var(--button-shadow-dark);
}

.subscription-action-button:disabled {
    background: var(--disabled-button-bg) !important;
    color: var(--disabled-button-text) !important;
    border: 1px solid var(--disabled-button-border) !important;
    cursor: not-allowed;
    transform: none;
    box-shadow: none !important;
}

/* --- Pricing top: plan name + badges --- */
.pricing-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.pricing-top h2 {
    margin-bottom: 0;
}

/* --- Badges container --- */
.badges-container {
    display: flex;
    gap: var(--space-2);
    align-items: center;
    flex-wrap: wrap;
}

/* --- Single badge --- */
.badge {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(var(--space-1)) var(--space-2);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-semibold);
    border-radius: var(--radius-lg);
    line-height: 1;
    white-space: nowrap;
    box-shadow: var(--elevation-subtle);
    border: 1px solid transparent;
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

/*Badge Shining effect*/
.badge {
    position: relative;
    /* allow pseudo-element positioning */
    overflow: hidden;
    /* hide shine overflow */
}

.badge::after {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 200%;
    height: 100%;

    /* angled gradient for shine */
    background: linear-gradient(120deg,
            transparent 0%,
            rgba(255, 255, 255, 0.7) 50%,
            transparent 100%);

    transform: skewX(-20deg);
    animation: shine 3s infinite;
}

@keyframes shine {
    0% {
        left: -150%;
    }

    50% {
        left: 100%;
    }

    100% {
        left: 100%;
    }
}

/* Different badge stylings*/
/* Subtle/default badge: light background, primary text */
.badge--subtle {
    background-color: var(--primary-subtle);
    color: var(--primary-color);
    border-color: transparent;
}

/* Primary badge: solid primary color */
.badge--primary {
    background-color: var(--primary-color);
    color: var(--text-inverse);
    border-color: rgba(0, 0, 0, 0.04);
    box-shadow: var(--primary-shadow-subtle);
}

/* Gold badge */
.badge--gold {
    background-color: var(--gold-accent);
    color: var(--text-inverse);
    box-shadow: var(--plan-premium-glow);
    border-color: rgba(0, 0, 0, 0.03);
}

/* Silver badge */
.badge--silver {
    background-color: var(--silver-accent);
    color: var(--text-inverse);
    box-shadow: var(--silver-glow);
    border-color: rgba(0, 0, 0, 0.03);
}

/* Purple badge */
.badge--purple {
    background-color: #9b5de5;
    color: var(--text-inverse);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: var(--elevation-subtle);
}

/* Green badge */
.badge--green {
    background-color: #4caf50;
    color: var(--text-inverse);
    border-color: rgba(0, 0, 0, 0.1);
    box-shadow: var(--elevation-subtle);
}

/* Hover lift for badges (subtle) */
.badge:hover {
    transform: var(--scale-hover);
}

/* --- Previous-text: makes the "Everything from X, plus" pop --- */
.previous-text {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: var(--space-3);
    width: 100%;
    font-size: var(--font-size-lg);
    color: var(--text-secondary);
    background-color: var(--primary-light);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    box-shadow: var(--elevation-subtle);
}

.previous-text p {
    margin: 0;
}

/* Responsive tweaks: ensure badges don't overflow on small screens */
@media (max-width: 768px) {
    .pricing-top {
        gap: var(--space-3);
        flex-direction: column;
        align-items: flex-start;
    }

    .badges-container {
        width: 100%;
        gap: var(--space-2);
    }

    .badge {
        font-size: var(--font-size-sm);
        padding: calc(var(--space-1)) var(--space-2);
    }
}

/* Responsive Design
   ---------------------------- */

@media (min-width: 768px) and (max-width: 1024px) {
    .pricing-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 30px;
        max-width: 900px;
        margin: 0 auto;
        padding: 0 1rem;
    }

    .pricing-card {
        max-width: none;
        display: flex;
        flex-direction: column;
    }

    .pricing-card .content {
        flex: 1;
    }
}

@media (max-width: 900px) {
    .pricing-grid {
        grid-template-columns: repeat(auto-fit, minmax(300px, 400px));
        padding: 0 1rem;
    }
}

@media (max-width: 480px) {
    .pricing-container {
        padding: 0 0.5rem;
    }

    .pricing-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .pricing-card {
        padding: 1.25rem;
        display: flex;
        flex-direction: column;
        height: auto;
        min-height: 400px;
    }

    .pricing-card .content {
        flex: 1;
    }

    .pricing-header h1 {
        font-size: 1.75rem;
    }

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

    .trial-badge {
        padding: 0.5rem 0.75rem;
    }

    .trial-text {
        font-size: 0.875rem;
    }
}

/* Device Specific Fixes
   ---------------------------- */

/* Fix for iOS devices */
@supports (-webkit-touch-callout: none) {
    .subscription-action-button {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom));
    }
}

/* Fix bug with current-plan-badge display */
.pricing-card .price-amount {
    position: relative;
}