@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 217 33% 17%;
    --primary-foreground: 0 0% 98%;
    --secondary: 210 40% 96%;
    --secondary-foreground: 222.2 84% 4.9%;
    --muted: 210 40% 96%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96%;
    --accent-foreground: 222.2 84% 4.9%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 217 33% 17%;
    --radius: 0.5rem;

    /* Academic color palette */
    --navy: 217 33% 17%;
    --navy-light: 217 33% 25%;
    --navy-dark: 217 33% 12%;
    --gray-warm: 210 11% 71%;
    --gray-cool: 215 16% 47%;
    --accent-gold: 43 74% 66%;
    --accent-blue: 217 91% 60%;

    /* Font variables */
    --font-merriweather: "Merriweather", Georgia, serif;
    --font-inter: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial, sans-serif;
  }

  .dark {
    --background: 222.2 84% 4.9%;
    --foreground: 210 40% 98%;
    --card: 222.2 84% 4.9%;
    --card-foreground: 210 40% 98%;
    --popover: 222.2 84% 4.9%;
    --popover-foreground: 210 40% 98%;
    --primary: 217 33% 17%;
    --primary-foreground: 0 0% 98%;
    --secondary: 217.2 32.6% 17.5%;
    --secondary-foreground: 210 40% 98%;
    --muted: 217.2 32.6% 17.5%;
    --muted-foreground: 215 20.2% 65.1%;
    --accent: 217.2 32.6% 17.5%;
    --accent-foreground: 210 40% 98%;
    --destructive: 0 62.8% 30.6%;
    --destructive-foreground: 210 40% 98%;
    --border: 217.2 32.6% 17.5%;
    --input: 217.2 32.6% 17.5%;
    --ring: 217 33% 17%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  body {
    @apply bg-background text-foreground;
    font-family: var(--font-inter), -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial,
      sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
    line-height: 1.65;
    font-weight: 400;
    letter-spacing: -0.011em;
    color: hsl(var(--gray-cool));
  }

  /* Typography Hierarchy with Merriweather + Inter pairing */
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    font-family: var(--font-merriweather), Georgia, serif;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: hsl(var(--navy));
    margin-bottom: 0.5em;
  }

  h1 {
    @apply text-4xl md:text-5xl lg:text-6xl;
    font-weight: 900;
    letter-spacing: -0.03em;
    line-height: 1.1;
  }

  h2 {
    @apply text-3xl md:text-4xl lg:text-5xl;
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.15;
  }

  h3 {
    @apply text-2xl md:text-3xl lg:text-4xl;
    font-weight: 700;
    letter-spacing: -0.02em;
  }

  h4 {
    @apply text-xl md:text-2xl lg:text-3xl;
    font-weight: 700;
  }

  h5 {
    @apply text-lg md:text-xl lg:text-2xl;
    font-weight: 700;
  }

  h6 {
    @apply text-base md:text-lg lg:text-xl;
    font-weight: 700;
  }

  p {
    font-family: var(--font-inter), sans-serif;
    @apply text-base md:text-lg leading-relaxed;
    color: hsl(var(--gray-cool));
    font-weight: 400;
    margin-bottom: 1em;
  }

  .lead {
    font-family: var(--font-inter), sans-serif;
    @apply text-lg md:text-xl lg:text-2xl leading-relaxed;
    color: hsl(var(--gray-cool));
    font-weight: 400;
  }

  .text-small {
    font-family: var(--font-inter), sans-serif;
    font-size: 0.875rem;
    line-height: 1.5;
    color: hsl(var(--gray-cool));
    font-weight: 400;
  }

  @media (min-width: 768px) {
    .text-small {
      font-size: 1rem;
    }
  }

  .text-xs {
    font-family: var(--font-inter), sans-serif;
    font-size: 0.75rem;
    line-height: 1.25;
    color: hsl(var(--gray-warm));
    font-weight: 400;
  }

  @media (min-width: 768px) {
    .text-xs {
      font-size: 0.875rem;
    }
  }
}

