/**
 * SEPA.id Design System
 * Based on BankPay+ design tokens and components
 *
 * @version 2.0.0
 * @author INSTANTpay
 */

/* ========================================
   CSS Variables (Design Tokens)
   ======================================== */

:root {
    /* Color Palette with Better Accessibility */
    /* Primary Colors */
    --color-primary: 15, 52, 96;          /* Dark blue for main accents - meets WCAG AA */
    --color-primary-light: 37, 99, 235;   /* Blue-600 */
    --color-primary-dark: 23, 42, 78;     /* Darker blue for contrast elements */

    /* Secondary Colors */
    --color-secondary: 241, 245, 249;     /* Gray-100 */
    --color-secondary-light: 255, 255, 255; /* Pure white */
    --color-secondary-dark: 226, 232, 240; /* Gray-200 */

    /* Success, Warning, Error Colors with Better Accessibility */
    --color-success: 21, 128, 61;         /* Emerald-700 - better contrast */
    --color-success-light: 34, 197, 94;   /* Emerald-500 */
    --color-warning: 180, 83, 9;          /* Amber-700 */
    --color-warning-light: 245, 158, 11;  /* Amber-500 */
    --color-destructive: 185, 28, 28;     /* Red-600 */
    --color-destructive-light: 220, 38, 38; /* Red-500 */

    /* Neutral Colors */
    --color-foreground: 17, 24, 39;       /* Gray-900 */
    --color-foreground-light: 55, 65, 81; /* Gray-700 */
    --color-foreground-subtle: 107, 114, 128; /* Gray-500 */
    --color-background: 255, 255, 255;    /* White */
    --color-background-card: 255, 255, 255; /* White for cards */
    --color-background-muted: 249, 250, 251; /* Gray-50 */
    --color-input: 209, 213, 219;         /* Gray-300 - for input backgrounds */
    --color-border: 229, 231, 235;        /* Gray-200 */
    --color-border-strong: 209, 213, 219; /* Gray-300 */

    /* Public Pages - Improved Green/Cyan Theme */
    --gradient-public-start: 6, 95, 118;  /* Improved teal-700 - better contrast */
    --gradient-public-mid: 14, 132, 130;  /* Improved teal-600 */
    --gradient-public-end: 6, 163, 201;   /* Improved cyan-600 */

    /* PWA Pages - Improved Purple/Blue Theme */
    --gradient-pwa-start: 30, 64, 175;    /* Improved blue-700 */
    --gradient-pwa-mid: 99, 102, 241;     /* Improved indigo-500 */
    --gradient-pwa-end: 139, 92, 246;     /* Improved violet-500 */

    /* Footer Gradient */
    --footer-bg-start: 15, 23, 42;        /* Improved gray-950 */
    --footer-bg-mid: 30, 58, 138;         /* Improved blue-900 */
    --footer-bg-end: 88, 28, 135;         /* Improved purple-900 */

    /* Logo Colors (5-color palette) */
    --logo-color-1: 37, 99, 235;          /* blue-600 */
    --logo-color-2: 139, 92, 246;         /* violet-500 */
    --logo-color-3: 168, 85, 247;         /* purple-500 */
    --logo-color-4: 6, 182, 212;          /* cyan-500 */
    --logo-color-5: 29, 78, 216;          /* blue-700 */

    /* Spacing */
    --spacing-xs: 0.5rem;
    --spacing-sm: 1rem;
    --spacing-md: 1.5rem;
    --spacing-lg: 2rem;
    --spacing-xl: 3rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-base: 0.3s ease;
    --transition-slow: 0.5s ease;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);

    /* Z-index scale */
    --z-dropdown: 1000;
    --z-sticky: 1100;
    --z-fixed: 1200;
    --z-modal: 1300;
    --z-popover: 1400;
    --z-tooltip: 1500;
}

