/**
 * 0x1 Framework - Stunning Professional Light & Dark Theme
 * Tailwind CSS v4 with enhanced aesthetics for both modes
 */

/* Import Tailwind CSS - this is the only directive needed in v4 */
@import "tailwindcss";

/* Theme configuration */
:root {
  color-scheme: light;
  /* Light theme variables - elegant light mode with subtle purple accents */
  --background: #fefefe;
  --foreground: #1a1a2e;
  --card: #ffffff;
  --card-foreground: #1a1a2e;
  --primary: #7c3aed;
  --primary-foreground: #ffffff;
  --secondary: #f8fafc;
  --secondary-foreground: #334155;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --accent: #8b5cf6;
  --accent-foreground: #ffffff;
  --border: #e2e8f0;
  --input: #ffffff;
  --ring: #7c3aed;

  /* Gradients for light mode */
  --gradient-primary: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
  --gradient-secondary: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-accent: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);

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

.dark {
  color-scheme: dark;
  /* Dark theme variables - striking deep purple-black */
  --background: #0f0f23;
  --foreground: #f0f0ff;
  --card: #1a1a2e;
  --card-foreground: #f0f0ff;
  --primary: #a78bfa;
  --primary-foreground: #ffffff;
  --secondary: #2a2a4a;
  --secondary-foreground: #e2e2ff;
  --muted: #252550;
  --muted-foreground: #a0a0d0;
  --accent: #c4b5fd;
  --accent-foreground: #ffffff;
  --border: #3a3a6a;
  --input: #2a2a4a;
  --ring: #c4b5fd;

  /* Gradients */
  --gradient-primary: linear-gradient(135deg, #a78bfa 0%, #c4b5fd 100%);
  --gradient-secondary: linear-gradient(135deg, #8b5cf6 0%, #a78bfa 100%);
  --gradient-accent: linear-gradient(135deg, #c4b5fd 0%, #ddd6fe 100%);

  /* Shadows */
  --shadow-sm: 0 2px 4px rgba(11, 11, 31, 0.3);
  --shadow-md: 0 4px 8px rgba(10, 10, 30, 0.35);
  --shadow-lg: 0 8px 20px rgba(9, 9, 29, 0.4);
  --shadow-xl: 0 12px 28px rgba(8, 8, 28, 0.45);
}

/* Base styles */
@layer base {
  * {
    border-color: var(--border);
    box-sizing: border-box;
  }

  body {
    background-color: var(--background);
    color: var(--foreground);
    font-feature-settings: "rlig" 1, "calt" 1;
    transition: background-color 0.3s ease, color 0.3s ease;
    min-height: 100vh;
    background-image:
      radial-gradient(circle at 100% 0%, rgba(124, 58, 237, 0.03) 0%, transparent 25%),
      radial-gradient(circle at 0% 100%, rgba(167, 139, 250, 0.03) 0%, transparent 25%);
    /* Optimize scrolling performance */
    -webkit-overflow-scrolling: touch;
    scroll-behavior: smooth;
  }

  .dark body {
    background-image:
      radial-gradient(circle at 100% 0%, rgba(167, 139, 250, 0.15) 0%, transparent 35%),
      radial-gradient(circle at 0% 100%, rgba(196, 181, 253, 0.15) 0%, transparent 35%);
  }

  html {
    scroll-behavior: smooth;
  }

  *:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--ring), 0 0 0 4px var(--background);
  }

  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.5em;
  }

  h1 {
    font-size: 2.5rem;
    letter-spacing: -0.025em;
  }

  h2 {
    font-size: 2rem;
    letter-spacing: -0.025em;
  }

  h3 {
    font-size: 1.5rem;
  }

  p {
    line-height: 1.65;
  }

  a {
    color: var(--primary);
    text-decoration: none;
    transition: color 0.2s ease;
  }

  a:hover {
    color: var(--accent);
  }
}