/* Academic-inspired backgrounds and textures */
.hero-academic {
  background: linear-gradient(135deg, hsl(var(--navy)) 0%, hsl(var(--navy-light)) 50%, hsl(var(--navy-dark)) 100%);
  position: relative;
}

.hero-academic::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(circle at 25% 25%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
    radial-gradient(circle at 75% 75%, rgba(255, 255, 255, 0.05) 0%, transparent 50%);
  background-size: 100px 100px, 150px 150px;
  opacity: 0.3;
}

.paper-texture {
  background-color: #fefefe;
  background-image: linear-gradient(90deg, rgba(0, 0, 0, 0.02) 1px, transparent 1px),
    linear-gradient(rgba(0, 0, 0, 0.02) 1px, transparent 1px);
  background-size: 20px 20px;
}

.book-spine {
  background: linear-gradient(90deg, hsl(var(--navy)) 0%, hsl(var(--navy-light)) 50%, hsl(var(--navy)) 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.1);
}

/* Refined animations with academic feel */
.fade-in-academic {
  animation: fadeInAcademic 1s ease-out;
}

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

.slide-in-academic {
  animation: slideInAcademic 1.2s ease-out;
}

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

.scale-in-academic {
  animation: scaleInAcademic 0.8s ease-out;
}

@keyframes scaleInAcademic {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Academic button styles */
.btn-academic-primary {
  font-family: var(--font-inter), sans-serif;
  background: hsl(var(--navy));
  color: white;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  letter-spacing: -0.01em;
}

.btn-academic-primary:hover {
  background: hsl(var(--navy-light));
  transform: translateY(-1px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.btn-academic-secondary {
  font-family: var(--font-inter), sans-serif;
  background: white;
  color: hsl(var(--navy));
  border: 2px solid hsl(var(--navy));
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  letter-spacing: -0.01em;
}

.btn-academic-secondary:hover {
  background: hsl(var(--navy));
  color: white;
  transform: translateY(-1px);
}

.btn-academic-outline {
  font-family: var(--font-inter), sans-serif;
  background: transparent;
  color: hsl(var(--gray-cool));
  border: 1px solid hsl(var(--gray-warm));
  font-weight: 500;
  padding: 0.875rem 2rem;
  border-radius: 0.5rem;
  transition: all 0.3s ease;
  letter-spacing: -0.01em;
}

.btn-academic-outline:hover {
  border-color: hsl(var(--navy));
  color: hsl(var(--navy));
  background: rgba(255, 255, 255, 0.5);
}

/* Academic card styles */
.card-academic {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
  overflow: hidden;
  transition: all 0.3s ease;
}

.card-academic:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.card-academic-feature {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2rem;
  text-align: center;
  transition: all 0.3s ease;
}

.card-academic-feature:hover {
  background: rgba(255, 255, 255, 0.98);
  transform: translateY(-4px);
}

/* Typography utilities for academic content */
.heading-academic-primary {
  font-family: var(--font-merriweather), Georgia, serif;
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: hsl(var(--navy));
}

.heading-academic-secondary {
  font-family: var(--font-merriweather), Georgia, serif;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  color: hsl(var(--navy));
}

.heading-academic-tertiary {
  font-family: var(--font-merriweather), Georgia, serif;
  font-size: clamp(1.5rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  color: hsl(var(--navy));
}

.body-academic-large {
  font-family: var(--font-inter), sans-serif;
  font-size: clamp(1.125rem, 2vw, 1.25rem);
  line-height: 1.7;
  color: hsl(var(--gray-cool));
  font-weight: 400;
}

.body-academic-regular {
  font-family: var(--font-inter), sans-serif;
  font-size: clamp(1rem, 1.5vw, 1.125rem);
  line-height: 1.65;
  color: hsl(var(--gray-cool));
  font-weight: 400;
}

.body-academic-small {
  font-family: var(--font-inter), sans-serif;
  font-size: clamp(0.875rem, 1.2vw, 1rem);
  line-height: 1.6;
  color: hsl(var(--gray-cool));
  font-weight: 400;
}

/* Academic focus states */
.focus-academic {
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
  border-color: hsl(var(--accent-blue));
}

/* Section spacing for academic layout */
.section-academic {
  padding: 5rem 0;
}

.section-academic-large {
  padding: 7rem 0;
}

.container-academic {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* Academic header styling */
.header-academic {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  position: sticky;
  top: 0;
  z-index: 50;
}

/* Dashboard academic styling */
.dashboard-academic {
  background: #fafafa;
  min-height: 100vh;
}

.dashboard-header-academic {
  background: white;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}

.dashboard-card-academic {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 1.5rem;
}

/* Academic status indicators */
.status-academic-pending {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
}

.status-academic-progress {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #93c5fd;
}

.status-academic-completed {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}

.status-academic-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* Form styling for academic theme */
.form-academic {
  font-family: var(--font-inter), sans-serif;
}

.form-input-academic {
  border: 1px solid hsl(var(--gray-warm));
  border-radius: 0.5rem;
  padding: 0.875rem 1rem;
  font-size: 1rem;
  transition: all 0.2s ease;
  background: white;
}

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

.form-label-academic {
  font-family: var(--font-inter), sans-serif;
  font-size: 0.875rem;
  font-weight: 600;
  color: hsl(var(--navy));
  margin-bottom: 0.5rem;
  display: block;
}

/* Navigation for academic theme */
.nav-academic {
  font-family: var(--font-inter), sans-serif;
  font-weight: 500;
  color: hsl(var(--gray-cool));
  transition: color 0.2s ease;
  text-decoration: none;
}

.nav-academic:hover {
  color: hsl(var(--navy));
}

.nav-academic-active {
  color: hsl(var(--navy));
  font-weight: 600;
}

/* Responsive academic design */
@media (max-width: 768px) {
  .section-academic {
    padding: 3rem 0;
  }

  .section-academic-large {
    padding: 4rem 0;
  }

  .container-academic {
    padding: 0 1rem;
  }

  .card-academic-feature {
    padding: 1.5rem;
  }

  .btn-academic-primary,
  .btn-academic-secondary,
  .btn-academic-outline {
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
  }
}

/* Academic settings specific styles */
.settings-academic {
  background: white;
  border-radius: 0.75rem;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
  padding: 2rem;
  margin-bottom: 2rem;
}

.settings-header-academic {
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.settings-grid-academic {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
}

/* Academic color utilities */
.text-navy {
  color: hsl(var(--navy));
}
.text-navy-light {
  color: hsl(var(--navy-light));
}
.text-gray-cool {
  color: hsl(var(--gray-cool));
}
.text-gray-warm {
  color: hsl(var(--gray-warm));
}
.text-accent-gold {
  color: hsl(var(--accent-gold));
}
.text-accent-blue {
  color: hsl(var(--accent-blue));
}

.bg-navy {
  background-color: hsl(var(--navy));
}
.bg-navy-light {
  background-color: hsl(var(--navy-light));
}
.bg-gray-cool {
  background-color: hsl(var(--gray-cool));
}
.bg-gray-warm {
  background-color: hsl(var(--gray-warm));
}
.bg-accent-gold {
  background-color: hsl(var(--accent-gold));
}
.bg-accent-blue {
  background-color: hsl(var(--accent-blue));
}

.border-navy {
  border-color: hsl(var(--navy));
}
.border-gray-cool {
  border-color: hsl(var(--gray-cool));
}
.border-gray-warm {
  border-color: hsl(var(--gray-warm));
}

.font-merriweather {
  font-family: var(--font-merriweather), Georgia, serif;
}

.font-inter {
  font-family: var(--font-inter), -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Helvetica Neue", Arial,
    sans-serif;
}
