/**
 * 🎨 MODERN THEME CORE CSS FRAMEWORK
 * Ultra-modern, responsive, and animated CSS framework
 * Version: 1.0.0
 */

/* ===================================
   🎯 CSS RESET & BASE
   =================================== */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Colors will be injected by theme-config.js */
    --transition-fast: 150ms;
    --transition-normal: 300ms;
    --transition-slow: 500ms;
    
    /* Z-index layers */
    --z-dropdown: 1000;
    --z-sticky: 1020;
    --z-fixed: 1030;
    --z-modal-backdrop: 1040;
    --z-modal: 1050;
    --z-popover: 1060;
    --z-tooltip: 1070;
    
    /* Light Mode (Default) */
    --bg-primary: #ffffff;
    --bg-secondary: #f9fafb;
    --bg-tertiary: #f3f4f6;
    --text-primary: #111827;
    --text-secondary: #6b7280;
    --text-tertiary: #9ca3af;
    --border-color: #e5e7eb;
    --shadow-color: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    /* Dark Mode */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-tertiary: #94a3b8;
    --border-color: #334155;
    --shadow-color: rgba(0, 0, 0, 0.5);
}

html {
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-primary, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif);
    line-height: 1.6;
    color: var(--text-primary);
    background: var(--bg-primary);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* ===================================
   🎭 ANIMATION KEYFRAMES
   =================================== */

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

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

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

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

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

@keyframes rotateIn {
    from {
        opacity: 0;
        transform: rotate(-180deg) scale(0.5);
    }
    to {
        opacity: 1;
        transform: rotate(0) scale(1);
    }
}

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

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: scale(1);
    }
    50% {
        opacity: 0.8;
        transform: scale(1.05);
    }
}

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-10px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(10px);
    }
}

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

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

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

