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

:root {
  /* Primary colors */
  --color-primary: #fe6565;
  --color-primary-dark: #dc3f3f;
  --color-primary-xdark: #882323;

  /* Background colors */
  --color-bg-light: #f5f5f5;
  --color-bg-white: #ffffff;
  --color-bg-mint: #cae1e5;

  /* Text colors */
  --color-text-dark: #383f46;
  --color-text-display: #243b76;
  --color-text-mint-dark: #0e3e42;
  --color-text-muted: #666666;

  /* Border colors */
  --color-border: #dddddd;

  /* Status colors */
  --color-success: #00a854;
  --color-success-dark: #008c46; /* Add this darker shade */
  --color-danger: #c82333;

  /* Badge colors (from the M1, M2, M3, IF tags) */
  --color-badge-blue: #007bff;
  --color-badge-bg: #e9ecef;
}

body {
  font-family: "Roboto", sans-serif;
  font-weight: 400;
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px;
  color: var(--color-text-dark);
}

.hidden {
  display: none;
}

.light {
  font-weight: 200;
}

/* Fallback for Tailwind utilities when not present during dev */
.text-xs {
  font-size: 0.75rem !important;
  line-height: 1rem !important;
}

/* Fallback for Tailwind `text-sm` (14px) when utilities aren't available */
.text-sm {
  font-size: 0.875rem !important;
  line-height: 1.25rem !important;
}

/* Defensive fallback: ensure `.uppercase` works if Tailwind utility is missing */
.uppercase {
  text-transform: uppercase !important;
}

/* Fallback for Tailwind negative margin utility used in markup */
.-mt-3 {
  margin-top: -0.75rem !important;
}

/* Fallback for Tailwind negative margin utility -mt-2 */
.-mt-2 {
  margin-top: -0.5rem !important;
}

.bold {
  font-weight: 900;
}

h1 {
  color: var(--color-text-display);
  font-size: 2.8em;
}
h4 {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

a {
  color: #067e98;
  text-decoration: none;
}
a:hover {
  /* color: var(--color-primary-xdark); */
  text-decoration: underline;
}

.form-container {
  box-shadow: 0 0 12px rgba(0, 0, 0, 0.16);
  background-color: #ffffff;
  border-radius: 16px;
  padding: 20px 36px;
  margin-bottom: 20px;
}

/* Summary cards */
.summary-cards {
  display: flex;
  gap: 16px;
  margin: 18px 0 24px 0;
}
/* Ensure the hidden utility still hides the summary cards when present */
.summary-cards.hidden {
  display: none !important;
}
.summary-cards .card {
  flex: 1 1 0;
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 4px rgba(16, 24, 40, 0.04);
  display: flex;
  align-items: center;
  gap: 14px;
}
.summary-cards .card-icon {
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f7f6;
  border-radius: 8px;
  font-size: 20px;
  border: 1px solid #d7eef1;
}
/* Ensure SVG icons inside the card icon container fit nicely */
.summary-cards .card-icon img {
  width: 28px;
  height: 28px;
  display: block;
}
.summary-cards .card-number {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-text-display);
}
.summary-cards .card-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-top: -4px;
}

@media (max-width: 720px) {
  .summary-cards {
    flex-direction: column;
  }
}

.form-group {
  margin-bottom: 15px;
}

.form-group label {
  color: var(--color-text-display);
  margin-bottom: 8px;
  font-weight: bold;
}

.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.form-actions input[type="url"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
}

/* Make the login password input match the same style as the app input */
.login-box input[type="password"] {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--color-border);
  border-radius: 4px;
  box-sizing: border-box;
}

/* Make the Sign in button full width within the login form and remove left margin */
#loginForm button[type="submit"] {
  margin-left: 0;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
#loginForm button[type="submit"]:hover {
  color: #ffffff;
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
}

