@layer base, components, utilities;

@layer base {
  :root {
    /* Modern Dark Color Palette (OKLCH) */
    --primary: oklch(60% 0.15 285);        /* Muted Purple */
    --primary-hover: oklch(65% 0.18 285);
    --accent: oklch(75% 0.12 320);       /* Soft Pink */
    
    --bg-main: oklch(15% 0.03 285);      /* Deep Dark Purple */
    --bg-card: oklch(22% 0.04 285 / 80%); /* Semi-transparent Card */
    
    --text-main: oklch(95% 0.01 285);    /* Near White */
    --text-muted: oklch(70% 0.03 285);   /* Muted Purple-Gray */
    
    --border: oklch(30% 0.06 285 / 50%);
    --white: #ffffff;
    
    --shadow-soft: 0 10px 30px -10px oklch(0% 0 0 / 50%);
    --shadow-deep: 0 20px 40px -15px oklch(0% 0 0 / 80%);
    --glow: 0 0 20px oklch(60% 0.15 285 / 40%);
    
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 10px;
    
    font-family: 'Pretendard', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    background-color: var(--bg-main);
    line-height: 1.6;
  }

  * {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
  }

  body {
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: hidden;
    position: relative;
  }

  /* Animated Dark Gradient Background */
  body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at center, oklch(25% 0.06 285) 0%, transparent 50%);
    z-index: -1;
    animation: pulse 15s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% { transform: scale(1) translate(0, 0); }
    50% { transform: scale(1.1) translate(5%, 5%); }
  }

  /* Texture Overlay */
  .texture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.15;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3%3Ffilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  }
}

@layer components {
  #app {
    width: 100%;
    max-width: 1280px;
    padding: 2rem;
    z-index: 1;
  }

  /* Shared Component Styles with Glassmorphism */
  .card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-deep);
    border: 1px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .input-group {
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }

  label {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-left: 0.5rem;
  }

  input {
    padding: 1rem 1.25rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--border);
    font-size: 1rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: oklch(25% 0.04 285 / 50%);
    color: var(--text-main);
  }

  input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
    background: oklch(25% 0.04 285 / 80%);
  }

  button {
    cursor: pointer;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
  }

  button.primary {
    background: var(--primary);
    color: oklch(10% 0.01 285);
    box-shadow: 0 4px 20px oklch(65% 0.2 285 / 30%);
  }

  button.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 10px 30px oklch(65% 0.2 285 / 50%);
  }

  button.primary:active {
    transform: translateY(0) scale(1);
  }

  button.secondary {
    background: oklch(30% 0.06 285 / 50%);
    color: var(--text-main);
    border: 1px solid var(--border);
  }

  button.secondary:hover {
    background: oklch(35% 0.07 285 / 70%);
    border-color: var(--text-muted);
  }
}

@layer utilities {
  .text-center { text-align: center; }
  .mt-1 { margin-top: 1rem; }
  .mt-2 { margin-top: 2rem; }
  .hidden { display: none !important; }
  
  .glass {
    background: oklch(100% 0 0 / 5%);
    backdrop-filter: blur(10px);
    border: 1px solid oklch(100% 0 0 / 10%);
  }
}

login-screen, library-app {
  display: block;
  width: 100%;
}
