/* ============================================
   GLOBAL THEME MASTER STYLES
   ============================================
   This file consolidates all critical table and form styling.
   It loads LAST (highest weight) to ensure clean application.
   NO cascade conflicts. NO !important needed.
   ============================================ */

/* ============================================
   TABLE STYLING - UNIVERSAL
   ============================================ */

/* Base table styles - apply to ALL tables */
table {
  border-collapse: separate;
  border-spacing: 0;
  width: 100%;
}

/* All table headers and cells get borders */
table th,
table td {
  border: 1px solid #e5e7eb;
  box-sizing: border-box;
  padding: 12px 16px;
  text-align: left;
  font-size: 0.875rem;
}

/* Table header styling */
table thead {
  background-color: #f3f4f6;
}

table thead th {
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Table body row styling */
table tbody tr {
  transition: background-color 0.2s ease;
}

table tbody tr:hover {
  background-color: #f9fafb;
}

table tbody td {
  color: #1f2937;
}

/* Table links */
table a {
  color: #2563eb;
  font-weight: 600;
  text-decoration: none;
}

table a:hover {
  color: #1d4ed8;
  text-decoration: underline;
}

/* Remove last cell right border */
table th:last-child,
table td:last-child {
  border-right: none;
}

/* ============================================
   PROJECTS TABLE - SPECIFIC
   ============================================ */

table.projects-table {
  background-color: #ffffff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

table.projects-table thead {
  background: linear-gradient(to right, #eff6ff, #e0f2fe);
}

table.projects-table thead th {
  color: #0c4a6e;
  padding: 16px 24px;
}

table.projects-table tbody td {
  padding: 16px 24px;
}

/* ============================================
   FORMS & FILTERS - UNIVERSAL
   ============================================ */

/* Form containers */
form {
  margin-bottom: 1rem;
}

/* Form groups and items */
.form-item,
.form-group {
  margin-bottom: 1rem;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Form labels */
label {
  font-size: 0.875rem;
  font-weight: 600;
  color: #374151;
  display: block;
}

/* Form inputs and selects */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
input[type="number"],
select,
textarea {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background-color: #ffffff;
  color: #0f172a;
  font-size: 0.875rem;
  font-family: inherit;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

/* Input focus states */
input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.1);
}

/* ============================================
   VIEWS EXPOSED FILTERS - SINGLE ROW LAYOUT
   ============================================ */

/* Views exposed form - keep all on one row */
.views-exposed-form {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  align-items: flex-end;
  margin-bottom: 1.5rem;
  align-items: center;
}

.views-exposed-form > * {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Widgets container - grows to fill space */
.views-exposed-widgets {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  flex: 1 1 auto;
  min-width: 0;
  align-items: flex-end;
  overflow-x: auto;
}

/* Individual filter widget */
.views-exposed-widget,
.views-exposed-form .form-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 0 1 auto;
  min-width: 140px;
}

/* Form actions (buttons) stay on same row */
.views-exposed-form .form-actions,
.form-actions {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-wrap: nowrap;
}

/* ============================================
   BUTTONS - UNIVERSAL
   ============================================ */

button,
input[type="submit"],
input[type="button"],
.button {
  background-color: #0284c7;
  color: #ffffff;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  transition: background-color 0.2s ease;
  white-space: nowrap;
}

button:hover,
input[type="submit"]:hover,
input[type="button"]:hover,
.button:hover {
  background-color: #0369a1;
}

/* Add New Project button - highlighted */
.btn-add-project,
a.button.btn-add-project {
  background-color: #f97316;
  padding: 10px 18px;
  font-weight: 700;
}

.btn-add-project:hover,
a.button.btn-add-project:hover {
  background-color: #ea580c;
}

/* ============================================
   PAGINATION
   ============================================ */

.pager {
  padding: 1rem 0;
  margin: 0;
}

.pager__items {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.pager__item {
  list-style: none;
  margin: 0;
  padding: 0;
}

.pager__item a,
.pager__item span {
  display: inline-block;
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  color: #374151;
  text-decoration: none;
  transition: all 0.2s;
}

.pager__item a:hover {
  background-color: #f3f4f6;
  border-color: #9ca3af;
}

.pager__item.is-active a,
.pager__item.is-active span {
  background-color: #0284c7;
  border-color: #0284c7;
  color: white;
  font-weight: 600;
}

/* Remove double borders ONLY from Next, Previous, First, Last */
.pager__item--next a,
.pager__item--previous a,
.pager__item--first a,
.pager__item--last a {
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
}


/* ============================================
   TAGS & FIELD STYLING
   ============================================ */

/* Tag/multi-value field styling */
.field--type-entity-reference,
.field--type-taxonomy-term-reference,
.entity-reference-field {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Individual tag */
.field__item,
.entity-reference-field-item {
  display: inline-block;
  background-color: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 0.875rem;
  color: #0c4a6e;
}

/* Remove links from tags */
.field__item a,
.entity-reference-field-item a {
  color: inherit;
  text-decoration: none;
  font-weight: 600;
}

.field__item a:hover,
.entity-reference-field-item a:hover {
  text-decoration: none;
  cursor: text;
}

/* ============================================
   RESPONSIVE
   ============================================ */

@media (max-width: 1024px) {
  .views-exposed-widgets {
    flex-wrap: wrap;
  }

  .views-exposed-widget,
  .views-exposed-form .form-item {
    min-width: 130px;
  }
}

@media (max-width: 768px) {
  table th,
  table td {
    padding: 10px 12px;
    font-size: 0.75rem;
  }

  table.projects-table thead th,
  table.projects-table tbody td {
    padding: 12px 16px;
  }

  .views-exposed-form {
    flex-wrap: wrap;
    
  }

  .views-exposed-widgets {
    flex-wrap: wrap;
    width: 100%;
  }

  .views-exposed-form .form-item,
  .views-exposed-form .views-exposed-widget {
    width: auto;
    min-width: 120px;
  }

  .views-exposed-form .form-actions {
    width: auto;
  }

  .views-exposed-form .form-actions button,
  .views-exposed-form .form-actions .button,
  .views-exposed-form .form-actions input[type="submit"] {
    flex: 0 1 auto;
  }
}

@media (max-width: 640px) {
  table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .views-exposed-form {
    flex-direction: column;
  }

  .views-exposed-widgets {
    width: 100%;
  }

  .views-exposed-form .form-actions {
    width: 100%;
  }

  .views-exposed-form .form-actions button,
  .views-exposed-form .form-actions .button,
  .views-exposed-form .form-actions input[type="submit"] {
    flex: 1;
  }
}

.block--cif-theme-introcta a {
  display: inline-block;
  background-color: #f97316;
  color: white !important;
  padding: 1rem 3rem;
  font-weight: 700;
  text-decoration: none;
  font-size: 1.125rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: 0;
}

.block--cif-theme-introcta a:hover {
  background-color: #ea580c;
}

/* ============================================
   FIX: Remove double scrollbars caused by toolbar
   ============================================ */

html,
body {
  overflow-y: visible !important;
  overflow-x: hidden !important;
  height: auto !important;
  min-height: 100vh;
}

body.toolbar-horizontal.toolbar-fixed {
  overflow-y: visible !important;
  height: auto !important;
}

.dialog-off-canvas-main-canvas {
  overflow-y: visible !important;
  overflow-x: hidden !important;
  height: auto !important;
  min-height: calc(100vh - 39px); /* Account for toolbar height */
}

main.cif-main {
  overflow-y: visible !important;
  overflow-x: hidden !important;
  height: auto !important;
}