@layer base, components, utilities;

@layer base {
  :root {
    /* Modern Color Palette (OKLCH) */
    --primary: oklch(55% 0.15 250);
    --primary-hover: oklch(60% 0.18 250);
    --accent: oklch(70% 0.2 180);
    --bg-main: oklch(98% 0.01 250);
    --text-main: oklch(25% 0.02 250);
    --text-muted: oklch(50% 0.02 250);
    --white: #ffffff;
    --shadow-soft: 0 10px 30px -10px oklch(0% 0 0 / 10%);
    --shadow-deep: 0 20px 40px -15px oklch(0% 0 0 / 20%);
    --glow: 0 0 15px oklch(55% 0.15 250 / 30%);
    
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    
    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;
  }

  /* Texture Overlay */
  .texture-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    opacity: 0.03;
    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: 1200px;
    padding: 2rem;
    z-index: 1;
  }

  /* Shared Component Styles */
  .card {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 3rem;
    box-shadow: var(--shadow-deep);
    border: 1px solid oklch(100% 0 0 / 50%);
    backdrop-filter: blur(10px);
  }

  .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 oklch(90% 0.01 250);
    font-size: 1rem;
    transition: all 0.3s ease;
    background: oklch(99% 0.01 250);
  }

  input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: var(--glow);
    background: var(--white);
  }

  button {
    cursor: pointer;
    border: none;
    padding: 1rem 2rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 1rem;
    transition: all 0.3s 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: var(--white);
    box-shadow: 0 4px 15px oklch(55% 0.15 250 / 40%);
  }

  button.primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px oklch(55% 0.15 250 / 50%);
  }

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

  button.secondary {
    background: oklch(90% 0.02 250);
    color: var(--text-main);
  }

  button.secondary:hover {
    background: oklch(85% 0.03 250);
  }
}

@layer utilities {
  .text-center { text-align: center; }
  .mt-1 { margin-top: 1rem; }
  .mt-2 { margin-top: 2rem; }
  .hidden { display: none !important; }
}

/* Specific Component Stylings (Shadow DOM will handle most, but global overrides here if needed) */
login-screen, library-app {
  display: block;
  width: 100%;
}