@keyframes glow {
    0%, 100% {
        box-shadow: 0 0 5px rgba(138, 43, 226, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(138, 43, 226, 0.8);
    }
}

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

@keyframes zoomInRotate {
    from {
        opacity: 0;
        transform: scale(0) rotate(-180deg);
    }
    to {
        opacity: 1;
        transform: scale(1) rotate(0);
    }
}

@keyframes flipIn {
    from {
        opacity: 0;
        transform: perspective(400px) rotateX(-90deg);
    }
    to {
        opacity: 1;
        transform: perspective(400px) rotateX(0);
    }
}

@keyframes slideInBlur {
    from {
        opacity: 0;
        filter: blur(20px);
        transform: translateX(-50px);
    }
    to {
        opacity: 1;
        filter: blur(0);
        transform: translateX(0);
    }
}

@keyframes morphing {
    0%, 100% {
        border-radius: 60% 40% 30% 70% / 60% 30% 70% 40%;
    }
    50% {
        border-radius: 30% 60% 70% 40% / 50% 60% 30% 60%;
    }
}

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

@keyframes neon-pulse {
    0%, 100% {
        text-shadow: 0 0 10px rgba(138, 43, 226, 0.8),
                     0 0 20px rgba(138, 43, 226, 0.6),
                     0 0 30px rgba(138, 43, 226, 0.4);
    }
    50% {
        text-shadow: 0 0 20px rgba(138, 43, 226, 1),
                     0 0 30px rgba(138, 43, 226, 0.8),
                     0 0 40px rgba(138, 43, 226, 0.6);
    }
}

/* ===================================
   🎨 UTILITY CLASSES - ANIMATIONS
   =================================== */

.animate-fadeIn {
    animation: fadeIn var(--duration-normal, 300ms) ease-out;
}

.animate-fadeInUp {
    animation: fadeInUp var(--duration-normal, 300ms) ease-out;
}

.animate-fadeInDown {
    animation: fadeInDown var(--duration-normal, 300ms) ease-out;
}

.animate-fadeInLeft {
    animation: fadeInLeft var(--duration-normal, 300ms) ease-out;
}

.animate-fadeInRight {
    animation: fadeInRight var(--duration-normal, 300ms) ease-out;
}

.animate-scaleIn {
    animation: scaleIn var(--duration-normal, 300ms) cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.animate-slideUp {
    animation: slideUp var(--duration-slow, 500ms) ease-out;
}

.animate-slideDown {
    animation: slideDown var(--duration-slow, 500ms) ease-out;
}

.animate-rotateIn {
    animation: rotateIn var(--duration-slow, 500ms) ease-in-out;
}

.animate-bounce {
    animation: bounce 1s infinite;
}

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

.animate-spin {
    animation: spin 1s linear infinite;
}

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

.animate-glow {
    animation: glow 2s ease-in-out infinite;
}

.animate-slideInFromBottom {
    animation: slideInFromBottom 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.animate-zoomInRotate {
    animation: zoomInRotate 0.8s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.animate-flipIn {
    animation: flipIn 0.6s ease-out;
}

.animate-slideInBlur {
    animation: slideInBlur 0.8s ease-out;
}

.animate-morphing {
    animation: morphing 8s ease-in-out infinite;
}

.animate-gradient-shift {
    background-size: 200% 200%;
    animation: gradient-shift 3s ease infinite;
}

.animate-neon-pulse {
    animation: neon-pulse 2s ease-in-out infinite;
}

/* Animation delays */
.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }
.delay-700 { animation-delay: 700ms; }
.delay-1000 { animation-delay: 1000ms; }

/* ===================================
   🔘 BUTTONS
   =================================== */

.theme-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 0.625rem;
    border: none;
    cursor: pointer;
    transition: all var(--transition-normal, 300ms) cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    user-select: none;
    text-decoration: none;
}

.theme-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.theme-btn:active::before {
    width: 300px;
    height: 300px;
}

.theme-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
}

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

/* Button variants */
.theme-btn-primary {
    background: linear-gradient(135deg, var(--color-primary-500, #0ea5e9), var(--color-primary-700, #0369a1));
    color: white;
}

.theme-btn-secondary {
    background: linear-gradient(135deg, var(--color-secondary-500, #a855f7), var(--color-secondary-700, #7e22ce));
    color: white;
}

.theme-btn-outline {
    background: transparent;
    border: 2px solid var(--color-primary-500, #0ea5e9);
    color: var(--color-primary-500, #0ea5e9);
}

.theme-btn-outline:hover {
    background: var(--color-primary-500, #0ea5e9);
    color: white;
}

.theme-btn-ghost {
    background: transparent;
    color: var(--color-primary-600, #0284c7);
}

.theme-btn-ghost:hover {
    background: var(--color-primary-50, #f0f9ff);
}

/* Button sizes */
.theme-btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
    border-radius: 0.5rem;
}

.theme-btn-lg {
    padding: 0.75rem 1.5rem;
    font-size: 1.125rem;
    border-radius: 0.75rem;
}

.theme-btn-xl {
    padding: 1rem 2rem;
    font-size: 1.25rem;
    border-radius: 1rem;
}

/* ===================================
   📦 CARDS
   =================================== */

.theme-card {
    background: var(--bg-primary);
    border-radius: 1rem;
    padding: 1.5rem;
    box-shadow: 0 4px 6px -1px var(--shadow-color);
    transition: all var(--transition-normal, 300ms) cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.theme-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(138, 43, 226, 0.1), transparent);
    transition: left 0.5s ease;
}

.theme-card:hover::before {
    left: 100%;
}

.theme-card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 20px 40px -5px var(--shadow-color);
    border-color: rgba(138, 43, 226, 0.3);
}

/* Card variants */
.theme-card-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.theme-card-gradient {
    background: linear-gradient(135deg, var(--color-primary-500, #0ea5e9), var(--color-secondary-500, #a855f7));
    color: white;
}

.theme-card-bordered {
    border: 2px solid var(--color-neutral-200, #e5e5e5);
    box-shadow: none;
}

/* ===================================
   ✨ GLASSMORPHISM
   =================================== */

.theme-glass {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.1);
}

.theme-glass-dark {
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px) saturate(180%);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===================================
   🌈 GRADIENTS
   =================================== */

.theme-gradient-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.theme-gradient-sunset {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.theme-gradient-ocean {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
}

.theme-gradient-forest {
    background: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
}

.theme-gradient-text {
    background: linear-gradient(135deg, var(--color-primary-500, #0ea5e9), var(--color-secondary-500, #a855f7));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===================================
   💫 EFFECTS
   =================================== */

.theme-shadow-sm {
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1);
}

.theme-shadow-md {
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.theme-shadow-lg {
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.theme-shadow-xl {
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

.theme-shadow-glow {
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.3);
}

/* Hover glow effect */
.theme-hover-glow {
    transition: box-shadow var(--transition-normal, 300ms);
}

.theme-hover-glow:hover {
    box-shadow: 0 0 30px rgba(138, 43, 226, 0.5);
}

/* ===================================
   📱 RESPONSIVE UTILITIES
   =================================== */

@media (max-width: 640px) {
    .theme-card {
        padding: 1rem;
    }
    
    .theme-btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}

/* ===================================
   🎯 UTILITY CLASSES
   =================================== */

.theme-transition {
    transition: all var(--transition-normal, 300ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-transition-fast {
    transition: all var(--transition-fast, 150ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-transition-slow {
    transition: all var(--transition-slow, 500ms) cubic-bezier(0.4, 0, 0.2, 1);
}

.theme-cursor-pointer {
    cursor: pointer;
}

.theme-select-none {
    user-select: none;
}

/* Shimmer loading effect */
.theme-shimmer {
    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)
    );
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

/* Skeleton loader */
.theme-skeleton {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 0.5rem;
}

/* ===================================
   🌓 DARK MODE TOGGLE
   =================================== */

.theme-toggle {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: var(--z-fixed);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    overflow: hidden;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(10deg);
    box-shadow: 0 15px 35px rgba(138, 43, 226, 0.4);
}

.theme-toggle:active {
    transform: scale(0.95);
}

.theme-toggle-icon {
    font-size: 1.5rem;
    color: white;
    transition: transform 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.theme-toggle:hover .theme-toggle-icon {
    transform: rotate(360deg);
}

/* Dark mode specific styles */
[data-theme="dark"] .theme-toggle {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
}

[data-theme="dark"] .theme-card {
    background: var(--bg-secondary);
}

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

/* ===================================
   ✨ MODERN EFFECTS
   =================================== */

.theme-blur-card {
    backdrop-filter: blur(20px) saturate(180%);
    background: rgba(255, 255, 255, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

[data-theme="dark"] .theme-blur-card {
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.theme-3d-card {
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}

.theme-3d-card:hover {
    transform: translateZ(20px) rotateX(5deg) rotateY(5deg);
}

.theme-glow-border {
    position: relative;
}

.theme-glow-border::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: inherit;
    padding: 2px;
    background: linear-gradient(45deg, #667eea, #764ba2, #f093fb);
    -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 0.3s;
}

.theme-glow-border:hover::before {
    opacity: 1;
}

/* Particle background effect */
.theme-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

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

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Selection color */
::selection {
    background: rgba(138, 43, 226, 0.3);
    color: var(--text-primary);
}

::-moz-selection {
    background: rgba(138, 43, 226, 0.3);
    color: var(--text-primary);
}
