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

@layer base {
  *, *::before, *::after {
    box-sizing: border-box;
  }

  html {
    overflow-x: hidden;
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  }

  body {
    @apply bg-white font-sans antialiased overflow-x-hidden;
    color: #16324F;
    min-width: 320px;
    width: 100%;
    max-width: 100vw;
  }

  h1, h2, h3, h4, h5, h6 {
    color: #16324F;
    @apply tracking-tight;
  }

  img, video {
    max-width: 100%;
    height: auto;
    display: block;
  }

  button, a {
    touch-action: manipulation;
  }
}

/* ====================================
   CUSTOM SCROLLBAR
   ==================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #F8FAFC; }
::-webkit-scrollbar-thumb { background: #CBD5E1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #168B9A; }

/* ====================================
   CORPORATE CARD & CONTAINER UTILITIES
   ==================================== */
.corporate-card {
  @apply rounded-xl border border-pharma-border shadow-sm hover:shadow-md transition-all duration-300;
}

.corporate-card-hover {
  @apply bg-white rounded-xl border border-pharma-border hover:border-biotech-green/40 shadow-sm hover:shadow-xl transition-all duration-300 hover:-translate-y-1;
}

.corporate-input {
  @apply bg-white border border-pharma-border rounded-lg focus:ring-2 focus:ring-biotech-green/20 focus:border-biotech-green transition-all;
  color: #16324F;
}

.section-tag {
  @apply px-3.5 py-1 rounded-full bg-pharma-sky border border-pharma-border text-blue-800 text-xs font-bold uppercase tracking-wider inline-flex items-center gap-1.5 shadow-sm;
}

.section-heading {
  @apply text-2xl sm:text-3xl lg:text-4xl xl:text-5xl font-extrabold text-pharma-deep tracking-tight leading-tight;
}

.section-subheading {
  @apply text-sm sm:text-base lg:text-lg font-normal leading-relaxed max-w-3xl;
  color: #5D7285;
}

/* ====================================
   GLASSMORPHISM (used by admin login)
   ==================================== */
.glass-panel {
  background: rgba(3, 25, 48, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.glass-input {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  @apply rounded-xl text-sm;
}

.glass-input:focus {
  outline: none;
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(255, 255, 255, 0.1);
}

/* ====================================
   HERO SLIDER — FULL-WIDTH
   ==================================== */
.hero-slider {
  position: relative;
  width: 100%;
  height: 640px;
  overflow: hidden;
  background-color: #031930;
}

@media (min-width: 640px) {
  .hero-slider { height: 680px; }
}

@media (min-width: 1024px) {
  .hero-slider { height: 700px; }
}

/* On very small screens shrink slightly */
@media (max-width: 374px) {
  .hero-slider { height: 600px; }
}

.hero-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.6s ease-in-out, visibility 0.6s ease-in-out;
  pointer-events: none;
  z-index: 0;
}

.hero-slide.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  z-index: 10;
}

.hero-background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 30%;
  z-index: 1;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: linear-gradient(
    90deg,
    rgba(4, 20, 38, 0.96) 0%,
    rgba(4, 20, 38, 0.82) 50%,
    rgba(4, 20, 38, 0.30) 100%
  );
}

/* On mobile, use a top-to-bottom overlay for better readability */
@media (max-width: 639px) {
  .hero-overlay {
    background: linear-gradient(
      to bottom,
      rgba(4, 20, 38, 0.75) 0%,
      rgba(4, 20, 38, 0.90) 60%,
      rgba(4, 20, 38, 0.97) 100%
    );
  }
}

.hero-content {
  position: relative;
  z-index: 3;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  padding: 0 1rem;
}

@media (min-width: 640px) {
  .hero-content { padding: 0 1.5rem; }
}

@media (min-width: 1024px) {
  .hero-content { padding: 0 2rem; }
}

.hero-copy {
  max-width: 100%;
}

@media (min-width: 768px) {
  .hero-copy { max-width: 620px; }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.875rem;
  border-radius: 9999px;
  background-color: rgba(16, 185, 129, 0.18);
  border: 1px solid rgba(52, 211, 153, 0.4);
  color: #34d399;
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  backdrop-filter: blur(8px);
}

.hero-slider h1 {
  color: #ffffff !important;
  font-size: clamp(1.6rem, 5vw, 3.5rem) !important;
  font-weight: 800 !important;
  line-height: 1.18 !important;
  letter-spacing: -0.02em !important;
  margin: 0 !important;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.6) !important;
}