button {
  padding: 10px 20px;
  background: var(--color-primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 10px;
  min-width: auto;
}

button:hover {
  background: var(--color-primary-dark);
}

.form-actions button {
  min-width: 180px;
}

.clear-btn {
  background: transparent;
  color: var(--color-text-dark);
  min-width: auto;
  border: transparent solid 1px;
}
.clear-btn:hover {
  color: #bc0000;
  border-color: #bc0000;
  background-color: #ffeded;
}

/* Smaller table action buttons */
.clear-btn {
  padding: 6px 8px;
  font-size: 0.95rem;
  border-radius: 8px;
  margin-left: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

button:disabled {
  background: #ccc;
  cursor: not-allowed;
}

button i {
  margin-right: 8px;
}

#emptyState {
  text-align: center;
}

#emptyState img {
  width: 340px;
  margin: 0 auto;
}

#emptyState h2 {
  color: var(--color-text-display);
  font-size: 1.6em;
  margin-top: -60px;
}

.loading {
  color: var(--color-text-muted);
  font-style: italic;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
}

/* Ensure table elements are transparent so the surrounding container controls background */
table.bg-white,
#resultsTable.bg-white {
  background-color: transparent !important;
}

/* Make table body and cells transparent (keep header `th` styling intact) */
#resultsTable tbody,
#resultsTable tbody tr,
#resultsTable tbody td {
  background-color: transparent !important;
}

/* Stronger specificity to override any utility-generated rules while developing */
table#resultsTable,
table#resultsTable tbody,
table#resultsTable tbody tr,
table#resultsTable tbody td,
table#resultsTable td {
  background-color: transparent !important;
}

/* If the surrounding container has a background, ensure the results area is white */
.table-container {
  background-color: #ffffff !important;
  border-radius: 12px;
  /* box-shadow: 0px 1px 4px rgba(0, 0, 0, 0.12); */
  border: #cae1e5 solid 1px;
}

th,
td {
  border: none;
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

th:first-child {
  padding-left: 20px;
}
th:last-child {
  padding-right: 20px;
}

th {
  background-color: var(--color-bg-mint);
  color: var(--color-text-mint-dark);
  font-weight: normal;
  position: relative;
  padding-right: 24px;
  border-right: #ffffff solid 1px;
  text-transform: uppercase;
  font-size: 0.8rem;
  padding: 10px 12px;
}

th:first-child {
  border-radius: 12px 0 0 0;
}

/* Remove row hover highlight for now */
tr:hover {
  background-color: transparent;
}

th:last-child {
  border-radius: 0 12px 0 0;
  border-right: none;
}

th:nth-child(2) {
  width: 170px;
}

td {
  border-bottom: #cae1e5 solid 1px;
}

tr:last-child td {
  border-bottom: none;
}

/* Small utility fallbacks (ensure centering utilities exist) */
.min-h-screen {
  min-height: 100vh;
}
.justify-center {
  justify-content: center;
}

/* Ensure the login container is at least 680px wide on larger screens */
@media (min-width: 1024px) {
  .login-box {
    min-width: 680px;
    max-width: 920px; /* allow some upper bound */
  }
}

ol {
  list-style-type: auto;
}

#status {
  display: none;
  position: absolute;
  padding: 40px;
  background-color: #ffffff70;
  left: 50%;
  transform: translateX(-50%);
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
  border-radius: 55px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  margin-top: -72px;
}
#status:empty {
  display: none;
}
#status.has-content {
  display: block;
}

.found {
  color: var(--color-success);
  font-weight: bold;
}

.not-found {
  color: var(--color-danger);
}

.url-cell {
  max-width: 200px;
  word-break: break-all;
}

.context-cell {
  max-width: 300px;
  word-wrap: break-word;
}

.export-btn {
  background-color: transparent;
  color: var(--color-success-dark);
  padding: 0.5rem 1rem;
  border: 1px solid var(--color-success-dark);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  min-width: auto;
}

/* Tighter export button for table actions */
.export-btn {
  padding: 6px 10px;
  font-size: 0.95rem;
  border-radius: 10px;
  gap: 8px;
}

.export-btn:hover {
  background-color: rgba(0, 140, 70, 0.05);
  box-shadow: 0 1px 2px rgba(0, 140, 70, 0.08);
}

.export-btn .bi {
  margin-right: 0;
}

.test-btn {
  background-color: var(--color-bg-mint);
  color: var(--color-text-mint-dark);
  border: 1px solid var(--color-text-mint-dark);
  min-width: auto;
}