/* Component styles */
@layer components {

  /* Theme-aware utility classes using CSS variables */
  .bg-muted {
    background-color: var(--muted);
  }

  .bg-card {
    background-color: var(--card);
  }

  .border-card {
    border-color: var(--card);
  }

  /* Button base styles */
  .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    font-weight: 600;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    border: 1px solid transparent;
  }

  .btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px var(--ring), 0 0 0 4px var(--background);
  }

  .btn:disabled {
    pointer-events: none;
    opacity: 0.5;
  }

  /* Primary button - gradient background with subtle animation */
  .btn-primary {
    background: var(--gradient-primary);
    color: white;
    border: none;
    box-shadow: var(--shadow-md);
    position: relative;
    z-index: 1;
  }

  .btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-secondary);
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
    border-radius: 0.5rem;
  }

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

  .btn-primary:hover::before {
    opacity: 1;
  }

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

  /* Secondary button - improved light mode styling */
  .btn-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
  }

  .btn-secondary:hover {
    background-color: var(--muted);
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
  }

  .btn-secondary:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
  }

  /* Ghost button - subtle styling for both modes */
  .btn-ghost {
    background-color: transparent;
    color: var(--foreground);
    border: 1px solid transparent;
  }

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

  .dark .btn-ghost:hover {
    background-color: var(--muted);
  }

  /* Outline button */
  .btn-outline {
    background: transparent;
    color: var(--primary);
    border: 1px solid var(--border);
  }

  .btn-outline:hover {
    background-color: var(--muted);
    border-color: var(--primary);
  }

  /* Danger button */
  .btn-danger {
    background: linear-gradient(135deg, #dc2626 0%, #ef4444 100%);
    color: white;
    border: none;
    box-shadow: var(--shadow-md);
  }

  .btn-danger:hover {
    background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
  }

  .btn-danger:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
  }

  /* Button sizes */
  .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.75rem;
  }

  .btn-lg {
    padding: 1rem 2rem;
    font-size: 1rem;
  }

  /* Card styles - enhanced for light mode */
  .card {
    background-color: var(--card);
    color: var(--card-foreground);
    border: 1px solid var(--border);
    border-radius: 0.75rem;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
  }

  /* Glass panel effect - improved for light mode */
  .card-glass {
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.2);
  }

  .dark .card-glass {
    background: rgba(18, 18, 48, 0.8);
    border: 1px solid rgba(46, 46, 106, 0.3);
  }

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

  /* Section spacing */
  .section {
    padding: 4rem 0;
  }

  /* Animated background for containers */
  @keyframes subtle-shift {

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

    50% {
      background-position: 100% 50%;
    }
  }

  .container-gradient {
    background: linear-gradient(135deg,
        rgba(124, 58, 237, 0.05) 0%,
        rgba(167, 139, 250, 0.05) 25%,
        rgba(196, 181, 253, 0.05) 50%,
        rgba(139, 92, 246, 0.05) 75%,
        rgba(124, 58, 237, 0.05) 100%);
    background-size: 400% 400%;
    animation: subtle-shift 20s ease-in-out infinite;
    position: relative;
  }

  .container-gradient::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg,
        rgba(124, 58, 237, 0.02) 0%,
        rgba(167, 139, 250, 0.02) 25%,
        rgba(196, 181, 253, 0.02) 50%,
        rgba(139, 92, 246, 0.02) 75%,
        rgba(124, 58, 237, 0.02) 100%);
    pointer-events: none;
  }

  .dark .container-gradient {
    background: linear-gradient(135deg,
        rgba(8, 8, 26, 0.8) 0%,
        rgba(18, 18, 48, 0.9) 25%,
        rgba(8, 8, 26, 0.8) 50%,
        rgba(18, 18, 48, 0.9) 75%,
        rgba(8, 8, 26, 0.8) 100%);
  }

  .dark .container-gradient::before {
    background: radial-gradient(circle at 30% 20%,
        rgba(139, 92, 246, 0.15) 0%,
        transparent 50%),
      radial-gradient(circle at 70% 80%,
        rgba(167, 139, 250, 0.15) 0%,
        transparent 50%);
  }

  /* Gradient text effects */
  .gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
  }

  .gradient-text-accent {
    background: linear-gradient(135deg,
        var(--primary) 0%,
        var(--accent) 50%,
        var(--primary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }

  /* Custom scrollbar - optimized for performance */
  ::-webkit-scrollbar {
    width: 8px;
  }

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

  ::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 4px;
    transition: background-color 0.2s ease;
  }

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

  /* Badge styles */
  .badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: 9999px;
    border: 1px solid transparent;
    transition: all 0.2s ease;
  }

  .badge-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
  }

  .badge-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
  }

  .badge-accent {
    background-color: var(--accent);
    color: var(--accent-foreground);
  }

  .badge-outline {
    background-color: transparent;
    color: var(--primary);
    border-color: var(--primary);
  }

  /* Input styles - enhanced for light mode */
  .input {
    display: flex;
    width: 100%;
    border-radius: 0.5rem;
    border: 1px solid var(--border);
    background-color: var(--input);
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    transition: all 0.2s ease;
    color: var(--foreground);
  }

  .input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
  }

  .dark .input:focus {
    box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2);
  }

  /* Glass panel - enhanced for both modes */
  .glass-panel {
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 1rem;
    box-shadow: var(--shadow-lg);
  }

  .dark .glass-panel {
    background: rgba(18, 18, 48, 0.9);
    border: 1px solid rgba(46, 46, 106, 0.4);
  }

  /* Animation classes - Fixed to prevent flash on re-renders */
  .animate-fade-in {
    animation: fadeIn 0.6s ease-out forwards;
    animation-fill-mode: both;
  }

  .animate-fade-in-fast {
    animation: fade-in 0.3s ease-out forwards;
  }

  .animate-slide-up {
    animation: slideUp 0.6s ease-out forwards;
    animation-fill-mode: both;
  }

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

  /* Prevent animation restart on re-renders */
  .animate-fade-in.animation-complete,
  .animate-slide-up.animation-complete {
    animation: none !important;
    opacity: 1;
    transform: translateY(0);
  }

  /* Keyframes */
  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }

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

  @keyframes fade-in {
    from {
      opacity: 0;
      transform: translateY(4px);
    }

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

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

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

  @keyframes pulse {

    0%,
    100% {
      opacity: 1;
    }

    50% {
      opacity: 0.5;
    }
  }

}