@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

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

@layer base {
  :root {
    /* Government institutional color palette */
    --background: 210 20% 98%;
    --foreground: 222 47% 11%;

    --card: 0 0% 100%;
    --card-foreground: 222 47% 11%;

    --popover: 0 0% 100%;
    --popover-foreground: 222 47% 11%;

    /* Primary - Deep Navy Blue (Trust/Authority) */
    --primary: 222 47% 20%;
    --primary-foreground: 210 40% 98%;

    /* Secondary - Slate */
    --secondary: 215 20% 95%;
    --secondary-foreground: 222 47% 20%;

    --muted: 215 20% 94%;
    --muted-foreground: 215 16% 47%;

    --accent: 215 25% 90%;
    --accent-foreground: 222 47% 20%;

    --destructive: 0 72% 51%;
    --destructive-foreground: 0 0% 100%;

    --border: 214 32% 91%;
    --input: 214 32% 91%;
    --ring: 222 47% 20%;

    --radius: 0.5rem;

    /* Module-specific accent colors */
    --admin: 262 83% 58%;
    --admin-light: 262 83% 95%;
    --org: 142 71% 45%;
    --org-light: 142 71% 95%;
    --rh: 217 91% 60%;
    --rh-light: 217 91% 95%;
    --budget: 32 95% 52%;
    --budget-light: 32 95% 95%;
    --treasury: 174 72% 40%;
    --treasury-light: 174 72% 95%;
    --common: 215 16% 47%;
    --common-light: 215 16% 95%;

    /* Status colors */
    --success: 142 71% 45%;
    --success-light: 142 71% 95%;
    --warning: 38 92% 50%;
    --warning-light: 38 92% 95%;
    --info: 217 91% 60%;
    --info-light: 217 91% 95%;
    --pending: 32 95% 52%;
    --pending-light: 32 95% 95%;

    /* Sidebar */
    --sidebar-background: 222 47% 11%;
    --sidebar-foreground: 210 40% 98%;
    --sidebar-primary: 217 91% 60%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 222 47% 18%;
    --sidebar-accent-foreground: 210 40% 98%;
    --sidebar-border: 222 47% 20%;
    --sidebar-ring: 217 91% 60%;
    --sidebar-muted: 215 20% 65%;
  }

  .dark {
    --background: 222 47% 8%;
    --foreground: 210 40% 98%;

    --card: 222 47% 11%;
    --card-foreground: 210 40% 98%;

    --popover: 222 47% 11%;
    --popover-foreground: 210 40% 98%;

    --primary: 217 91% 60%;
    --primary-foreground: 222 47% 11%;

    --secondary: 222 47% 18%;
    --secondary-foreground: 210 40% 98%;

    --muted: 222 47% 18%;
    --muted-foreground: 215 20% 65%;

    --accent: 222 47% 18%;
    --accent-foreground: 210 40% 98%;

    --destructive: 0 62% 45%;
    --destructive-foreground: 210 40% 98%;

    --border: 222 47% 20%;
    --input: 222 47% 20%;
    --ring: 217 91% 60%;

    --sidebar-background: 222 47% 6%;
    --sidebar-foreground: 210 40% 98%;
    --sidebar-primary: 217 91% 60%;
    --sidebar-primary-foreground: 0 0% 100%;
    --sidebar-accent: 222 47% 15%;
    --sidebar-accent-foreground: 210 40% 98%;
    --sidebar-border: 222 47% 15%;
  }
}

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

  body {
    @apply bg-background text-foreground font-sans antialiased;
    font-family: 'Inter', system-ui, sans-serif;
  }
}