.test-btn:hover {
  background-color: var(--color-text-mint-dark);
  color: white;
}

/* Sign out button style: transparent background, muted text, icon on the right */
.signout-btn {
  background: transparent;
  border: none;
  color: #071431;
  padding: 6px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.95rem;
}
.signout-btn svg {
  display: inline-block;
  width: 20px;
  height: 20px;
  stroke: currentColor;
}

.signout-btn:hover {
  /* color: #ffffff; */
  background-color: #b6cfda;
}

#test-section {
  border-top: 1px solid var(--color-border);
  margin-top: 2rem;
  padding-top: 2rem;
}

.sort-btn {
  background: none;
  border: none;
  padding: 0 4px;
  cursor: pointer;
  color: #0e3e42;
  min-width: auto;
  text-align: center;
  float: right;
}
.sort-btn i {
  margin: 0;
}

.sort-btn:hover {
  background-color: #ffffff;
  color: var(--color-text-mint-dark);
}

.sort-btn.active-sort {
  background-color: #4a7979;
  color: #fff;
  border-radius: 4px;
  font-weight: bold;
}
.sort-btn.active-sort:hover {
  background-color: #4a7979;
  color: #fff;
}

.edit-date-btn {
  padding: 2px 8px;
  font-size: 0.85rem;
  float: right;
  text-align: center;
  margin: 0;
  background-color: #ffffff;
  color: var(--color-text-mint-dark);
}
.edit-date-btn:hover {
  color: var(--color-text-mint-dark);
  background-color: #a3dee3;
}

.edit-date-btn i {
  display: block;
  margin: 0;
}

.offense-degrees {
  list-style-type: none;
}

.offense-degrees li {
  font-size: 0.82rem;
  padding: 1px 4px;
  border-radius: 24px;
  background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  width: 44px;
  text-align: center;
  margin-bottom: 4px;
}

.offense-degrees li.felony,
.degree-badge.felony {
  background-color: #ffd9d9;
  border: 1px solid #ffacac;
}
.offense-degrees li.misdemeanor,
.degree-badge.misdemeanor {
  background-color: #ffecd9;
  border: 1px solid #fad19e;
}
.offense-degrees li.infraction,
.degree-badge.infraction {
  background-color: #fff9d9;
  border: 1px solid #f4de90;
}

.degree-badge {
  display: inline-block;
  font-size: 0.75rem;
  padding: 1px 4px;
  border-radius: 24px;
  background-color: #e6e6e6;
  border: 1px solid #bbbbbb;
  min-width: 44px;
  text-align: center;
  flex-shrink: 0;
}

/* ✅ Base styles: apply to large desktops and up */
th.th-name {
  width: 320px;
}

td.td-name {
  padding-left: 20px;
}
th.th-offense {
  width: 400px;
}
th.th-degrees {
  width: 112px;
}
th.th-date {
  width: 166px;
}
th.th-courtroom {
  width: 100px;
}
th.th-time {
  width: 110px;
}
th.th-da {
  width: 90px;
}

th.th-delete {
  width: 48px;
  border-right: none;
  text-align: center;
}

td:has(.delete-row-btn) {
  text-align: center;
}

.delete-row-btn {
  background: transparent;
  border: none;
  color: #9ca3af;
  padding: 4px 6px;
  cursor: pointer;
  min-width: auto;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}

.delete-row-btn:hover {
  color: #bc0000;
  background-color: #ffeded;
}

/* ✅ Tablet and smaller: override as needed */
@media (max-width: 1220px) {
  th.th-name,
  th.th-case {
    width: auto;
  }
}

@media (max-width: 1023px) {
  th.th-name,
  th.th-case,
  th.th-offense,
  th.th-degrees,
  th.th-date,
  th.th-courtroom,
  th.th-time {
    width: auto;
  }
}

/* Mobile: Up to 639px */
@media (min-width: 639px) {
}

/* Date Picker Styles */
.litepicker .container__days .day-item.is-end-date {
  background-color: var(--color-primary);
  color: #ffffff;
}

.litepicker .container__days .day-item:hover {
  border-color: var(--color-primary-dark);
  color: var(--color-primary-dark);
  box-shadow: inset 0 0 0 1px var(--color-primary-dark);
}
