/* ========================================
   AEH Design System
   Ethiopian Education Platform
   ======================================== */

@layer base {
  html {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
  }

  body {
    @apply bg-white text-slate-900 leading-relaxed;
  }

  h1, h2, h3, h4, h5, h6 {
    @apply font-heading font-bold text-slate-900 tracking-tight;
  }

  a {
    @apply transition-colors duration-150;
  }

  img {
    @apply max-w-full h-auto;
  }

  *:focus-visible {
    @apply outline-none;
  }

  input:focus, textarea:focus, select:focus,
  input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: none !important;
    box-shadow: none !important;
    --tw-ring-shadow: none !important;
    --tw-ring-offset-width: 0px !important;
  }

  ::selection {
    @apply bg-primary-500/15;
  }
}

@layer components {
  /* Layout */
  .container-tight {
    @apply max-w-reading mx-auto px-4;
  }

  .container-wide {
    @apply max-w-content mx-auto px-4;
  }

  /* Navigation */
  .nav-link {
    @apply inline-flex items-center px-3 py-2 text-sm font-medium text-slate-600 hover:text-primary-500 transition-colors;
  }

  .nav-link-active {
    @apply text-primary-500;
  }

  .nav-link-mobile {
    @apply block px-4 py-3 text-base font-medium text-slate-700 hover:bg-slate-50 hover:text-primary-500 transition-colors border-b border-slate-100 last:border-0;
  }

  /* Buttons */
  .btn {
    @apply inline-flex items-center justify-center gap-2 px-5 py-2.5 rounded-lg font-semibold text-sm transition-all duration-150;
  }

  .btn:active {
    @apply scale-[0.98];
  }

  .btn-primary {
    @apply bg-primary-500 text-white hover:bg-primary-600 shadow-xs;
  }

  .btn-secondary {
    @apply bg-slate-100 text-slate-700 hover:bg-slate-200;
  }

  .btn-outline {
    @apply bg-white text-slate-700 border border-slate-200 hover:border-slate-300 hover:bg-slate-50;
  }

  .btn-ghost {
    @apply bg-transparent text-slate-600 hover:text-slate-900 hover:bg-slate-100;
  }

  .btn-sm {
    @apply px-3.5 py-1.5 text-xs;
  }

  .btn-lg {
    @apply px-6 py-3 text-base;
  }

  /* Forms */
  .form-input {
    @apply w-full px-3.5 py-2.5 bg-white border border-slate-200 rounded-lg text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-all;
  }

  .form-label {
    @apply block text-sm font-medium text-slate-700 mb-1.5;
  }

  .form-select {
    @apply w-full px-3.5 py-2.5 bg-white border border-slate-200 rounded-lg text-sm text-slate-900 appearance-none focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-all cursor-pointer;
  }

  .form-textarea {
    @apply w-full px-3.5 py-2.5 bg-white border border-slate-200 rounded-lg text-sm text-slate-900 placeholder:text-slate-400 focus:outline-none focus:ring-2 focus:ring-primary-500/20 focus:border-primary-500 transition-all resize-y min-h-[80px];
  }

  /* Cards */
  .card {
    @apply bg-white border border-slate-200 rounded-xl;
  }

  .card-hover {
    @apply transition-all duration-150 hover:shadow-card-hover hover:border-slate-300;
  }

  /* Badges */
  .badge {
    @apply inline-flex items-center gap-1 px-2 py-0.5 rounded-full text-xs font-medium;
  }

  .badge-primary {
    @apply bg-primary-50 text-primary-600;
  }

  .badge-accent {
    @apply bg-accent-50 text-accent-600;
  }

  .badge-slate {
    @apply bg-slate-100 text-slate-600;
  }

  .badge-outline {
    @apply bg-transparent border border-slate-200 text-slate-500;
  }

  /* Sections */
  .section {
    @apply py-12 md:py-16;
  }

  .section-sm {
    @apply py-8 md:py-12;
  }

  /* Alerts */
  .alert {
    @apply p-4 rounded-lg text-sm;
  }

  .alert-success {
    @apply bg-accent-50 text-accent-700 border border-accent-200;
  }

  .alert-error {
    @apply bg-red-50 text-red-700 border border-red-200;
  }

  /* Hero */
  .hero {
    @apply bg-navy-500 text-white;
  }

  .hero-light {
    @apply bg-slate-25 text-slate-900 border-b border-slate-100;
  }

  /* Article card */
  .article-card {
    @apply card overflow-hidden card-hover;
  }

  .article-card img {
    @apply w-full h-48 object-cover;
  }

  /* Book card */
  .book-card {
    @apply card p-4 card-hover;
  }

  /* Divider */
  .divider {
    @apply h-px bg-slate-100;
  }

  /* Tabs */
  .tab-btn {
    @apply px-4 py-2.5 text-sm font-medium text-slate-500 hover:text-slate-700 border-b-2 border-transparent transition-colors;
  }

  .tab-btn-active {
    @apply text-primary-500 border-primary-500;
  }

  /* Pagination */
  .pagination-btn {
    @apply px-3 py-1.5 text-sm font-medium rounded-lg border border-slate-200 hover:bg-slate-50 transition-colors;
  }

  .pagination-btn-active {
    @apply bg-primary-500 text-white border-primary-500;
  }

  .pagination-btn-disabled {
    @apply opacity-40 cursor-not-allowed;
  }

  /* Empty state */
  .empty-state {
    @apply text-center py-16 px-4;
  }

  .empty-state-icon {
    @apply w-12 h-12 text-slate-300 mx-auto mb-4;
  }

  /* Table */
  .table-container {
    @apply overflow-x-auto border border-slate-200 rounded-lg;
  }

  .data-table {
    @apply w-full text-sm;
  }

  .data-table th {
    @apply px-4 py-3 text-left text-xs font-semibold text-slate-500 uppercase tracking-wider bg-slate-50 border-b border-slate-200;
  }

  .data-table td {
    @apply px-4 py-3 text-slate-700 border-b border-slate-100;
  }

  .data-table tbody tr:hover {
    @apply bg-slate-50;
  }
}

@layer utilities {
  .line-clamp-1 {
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .line-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .scrollbar-hide {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .scrollbar-hide::-webkit-scrollbar {
    display: none;
  }

  .text-balance {
    text-wrap: balance;
  }

  /* Soften border intensity & blur box shadows across all student portal cards and boxes */
  .border-ae-slate-200,
  .border-slate-200,
  .border-gray-200 {
    border-color: rgba(226, 232, 240, 0.55) !important;
  }

  .border-ae-slate-100,
  .border-slate-100,
  .border-gray-100 {
    border-color: rgba(241, 245, 249, 0.75) !important;
  }

  .shadow-2xs,
  .shadow-xs,
  .shadow-sm,
  .shadow-md {
    box-shadow: 0 4px 20px -2px rgba(15, 23, 42, 0.035), 0 2px 6px -1px rgba(15, 23, 42, 0.02) !important;
  }

  .hover\:shadow-md:hover,
  .hover\:shadow-lg:hover {
    box-shadow: 0 10px 25px -4px rgba(15, 23, 42, 0.06), 0 4px 10px -2px rgba(15, 23, 42, 0.03) !important;
  }
}

@media print {
  body {
    @apply bg-white text-black;
  }
  .no-print {
    display: none !important;
  }
}