@layer components {

  /* Government badge styles */
  .gov-badge {
    @apply inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium;
  }

  .gov-badge-success {
    @apply bg-[hsl(var(--success-light))] text-[hsl(var(--success))];
  }

  .gov-badge-warning {
    background-color: hsl(var(--warning-light));
    color: hsl(38, 92%, 25%);
  }

  .gov-badge-info {
    background-color: hsl(var(--info-light));
    color: hsl(217, 91%, 40%);
  }

  .gov-badge-pending {
    background-color: hsl(var(--pending-light));
    color: hsl(32, 95%, 35%);
  }

  .gov-badge-destructive {
    @apply bg-red-100 text-red-700;
  }

  /* Card hover effect */
  .gov-card {
    @apply bg-card rounded-lg border border-border shadow-sm transition-all duration-200;
  }

  .gov-card:hover {
    @apply shadow-md border-primary/20;
  }

  /* Stats card */
  .stats-card {
    @apply gov-card p-6;
  }

  /* Table row hover */
  .table-row-hover {
    @apply transition-colors hover:bg-muted/50;
  }

  /* Module accent backgrounds */
  .module-admin {
    @apply bg-[hsl(var(--admin-light))] text-[hsl(var(--admin))];
  }

  .module-org {
    @apply bg-[hsl(var(--org-light))] text-[hsl(var(--org))];
  }

  .module-rh {
    @apply bg-[hsl(var(--rh-light))] text-[hsl(var(--rh))];
  }

  .module-budget {
    @apply bg-[hsl(var(--budget-light))] text-[hsl(var(--budget))];
  }

  .module-treasury {
    @apply bg-[hsl(var(--treasury-light))] text-[hsl(var(--treasury))];
  }

  .module-common {
    @apply bg-[hsl(var(--common-light))] text-[hsl(var(--common))];
  }
}

@layer utilities {

  /* Animations */
  .animate-fade-in {
    animation: fadeIn 0.3s ease-out;
  }

  .animate-slide-in-left {
    animation: slideInLeft 0.3s ease-out;
  }

  .animate-slide-in-right {
    animation: slideInRight 0.3s ease-out;
  }

  .animate-scale-in {
    animation: scaleIn 0.2s ease-out;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(10px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  @keyframes slideInLeft {
    from {
      opacity: 0;
      transform: translateX(-20px);
    }

    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes slideInRight {
    from {
      opacity: 0;
      transform: translateX(20px);
    }

    to {
      opacity: 1;
      transform: translateX(0);
    }
  }

  @keyframes scaleIn {
    from {
      opacity: 0;
      transform: scale(0.95);
    }

    to {
      opacity: 1;
      transform: scale(1);
    }
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 10mm;
  }

  /* Force absolute white background for everything */
  html,
  body {
    background-color: #fff !important;
    background: #fff !important;
    color: #000 !important;
    font-size: 10pt !important;
    width: 100% !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Hide UI elements */
  .no-print,
  nav,
  aside,
  header,
  button,
  .dropdown-menu,
  .pagination,
  .filter-panel,
  [role="combobox"],
  .no-print-area,
  [aria-haspopup="listbox"],
  footer {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  /* Remove all shadows, backgrounds and force full visibility */
  main,
  .mx-auto,
  .max-w-7xl,
  .gov-card,
  .overflow-x-auto {
    width: 100% !important;
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    box-shadow: none !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
  }

  /* Professional Table Styles */
  table {
    width: 100% !important;
    border-collapse: collapse !important;
    table-layout: auto !important;
    margin-top: 10mm !important;
    page-break-inside: auto;
    background: #fff !important;
  }

  th,
  td {
    border: 0.5pt solid #000 !important;
    padding: 8pt 6pt !important;
    text-align: left !important;
    color: #000 !important;
  }

  th {
    background-color: #eaeff2 !important;
    /* Very light gray for header */
    font-weight: bold !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  tr {
    page-break-inside: avoid;
    page-break-after: auto;
  }

  thead {
    display: table-header-group;
  }

  /* Hide specific elements by class */
  .no-print,
  th.no-print,
  td.no-print {
    display: none !important;
  }

  /* Better Typography */
  h1,
  h2,
  h3,
  h4,
  p,
  span {
    color: #000 !important;
    text-shadow: none !important;
  }

  /* Remove interactive indicators */
  ::-webkit-scrollbar {
    display: none !important;
  }

  a {
    text-decoration: none !important;
    color: #000 !important;
  }
}