/* Theme System - 5 Premium Themes */
:root {
    --theme-primary: #3B82F6;
    --theme-primary-dark: #2563EB;
    --theme-primary-light: #60A5FA;
    --theme-secondary: #8B5CF6;
    --theme-accent: #10B981;
    --theme-success: #10B981;
    --theme-warning: #F59E0B;
    --theme-error: #EF4444;
    --theme-info: #3B82F6;

    --bg-primary: #FFFFFF;
    --bg-secondary: #F9FAFB;
    --bg-tertiary: #F3F4F6;
    --bg-elevated: #FFFFFF;
    --bg-overlay: rgba(0, 0, 0, 0.5);

    --text-primary: #111827;
    --text-secondary: #6B7280;
    --text-tertiary: #9CA3AF;
    --text-inverse: #FFFFFF;

    --border-primary: #E5E7EB;
    --border-secondary: #D1D5DB;
    --border-focus: #3B82F6;

    --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);
    --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.3);

    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;

    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-base: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    --sidebar-width: 16rem;
    --header-height: 4rem;
}

/* Dark Theme */
[data-theme="dark"] {
    --bg-primary: #0F172A;
    --bg-secondary: #1E293B;
    --bg-tertiary: #334155;
    --bg-elevated: #1E293B;
    --bg-overlay: rgba(0, 0, 0, 0.7);

    --text-primary: #F1F5F9;
    --text-secondary: #94A3B8;
    --text-tertiary: #64748B;
    --text-inverse: #0F172A;

    --border-primary: #334155;
    --border-secondary: #475569;

    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -1px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.4), 0 4px 6px -2px rgba(0, 0, 0, 0.3);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.4), 0 10px 10px -5px rgba(0, 0, 0, 0.3);
}

/* Blue Theme */
[data-theme="blue"] {
    --theme-primary: #0EA5E9;
    --theme-primary-dark: #0284C7;
    --theme-primary-light: #38BDF8;
    --theme-secondary: #6366F1;
}

/* Purple Theme */
[data-theme="purple"] {
    --theme-primary: #A855F7;
    --theme-primary-dark: #9333EA;
    --theme-primary-light: #C084FC;
    --theme-secondary: #EC4899;
}

/* High Contrast Theme */
[data-theme="high-contrast"] {
    --bg-primary: #000000;
    --bg-secondary: #1A1A1A;
    --bg-tertiary: #333333;
    --text-primary: #FFFFFF;
    --text-secondary: #E0E0E0;
    --border-primary: #FFFFFF;
    --border-secondary: #CCCCCC;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-secondary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* Glassmorphism Effect */
.glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Animations */
@keyframes slideIn {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

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

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

@keyframes shimmer {
    0% {
        background-position: -1000px 0;
    }
    100% {
        background-position: 1000px 0;
    }
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(59, 130, 246, 0.6);
    }
}

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

.animate-float {
    animation: float 3s ease-in-out infinite;
}

.animate-slide-in {
    animation: slideIn var(--transition-base) ease-out;
}

.animate-fade-in {
    animation: fadeIn var(--transition-base) ease-out;
}

.animate-scale-in {
    animation: scaleIn var(--transition-base) ease-out;
}

/* Skeleton Loader */
.skeleton {
    background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--bg-secondary) 50%, var(--bg-tertiary) 75%);
    background-size: 2000px 100%;
    animation: shimmer 2s infinite;
}

/* Hover Effects */
.hover-lift {
    transition: transform var(--transition-base), box-shadow var(--transition-base);
}

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

/* Focus Styles */
.focus-ring:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Gradient Text */
.gradient-text {
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Card Styles */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: all var(--transition-base);
}

.card-hover:hover {
    border-color: var(--theme-primary);
    box-shadow: var(--shadow-xl);
    transform: translateY(-2px);
}

.card-hover:active {
    transform: translateY(0);
    box-shadow: var(--shadow-md);
}

/* Touch feedback for mobile */
@media (hover: none) and (pointer: coarse) {
    .card-hover:active {
        background: var(--bg-secondary);
        transform: scale(0.98);
    }

    button:active, .btn:active {
        transform: scale(0.95);
        opacity: 0.8;
    }
}