.hero-slider p {
  color: rgba(241, 245, 249, 0.92) !important;
  font-size: clamp(0.85rem, 1.5vw, 1.1rem) !important;
  line-height: 1.65 !important;
  margin: 0 !important;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55) !important;
}

.hero-features {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.625rem;
}

@media (min-width: 480px) {
  .hero-features {
    grid-template-columns: repeat(2, 1fr);
  }
}

.feature-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  background: rgba(255, 255, 255, 0.1);
  padding: 0.5rem 0.75rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
}

.feature-icon {
  width: 1.375rem;
  height: 1.375rem;
  color: #34d399;
  flex-shrink: 0;
}

.feature-title {
  color: #ffffff !important;
  font-size: 0.8rem !important;
  font-weight: 700 !important;
  margin: 0 !important;
  line-height: 1.2 !important;
}

.feature-desc {
  color: rgba(226, 232, 240, 0.82) !important;
  font-size: 0.7rem !important;
  font-weight: 400 !important;
  margin: 0 !important;
  line-height: 1.25 !important;
}

/* Hero Navigation Arrows */
.hero-prev,
.hero-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 9999px;
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(8px);
}

@media (min-width: 768px) {
  .hero-prev, .hero-next { width: 3rem; height: 3rem; }
}

.hero-prev { left: 0.75rem; }
.hero-next { right: 0.75rem; }

@media (min-width: 768px) {
  .hero-prev { left: 1.25rem; }
  .hero-next { right: 1.25rem; }
}

.hero-prev:hover,
.hero-next:hover {
  background: #10b981;
  border-color: #10b981;
  transform: translateY(-50%) scale(1.08);
}

/* Hero Pagination Dots */
.hero-pagination {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(15, 23, 42, 0.75);
  padding: 0.375rem 0.75rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
}

.hero-pagination-dot {
  height: 0.5rem;
  border-radius: 9999px;
  transition: all 0.3s ease;
  cursor: pointer;
  border: none;
  outline: none;
  padding: 0;
}

.hero-pagination-dot.active {
  width: 1.75rem;
  background-color: #34d399;
}

.hero-pagination-dot.inactive {
  width: 0.5rem;
  background-color: rgba(255, 255, 255, 0.4);
}

.hero-pagination-dot.inactive:hover {
  background-color: rgba(255, 255, 255, 0.75);
}

/* ====================================
   GLOBAL RESPONSIVE HELPERS
   ==================================== */

/* Prevent any element from causing horizontal overflow */
.overflow-x-safe {
  overflow-x: hidden;
  max-width: 100vw;
}

/* Responsive grid helpers */
.grid-responsive-2 {
  @apply grid grid-cols-1 sm:grid-cols-2 gap-4 sm:gap-6;
}

.grid-responsive-3 {
  @apply grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-6;
}

.grid-responsive-4 {
  @apply grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4;
}

/* Responsive section padding */
.section-pad {
  @apply py-12 sm:py-16 lg:py-20 xl:py-24;
}

.section-pad-sm {
  @apply py-8 sm:py-12 lg:py-16;
}

/* Responsive container */
.container-xl {
  @apply w-full max-w-screen-xl mx-auto px-4 sm:px-6 lg:px-8;
}

/* Touch-friendly buttons — minimum 44x44px tap target */
.btn-touch {
  min-height: 44px;
  min-width: 44px;
  @apply flex items-center justify-center;
}

/* ====================================
   MOBILE TABLE OVERFLOW GUARD
   ==================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* ====================================
   MODAL RESPONSIVE OVERLAY
   ==================================== */
.modal-overlay {
  @apply fixed inset-0 z-50 overflow-y-auto overflow-x-hidden;
}

.modal-panel {
  @apply w-full max-w-lg mx-auto my-4 sm:my-8 px-4 sm:px-0;
}

/* ====================================
   ADMIN PANEL DARK THEME
   ==================================== */
.admin-sidebar {
  @apply bg-[#031930] border-r border-slate-800;
  width: 280px;
  flex-shrink: 0;
}

.admin-card {
  @apply rounded-xl bg-slate-900 border border-slate-800 p-4 sm:p-5;
}

/* ====================================
   PRINT / HIDDEN UTILITIES
   ==================================== */
@media print {
  .no-print { display: none !important; }
}