/* Fallbacks for older browsers that don't support CSS variables */
body {
    /* Set fallback values before applying CSS variables */
    --color-primary: 15, 52, 96;
    --color-foreground: 17, 24, 39;
    --color-background: 255, 255, 255;
    --color-success: 21, 128, 61;
    --color-warning: 180, 83, 9;
    --color-destructive: 185, 28, 28;
    --color-border: 229, 231, 235;

    /* Apply fallback colors if CSS variables aren't supported */
    color: #111827; /* Gray-900 */
    background-color: #ffffff; /* White */
}

/* ========================================
   Gradient Background Animations
   ======================================== */

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

@keyframes gradientPulse {
    0%, 100% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
}

@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-20px); }
}

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

/* Cross-browser compatible animations */
@keyframes spin {
    to { transform: rotate(360deg); }
}

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

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@-webkit-keyframes slideInFromTop {
    from {
        -webkit-transform: translateY(-100%);
        opacity: 0;
    }
    to {
        -webkit-transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@-webkit-keyframes slideInFromBottom {
    from {
        -webkit-transform: translateY(100%);
        opacity: 0;
    }
    to {
        -webkit-transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@-webkit-keyframes slideInFromLeft {
    from {
        -webkit-transform: translateX(-100%);
        opacity: 0;
    }
    to {
        -webkit-transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@-webkit-keyframes slideInFromRight {
    from {
        -webkit-transform: translateX(100%);
        opacity: 0;
    }
    to {
        -webkit-transform: translateX(0);
        opacity: 1;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@-webkit-keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@-webkit-keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@-webkit-keyframes scaleIn {
    from {
        -webkit-transform: scale(0.95);
        opacity: 0;
    }
    to {
        -webkit-transform: scale(1);
        opacity: 1;
    }
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

@-webkit-keyframes bounce {
    0%, 20%, 50%, 80%, 100% { -webkit-transform: translateY(0); }
    40% { -webkit-transform: translateY(-10px); }
    60% { -webkit-transform: translateY(-5px); }
}

/* ========================================
   Enhanced Animations and Transitions
   ======================================== */

/* Slide In Animations */
.slide-in-from-top {
    animation: slideInFromTop 0.3s ease-out forwards;
}

.slide-in-from-bottom {
    animation: slideInFromBottom 0.3s ease-out forwards;
}

.slide-in-from-left {
    animation: slideInFromLeft 0.3s ease-out forwards;
}

.slide-in-from-right {
    animation: slideInFromRight 0.3s ease-out forwards;
}

@keyframes slideInFromTop {
    from {
        transform: translateY(-100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes slideInFromLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

/* Fade Animations */
.fade-in {
    animation: fadeIn 0.3s ease-out forwards;
}

.fade-out {
    animation: fadeOut 0.3s ease-out forwards;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeOut {
    from { opacity: 1; }
    to { opacity: 0; }
}

/* Scale Animations */
.scale-in {
    animation: scaleIn 0.2s ease-out forwards;
}

@keyframes scaleIn {
    from {
        transform: scale(0.95);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* Bounce Animation */
.bounce {
    animation: bounce 1s infinite;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0); }
    40% { transform: translateY(-10px); }
    60% { transform: translateY(-5px); }
}

/* Hover animations for interactive elements */
.btn {
    transition: all var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.btn:active {
    transform: translateY(0);
}

/* Card hover animations */
.card {
    transition: all var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
}

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

/* Smooth transitions for form elements */
.form-input,
.form-select,
.form-textarea {
    transition: all var(--transition-fast) cubic-bezier(0.4, 0, 0.2, 1);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: rgb(var(--color-primary));
    box-shadow: 0 0 0 3px rgba(var(--color-primary), 0.2);
    transform: translateY(-1px);
}

/* Smooth transitions for all interactive elements */
.interactive {
    transition: all var(--transition-base) cubic-bezier(0.4, 0, 0.2, 1);
}

.interactive:hover {
    cursor: pointer;
}

/* ========================================
   Gradient Utilities
   ======================================== */

.gradient-bg-public {
    background: linear-gradient(135deg,
        rgb(var(--gradient-public-start)) 0%,
        rgb(var(--gradient-public-mid)) 50%,
        rgb(var(--gradient-public-end)) 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

.gradient-bg-pwa {
    background: linear-gradient(135deg,
        rgb(var(--gradient-pwa-start)) 0%,
        rgb(var(--gradient-pwa-mid)) 50%,
        rgb(var(--gradient-pwa-end)) 100%);
    background-size: 200% 200%;
    animation: gradientShift 15s ease infinite;
}

.gradient-bg-footer {
    background: linear-gradient(135deg,
        rgb(var(--footer-bg-start)) 0%,
        rgb(var(--footer-bg-mid)) 50%,
        rgb(var(--footer-bg-end)) 100%);
}

/* Header gradient (pricing section style) */
.gradient-header-public {
    background: linear-gradient(to right,
        rgb(var(--gradient-public-start)),
        rgb(var(--gradient-public-mid)));
}

.gradient-header-pwa {
    background: linear-gradient(to right,
        rgb(var(--gradient-pwa-start)),
        rgb(var(--gradient-pwa-end)));
}

/* ========================================
   Shared Header Layout
   ======================================== */

.page-header {
    background: rgb(var(--color-background));
    border-bottom: 1px solid rgba(var(--color-border), 0.4);
    box-shadow: var(--shadow-sm);
}

.page-header-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1.25rem 1.5rem;
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.logo-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
}

/* ========================================
   PWA Toolbar (Light Variant)
   ======================================== */

.pwa-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.pwa-toolbar-light {
    background: rgb(var(--color-background));
    padding: 1.5rem 1rem;
    border-bottom: 1px solid rgba(var(--color-border), 1);
    box-shadow: var(--shadow-sm);
}

.pwa-toolbar-back {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.25rem;
    transition: background 0.2s;
}

.pwa-toolbar-light .pwa-toolbar-back {
    background: rgb(var(--color-secondary));
    color: rgb(var(--color-foreground));
}

.pwa-toolbar-light .pwa-toolbar-back:hover {
    background: rgb(var(--color-secondary-dark));
}

.pwa-toolbar-title {
    font-size: 1.25rem;
    font-weight: 600;
    flex: 1;
    color: rgb(var(--color-foreground));
}

.pwa-toolbar-actions {
    display: flex;
    gap: 0.5rem;
}

.pwa-toolbar-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s;
}

.pwa-toolbar-light .pwa-toolbar-icon-btn {
    background: rgb(var(--color-secondary));
    color: rgb(var(--color-foreground));
}

.pwa-toolbar-light .pwa-toolbar-icon-btn:hover {
    background: rgb(var(--color-secondary-dark));
}

.pwa-toolbar-dark {
    padding: 1rem 1.25rem;
    background: rgba(var(--color-primary), 0.9);
    border-bottom: 1px solid rgba(var(--color-primary), 0.95);
    box-shadow: var(--shadow-sm);
    color: rgb(var(--color-secondary-light));
    backdrop-filter: blur(10px);
}

.pwa-toolbar-dark .pwa-toolbar-title {
    color: rgb(var(--color-secondary-light));
}

.pwa-toolbar-dark .pwa-toolbar-back,
.pwa-toolbar-dark .pwa-toolbar-icon-btn {
    background: rgba(var(--color-primary), 0.95);
    color: rgb(var(--color-secondary-light));
    border: 1px solid rgba(var(--color-foreground-subtle), 0.5);
}

.pwa-toolbar-dark .pwa-toolbar-back:hover,
.pwa-toolbar-dark .pwa-toolbar-icon-btn:hover {
    background: rgba(var(--color-primary-light), 0.85);
}

/* Generic page content container (horizontal padding + max width) */
.page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ========================================
   Gradient Text
   ======================================== */

.gradient-text {
    background: linear-gradient(135deg,
        rgb(var(--logo-color-1)),
        rgb(var(--logo-color-2)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-text-public {
    background: linear-gradient(135deg,
        rgb(var(--gradient-public-start)),
        rgb(var(--gradient-public-end)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.gradient-text-pwa {
    background: linear-gradient(135deg,
        rgb(var(--gradient-pwa-start)),
        rgb(var(--gradient-pwa-end)));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ========================================
   Card Components
   ======================================== */

.card {
    background: rgb(var(--color-background-card));
    border: 1px solid rgba(var(--color-border), 0.8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    overflow: hidden;
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

.card-header {
    padding: var(--spacing-lg) var(--spacing-xl);
    text-align: center;
    color: rgb(var(--color-foreground));
    background: rgba(var(--color-secondary), 0.5);
}

.card-body {
    padding: var(--spacing-xl);
}

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

.footer {
    position: relative;
    overflow: hidden;
    padding: var(--spacing-xl) 0;
}

.footer-content {
    position: relative;
    z-index: 10;
}

.footer-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.15;
    animation: float 20s ease-in-out infinite;
}

.footer-orb-1 {
    top: -50%;
    left: -10%;
    width: 400px;
    height: 400px;
    background: var(--logo-color-1);
    animation-delay: 0s;
}

.footer-orb-2 {
    bottom: -30%;
    right: 10%;
    width: 300px;
    height: 300px;
    background: var(--logo-color-2);
    animation-delay: 5s;
}

.footer-orb-3 {
    top: 50%;
    right: -5%;
    width: 250px;
    height: 250px;
    background: var(--logo-color-4);
    animation-delay: 10s;
}

/* ========================================
   Badge Components
   ======================================== */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.875rem;
    font-weight: 500;
    transition: transform var(--transition-fast);
}

.badge:hover {
    transform: scale(1.05);
}

.badge-primary {
    background: linear-gradient(135deg,
        rgb(var(--gradient-public-start)),
        rgb(var(--gradient-public-end)));
    color: rgb(var(--color-secondary-light));
}

.badge-secondary {
    background: rgba(var(--color-background), 0.1);
    color: rgb(var(--color-secondary-light));
    border: 1px solid rgba(var(--color-background), 0.2);
}

.badge-success {
    background: rgba(var(--color-success), 0.1);
    color: rgb(var(--color-success));
    border: 1px solid rgba(var(--color-success), 0.3);
}

.badge-warning {
    background: rgba(var(--color-warning), 0.1);
    color: rgb(var(--color-warning));
    border: 1px solid rgba(var(--color-warning), 0.3);
}

.badge-destructive {
    background: rgba(var(--color-destructive), 0.1);
    color: rgb(var(--color-destructive));
    border: 1px solid rgba(var(--color-destructive), 0.3);
}

/* ========================================
   Utility Classes
   ======================================== */

.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mx-auto { margin-left: auto; margin-right: auto; }
.max-w-600 { max-width: 600px; }
.underline { text-decoration: underline; }

.text-muted { color: rgb(var(--color-foreground-subtle)); }
.text-inverse { color: rgb(var(--color-secondary-light)); }

.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 2rem; }

.text-foreground { color: rgb(var(--color-foreground)); }
.text-foreground-light { color: rgb(var(--color-foreground-light)); }
.text-background { color: rgb(var(--color-background)); }
.text-primary { color: rgb(var(--color-primary)); }
.text-primary-light { color: rgb(var(--color-primary-light)); }
.text-success { color: rgb(var(--color-success)); }
.text-success-light { color: rgb(var(--color-success-light)); }
.text-warning { color: rgb(var(--color-warning)); }
.text-warning-light { color: rgb(var(--color-warning-light)); }
.text-destructive { color: rgb(var(--color-destructive)); }
.text-destructive-light { color: rgb(var(--color-destructive-light)); }

.mt-1 { margin-top: var(--spacing-xs); }
.mt-2 { margin-top: var(--spacing-sm); }
.mt-3 { margin-top: var(--spacing-md); }
.mt-4 { margin-top: var(--spacing-lg); }
.mt-5 { margin-top: var(--spacing-xl); }

.mb-1 { margin-bottom: var(--spacing-xs); }
.mb-2 { margin-bottom: var(--spacing-sm); }
.mb-3 { margin-bottom: var(--spacing-md); }
.mb-4 { margin-bottom: var(--spacing-lg); }
.mb-5 { margin-bottom: var(--spacing-xl); }

.p-1 { padding: var(--spacing-xs); }
.p-2 { padding: var(--spacing-sm); }
.p-3 { padding: var(--spacing-md); }
.p-4 { padding: var(--spacing-lg); }
.p-5 { padding: var(--spacing-xl); }

.rounded { border-radius: var(--radius-md); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-xl { border-radius: var(--radius-xl); }

.shadow-sm { box-shadow: var(--shadow-sm); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }
.shadow-xl { box-shadow: var(--shadow-xl); }

/* Background utilities */
.bg-background { background-color: rgb(var(--color-background)); }
.bg-card { background-color: rgb(var(--color-background-card)); }
.bg-muted { background-color: rgb(var(--color-background-muted)); }
.bg-primary { background-color: rgb(var(--color-primary)); }
.bg-primary-light { background-color: rgb(var(--color-primary-light)); }
.bg-success { background-color: rgb(var(--color-success)); }
.bg-success-light { background-color: rgb(var(--color-success-light)); }
.bg-warning { background-color: rgb(var(--color-warning)); }
.bg-warning-light { background-color: rgb(var(--color-warning-light)); }
.bg-destructive { background-color: rgb(var(--color-destructive)); }
.bg-destructive-light { background-color: rgb(var(--color-destructive-light)); }

/* Status and Feedback Indicators */
.status-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition-fast);
}

.status-success {
    background: rgba(var(--color-success), 0.1);
    color: rgb(var(--color-success));
    border: 1px solid rgba(var(--color-success), 0.3);
}

.status-error {
    background: rgba(var(--color-destructive), 0.1);
    color: rgb(var(--color-destructive));
    border: 1px solid rgba(var(--color-destructive), 0.3);
}

.status-warning {
    background: rgba(var(--color-warning), 0.1);
    color: rgb(var(--color-warning));
    border: 1px solid rgba(var(--color-warning), 0.3);
}

.status-info {
    background: rgba(var(--color-primary), 0.1);
    color: rgb(var(--color-primary));
    border: 1px solid rgba(var(--color-primary), 0.3);
}

/* Loading States */
.loading-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(var(--color-foreground-subtle), 0.3);
    border-top-color: rgb(var(--color-primary));
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--color-background), 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
}

.loading-spinner-lg {
    width: 3rem;
    height: 3rem;
    border-width: 3px;
}

/* Pulse Animation for Notifications */
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

.pulse-success {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background-color: rgba(var(--color-success), 0.15);
}

.pulse-warning {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background-color: rgba(var(--color-warning), 0.15);
}

.pulse-error {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
    background-color: rgba(var(--color-destructive), 0.15);
}

/* Toast Notifications */
.toast {
    min-width: 300px;
    max-width: 500px;
    padding: 1rem;
    border-radius: calc(var(--radius) - 2px);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    position: relative;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s, transform 0.3s;
    z-index: var(--z-tooltip);
}

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

.toast-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--color-foreground), 0.1);
    color: rgb(var(--color-foreground));
    border: none;
    cursor: pointer;
    transition: background 0.2s;
}

.toast-close:hover {
    background: rgba(var(--color-foreground), 0.2);
}

.toast-success { background: rgba(var(--color-success), 0.1); border-left: 4px solid rgb(var(--color-success)); }
.toast-error { background: rgba(var(--color-destructive), 0.1); border-left: 4px solid rgb(var(--color-destructive)); }
.toast-warning { background: rgba(var(--color-warning), 0.1); border-left: 4px solid rgb(var(--color-warning)); }
.toast-info { background: rgba(var(--color-primary), 0.1); border-left: 4px solid rgb(var(--color-primary)); }

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

/* Set spacing specifically for different screen sizes */
@media (max-width: 768px) {
    .page-container {
        padding: 0 1rem; /* Less padding on smaller screens */
    }

    .card-header {
        padding: var(--spacing-md) var(--spacing-lg);
    }

    .card-body {
        padding: var(--spacing-lg);
    }

    /* Stack form actions vertically on mobile */
    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        margin-bottom: 0.5rem;
    }

    .form-actions .btn:last-child {
        margin-bottom: 0;
    }

    /* Adjust features grid for mobile */
    .features-grid {
        grid-template-columns: 1fr; /* Single column on mobile */
        gap: 1.5rem;
    }

    /* Ensure buttons are full width on mobile */
    .btn {
        width: 100%;
    }

    /* Adjust header for mobile */
    .header-content {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }

    .user-menu {
        width: 100%;
        justify-content: center;
    }

    /* Ensure inputs are fully visible on mobile */
    input, select, textarea {
        font-size: 16px; /* Prevents zooming on iOS */
    }
}

/* Tablet styles */
@media (min-width: 768px) and (max-width: 1023px) {
    .page-container {
        padding: 0 2rem;
    }
}

/* Desktop styles */
@media (min-width: 1024px) {
    .page-container {
        padding: 0 3rem;
    }

    .features-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

/* Large desktop */
@media (min-width: 1280px) {
    .page-container {
        max-width: 1400px;
        padding: 0 4rem;
    }
}

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

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    /* Prevent animations for users who prefer reduced motion */
    .card,
    .btn,
    .form-input {
        transition: none;
    }
}

/* Focus styles - ensure visible focus indicators for accessibility */
:focus-visible {
    outline: 2px solid rgb(var(--color-primary-light));
    outline-offset: 2px;
    border-radius: calc(var(--radius) - 2px);
}

/* Alternative focus style for elements that already have borders */
.btn:focus-visible,
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    outline: 2px solid rgb(var(--color-primary-light));
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(var(--color-primary), 0.2);
}

/* Ensure sufficient color contrast and accessibility for all users */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Skip to main content for screen reader users */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: rgb(var(--color-primary));
    color: rgb(var(--color-secondary-light));
    padding: 8px;
    text-decoration: none;
    border-radius: calc(var(--radius) - 2px);
    z-index: var(--z-tooltip);
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Better contrast for interactive elements */
.btn-primary {
    background: rgb(var(--color-primary));
    color: rgb(var(--color-secondary-light));
    /* Ensure good contrast ratio */
}

.btn-primary:hover {
    background: rgb(var(--color-primary-dark));
}

/* Accessible form elements */
.form-input,
.form-select,
.form-textarea {
    min-height: 44px; /* Minimum touch target size */
    padding: 0.75rem 1rem;
}

/* Accessible error states */
.form-group.has-error input,
.form-group.has-error select,
.form-group.has-error textarea {
    border-color: rgb(var(--color-destructive));
    box-shadow: 0 0 0 3px rgba(var(--color-destructive), 0.2);
}

/* Accessible status indicators */
.status-indicator[role="status"] {
    /* Ensure proper announcement to screen readers */
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
}

/* Accessible toast notifications */
.toast {
    /* Ensure sufficient contrast for all toast types */
    min-height: 56px; /* Minimum touch target for dismissal */
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem;
    border-radius: calc(var(--radius) - 2px);
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.3s ease-out;
}

.toast-close {
    width: 36px;
    height: 36px;
    min-width: 36px; /* Ensure minimum touch target */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(var(--color-foreground), 0.1);
    color: rgb(var(--color-foreground));
    border: none;
    cursor: pointer;
    transition: background 0.2s;
    font-size: 1.25rem;
    line-height: 1;
}

.toast-close:hover {
    background: rgba(var(--color-foreground), 0.2);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        /* Increase contrast for high contrast mode */
        --color-foreground: 0, 0, 0; /* Black */
        --color-background: 255, 255, 255; /* White */
        --color-border: 0, 0, 0; /* Black */
    }

    .btn-primary {
        background: rgb(0, 0, 0); /* Black background */
        color: rgb(255, 255, 255); /* White text */
    }

    .form-input,
    .form-select,
    .form-textarea {
        border: 2px solid rgb(0, 0, 0); /* Thicker border for visibility */
    }
}

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

.skeleton {
    background: linear-gradient(90deg, rgba(var(--color-background), 0.8) 25%, rgba(var(--color-border), 0.4) 50%, rgba(var(--color-background), 0.8) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: var(--radius-sm);
    position: relative;
    overflow: hidden;
}

@keyframes skeleton-loading {
    0% { background-position: 200% 0%; }
    100% { background-position: -200% 0%; }
}

/* Skeleton variations */
.skeleton-text {
    height: 1rem;
    width: 100%;
    margin-bottom: 0.5rem;
}

.skeleton-text-line {
    height: 1rem;
    width: 70%;
    margin-bottom: 0.5rem;
}

.skeleton-text-line.short {
    width: 40%;
}

.skeleton-text-line.long {
    width: 90%;
}

.skeleton-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
}

.skeleton-button {
    height: 2.5rem;
    min-width: 8rem;
    border-radius: var(--radius-sm);
}

.skeleton-card {
    height: 20rem;
    border-radius: var(--radius-md);
}

.skeleton-image {
    width: 100%;
    height: 12rem;
    border-radius: var(--radius-sm);
}

/* ========================================
   Empty States
   ======================================== */

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 3rem 1.5rem;
    border-radius: var(--radius-lg);
    background: rgba(var(--color-secondary), 0.3);
    min-height: 300px;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    margin-bottom: 1.5rem;
    color: rgb(var(--color-foreground-subtle));
}

.empty-state-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: rgb(var(--color-foreground));
}

.empty-state-message {
    font-size: 1rem;
    color: rgb(var(--color-foreground-subtle));
    margin-bottom: 1.5rem;
    max-width: 500px;
}

.empty-state-action {
    margin-top: 1rem;
}

/* ========================================
   Modal/Dialog Components
   ======================================== */

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(var(--color-foreground), 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: rgb(var(--color-background));
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow: hidden;
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s ease;
}

.modal-overlay.show .modal {
    transform: scale(1) translateY(0);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(var(--color-border), 0.8);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: rgb(var(--color-foreground));
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    cursor: pointer;
    color: rgb(var(--color-foreground-subtle));
    padding: 0.25rem;
    border-radius: var(--radius-sm);
    transition: all 0.2s;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(var(--color-border), 0.5);
    color: rgb(var(--color-foreground));
}

.modal-close:focus {
    outline: 2px solid rgb(var(--color-primary));
    outline-offset: 2px;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(var(--color-border), 0.8);
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ========================================
   Accessibility & Keyboard Navigation
   ======================================== */

/* Focus management styles */
.focus-trap {
    outline: none;
}

.focus-trap:focus {
    box-shadow: 0 0 0 3px rgba(var(--color-primary), 0.3);
}

/* Skip link for screen readers */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: rgb(var(--color-primary));
    color: rgb(var(--color-secondary-light));
    padding: 8px;
    text-decoration: none;
    border-radius: calc(var(--radius) - 2px);
    z-index: var(--z-tooltip);
    transition: top 0.3s;
}

.skip-link:focus {
    top: 6px;
}

/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Enhanced focus styles for keyboard navigation */
.btn:focus,
.form-input:focus,
.form-select:focus,
.form-textarea:focus,
a:focus,
input:focus,
button:focus,
select:focus,
textarea:focus {
    outline: 2px solid rgb(var(--color-primary));
    outline-offset: 2px;
    border-radius: calc(var(--radius) - 2px);
}

/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ========================================
   Enhanced Error Handling
   ======================================== */

/* Error state with detailed information */
.detailed-error {
    background: rgba(var(--color-destructive), 0.1);
    border: 1px solid rgba(var(--color-destructive), 0.3);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin: 1rem 0;
    position: relative;
}

.error-icon {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    font-size: 1.5rem;
    color: rgb(var(--color-destructive));
}

.error-content {
    padding-left: 3rem;
}

.error-title {
    font-weight: 600;
    color: rgb(var(--color-destructive));
    margin-bottom: 0.5rem;
    font-size: 1.125rem;
}

.error-description {
    color: rgb(var(--color-foreground));
    margin-bottom: 1rem;
}

.error-suggestions {
    margin-top: 1rem;
}

.error-suggestion-item {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.error-suggestion-item:last-child {
    margin-bottom: 0;
}

.error-suggestion-icon {
    color: rgb(var(--color-warning));
    margin-top: 0.25rem;
    flex-shrink: 0;
}

.error-suggestion-text {
    color: rgb(var(--color-foreground));
}

.error-action {
    margin-top: 1rem;
    display: flex;
    gap: 0.75rem;
}

.error-recovery-btn {
    background: rgba(var(--color-primary), 0.1);
    color: rgb(var(--color-primary));
    border: 1px solid rgba(var(--color-primary), 0.3);
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: background 0.2s;
}

.error-recovery-btn:hover {
    background: rgba(var(--color-primary), 0.2);
}

.error-contact-btn {
    background: rgba(var(--color-foreground), 0.1);
    color: rgb(var(--color-foreground));
    border: 1px solid rgba(var(--color-border), 0.5);
    padding: 0.5rem 1rem;
    border-radius: calc(var(--radius) - 2px);
    cursor: pointer;
    transition: background 0.2s;
}

.error-contact-btn:hover {
    background: rgba(var(--color-foreground), 0.2);
}

.offline-indicator {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: rgb(var(--color-warning));
    color: white;
    text-align: center;
    padding: 0.5rem;
    z-index: var(--z-fixed);
    display: none;
}

.offline-indicator.visible {
    display: block;
}

.connection-status {
    padding: 0.25rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.875rem;
    font-weight: 500;
}

.connection-status.online {
    background: rgba(var(--color-success), 0.1);
    color: rgb(var(--color-success));
}

.connection-status.offline {
    background: rgba(var(--color-destructive), 0.1);
    color: rgb(var(--color-destructive));
}

/* ========================================
   Additional Component Utilities
   ======================================== */

/* Progress bar component */
.progress-container {
    width: 100%;
    height: 8px;
    background: rgba(var(--color-border), 0.5);
    border-radius: 4px;
    overflow: hidden;
    margin: 1rem 0;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, rgb(var(--gradient-public-start)), rgb(var(--gradient-public-end)));
    border-radius: 4px;
    transition: width 0.3s ease;
}

/* Badge component */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: calc(var(--radius-xl) - 2px);
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1;
}

.badge-sm {
    padding: 0.125rem 0.5rem;
    font-size: 0.65rem;
}

.badge-pill {
    border-radius: 9999px;
}

.badge-primary {
    background: rgba(var(--color-primary), 0.1);
    color: rgb(var(--color-primary));
}

.badge-success {
    background: rgba(var(--color-success), 0.1);
    color: rgb(var(--color-success));
}

.badge-warning {
    background: rgba(var(--color-warning), 0.1);
    color: rgb(var(--color-warning));
}

.badge-destructive {
    background: rgba(var(--color-destructive), 0.1);
    color: rgb(var(--color-destructive));
}

/* Tabs component */
.tabs {
    display: flex;
    border-bottom: 1px solid rgba(var(--color-border), 0.8);
    margin-bottom: 1rem;
}

.tab {
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    position: relative;
    color: rgba(var(--color-foreground), 0.7);
    border-bottom: 2px solid transparent;
}

.tab:hover {
    color: rgb(var(--color-foreground));
}

.tab.active {
    color: rgb(var(--color-primary));
    border-bottom: 2px solid rgb(var(--color-primary));
}

.tab-panel {
    display: none;
}

.tab-panel.active {
    display: block;
}

/* Accordion component */
.accordion-item {
    border: 1px solid rgba(var(--color-border), 0.8);
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.accordion-header {
    padding: 1rem;
    background: rgba(var(--color-secondary), 0.3);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.accordion-body {
    padding: 1rem;
    display: none;
}

.accordion-body.expanded {
    display: block;
}

/* ========================================
   Print Styles
   ======================================== */

@media print {
    .gradient-bg-public,
    .gradient-bg-pwa,
    .gradient-bg-footer {
        background: white !important;
        color: black !important;
    }

    .skeleton {
        display: none;
    }

    .progress-container,
    .badge,
    .tabs,
    .accordion-item {
        display: none;
    }

    .footer-orb {
        display: none;
    }
}