/* Mobile-optimized modals */
@media (max-width: 640px) {
    .mobile-modal {
        width: 100%;
        max-width: 100%;
        min-height: 100vh;
        border-radius: 0;
        margin: 0;
    }

    .mobile-modal-content {
        max-height: calc(100vh - 200px);
    }
}

/* Tablet-optimized grids */
@media (min-width: 640px) and (max-width: 1024px) {
    .tablet-grid-2 {
        grid-template-columns: repeat(2, 1fr);
    }

    .tablet-single {
        grid-column: span 1;
    }
}

/* Button Styles */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-weight: 500;
    border-radius: var(--radius-md);
    transition: all var(--transition-fast);
    cursor: pointer;
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--theme-primary);
    color: var(--text-inverse);
}

.btn-primary:hover {
    background: var(--theme-primary-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: var(--border-secondary);
}

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

.btn-ghost:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

.btn-ghost:active {
    transform: scale(0.95);
}

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

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

/* Input Styles */
.input {
    width: 100%;
    padding: 0.625rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border-primary);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    transition: all var(--transition-fast);
}

.input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* Tab Styles */
.tab {
    padding: 0.75rem 1.5rem;
    color: var(--text-secondary);
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.tab:hover {
    color: var(--text-primary);
}

.tab-active {
    color: var(--theme-primary);
    border-bottom-color: var(--theme-primary);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-primary);
    height: 100vh;
    position: fixed;
    left: 0;
    top: 0;
    overflow-y: auto;
    transition: transform var(--transition-base);
    z-index: 40;
}

.sidebar-hidden {
    transform: translateX(-100%);
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar-open {
        transform: translateX(0);
    }
}

/* Main Content */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
    transition: margin-left var(--transition-base);
}

@media (max-width: 768px) {
    .main-content {
        margin-left: 0;
    }
}

/* Theme Card Styles */
.theme-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: var(--radius-lg);
    border: 2px solid var(--border-primary);
    background: var(--bg-elevated);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.theme-card:hover {
    border-color: var(--theme-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.theme-card-active {
    border-color: var(--theme-primary);
    background: rgba(59, 130, 246, 0.1);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

/* Toggle Switch Styles */
.toggle {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
    flex-shrink: 0;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-primary);
    transition: var(--transition-base);
    border-radius: 24px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-base);
    border-radius: 50%;
}

.toggle input:checked + .toggle-slider {
    background-color: var(--theme-primary);
}

.toggle input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle input:focus + .toggle-slider {
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

/* Premium Effects */
.gradient-border {
    position: relative;
    overflow: hidden;
}

.gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-secondary));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    opacity: 0;
    transition: opacity var(--transition-base);
}

.gradient-border:hover::before {
    opacity: 0.5;
}

/* Pulse Animation for CTAs */
.pulse-ring {
    animation: pulse-ring 2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(59, 130, 246, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0);
    }
}

/* Smooth Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-primary);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--theme-primary);
}

/* Loading Spinner */
.spinner {
    border: 2px solid var(--border-primary);
    border-top: 2px solid var(--theme-primary);
    border-radius: 50%;
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Toast Animation */
.toast-enter {
    animation: toast-slide-in 0.3s ease-out;
}

.toast-leave {
    animation: toast-slide-out 0.3s ease-in forwards;
}

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

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

/* Shimmer Effect for Loading States */
.shimmer-effect {
    position: relative;
    overflow: hidden;
}

.shimmer-effect::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 20%,
        rgba(255, 255, 255, 0.5) 60%,
        rgba(255, 255, 255, 0)
    );
    animation: shimmer-slide 2s infinite;
}

@keyframes shimmer-slide {
    100% {
        transform: translateX(100%);
    }
}

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

/* Alpine.js Cloak - Hide elements until Alpine.js initializes */
[x-cloak] {
    display: none !important;
}

/* Screen Reader Only - Visually Hidden */
.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;
}

/* Skip to Content Link - Visible on Focus */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: 0;
    z-index: 9999;
    padding: 1rem 1.5rem;
    background: var(--theme-primary);
    color: white;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 0.5rem 0;
    box-shadow: var(--shadow-lg);
    transition: top 0.2s ease-in-out;
}

.skip-to-content:focus {
    top: 0;
}
