/* Basic app styling */

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0;
  background: #f7f7f7;
  color: #222;
}

.container {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
}

.topbar {
  background: #111827;
  color: #fff;
}

/* Environment-specific navbar colors (set by app/views/main.scala.html) */
.topbar.topbar--prod {
  background: #111827; /* black (current) */
}

.topbar.topbar--local {
  background: #1d4ed8; /* blue */
}

.topbar.topbar--test {
  background: #15803d; /* green */
}

.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  color: #fff;
  text-decoration: none;
  font-weight: 700;
}

.nav a {
  color: #d1d5db;
  text-decoration: none;
  margin-left: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.nav a .bi {
  font-size: 18px;
  line-height: 1;
}

h1 {
  margin: 16px 0;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 12px;
  margin: 12px 0;
}

.card.error {
  border-color: #fecaca;
  background: #fff1f2;
  color: #9f1239;
}

.card.success {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: #166534;
}

.actions {
  margin: 12px 0;
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid #1d4ed8;
  background: #2563eb;
  color: #fff;
  text-decoration: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.2;
}

.btn.btn-secondary {
  background: #fff;
  color: #1f2937;
  border-color: #d1d5db;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 10px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
}

.table thead th {
  background: #f9fafb;
  font-weight: 600;
}

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

.table tr.is-clickable {
  cursor: pointer;
}

.table tr.is-clickable:hover td {
  background: #f9fafb;
}

.form label {
  display: block;
  margin: 12px 0;
}

.label {
  font-size: 13px;
  color: #374151;
  margin-bottom: 6px;
}

input[type="text"],
input[type="number"],
input[type="email"],
input[type="password"],
input[type="date"],
select,
textarea {
  width: 100%;
  max-width: 520px;
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
}

select {
  /* Make the native dropdown feel less "old" across browsers */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #6b7280 50%),
    linear-gradient(135deg, #6b7280 50%, transparent 50%);
  background-position: calc(100% - 18px) 50%, calc(100% - 12px) 50%;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 34px;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="email"]:focus,
input[type="password"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

textarea {
  resize: vertical;
  min-height: 90px;
}

.muted {
  color: #6b7280;
}

/* FK picker rows: keep select and the "Edit" link aligned */
.row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.row > select {
  flex: 1 1 auto;
  max-width: 520px;
}

.row > .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

/* AngularJS: prevent template flash before bootstrapping */
[ng\:cloak],
[ng-cloak],
[data-ng-cloak],
[x-ng-cloak],
.ng-cloak,
.x-ng-cloak {
  display: none !important;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 12px 0;
  user-select: none;
  min-height: 18px;
}

/* Keep the label from shifting when state changes */
.checkbox-row span {
  font-weight: 600;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.checkbox-row.is-checked span {
  color: #166534; /* green */
}

.checkbox-row.is-unchecked span {
  color: #9f1239; /* red */
}

input[type="checkbox"].checkbox {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  vertical-align: middle;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  display: inline-block;
}

input[type="checkbox"].checkbox:checked {
  background: #16a34a; /* green */
  border-color: #15803d;
}

/* No check mark needed; green fill is enough */
input[type="checkbox"].checkbox:checked::after {
  content: none;
}

input[type="checkbox"].checkbox:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.jobs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.job-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.job-card__title {
  font-weight: 700;
  font-size: 16px;
  color: #111827;
}

.job-card__code {
  font-size: 12px;
  margin-top: 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.job-card__description {
  margin-top: 10px;
  color: #374151;
  font-size: 14px;
  line-height: 1.35;
}

.btn i.bi {
  margin-right: 6px;
}

/* ---- Receivables list: status highlighting + sorting controls ---- */

.table tr.receivable-row--due td {
  background: #fffbeb; /* amber-50 */
  color: #92400e;      /* amber-800 */
}

.table tr.receivable-row--late td {
  background: #fff1f2; /* rose-50 */
  color: #9f1239;      /* rose-800 */
}

.table tr.receivable-row--paid td {
  background: #f0fdf4; /* green-50 */
  color: #166534;      /* green-800 */
}

/* created/default: keep normal look (no special background) */

.sort-btn {
  margin-left: 6px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #fff;
  color: #374151;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.sort-btn:hover {
  background: #f9fafb;
}

.sort-btn:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.nav a.nav-admin {
  color: #93c5fd; /* blue-300 */
}

.nav a.nav-admin:hover {
  color: #bfdbfe; /* blue-200 */
}

.nav a.nav-users {
  color: #93fdc5; /* green-300 */
}

.nav a.nav-users:hover {
  color: #bffedb; /* green-200 */
}

.nav a.nav-logout {
  color: #fca5a5; /* red-300 */
}

.nav a.nav-logout:hover {
  color: #fecaca; /* red-200 */
}

/* Logo styling */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-logo {
  height: 32px;
  width: auto;
  display: block;
}

.login-logo {
  text-align: center;
  margin: 32px 0 24px 0;
}

.login-logo img {
  height: 120px;
  width: auto;
  display: inline-block;
}

/* Mobile navbar responsive styling */
@media (max-width: 768px) {
  .topbar .container {
    padding: 2px 16px;
  }

  .brand span {
    display: none; /* Hide "Tortuga" text on mobile */
  }

  .brand-logo {
    height: 100px; /* Make logo larger to match 3 rows of nav icons */
  }
}

/* Contract status bar */
.contract-status-bar {
  border-radius: 10px;
  padding: 16px;
  margin: 16px 0;
  font-weight: 600;
}

.contract-status-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.contract-status-label {
  font-size: 16px;
}

.contract-status-amount {
  font-size: 18px;
}

.status-bar-current {
  background: #d1fae5; /* green-100 */
  border: 1px solid #6ee7b7; /* green-300 */
  color: #065f46; /* green-900 */
}

.status-bar-due {
  background: #fed7aa; /* orange-200 */
  border: 1px solid #fb923c; /* orange-400 */
  color: #7c2d12; /* orange-900 */
}

.status-bar-late {
  background: #fecaca; /* red-200 */
  border: 1px solid #f87171; /* red-400 */
  color: #7f1d1d; /* red-900 */
}

/* Contract list row highlighting */
.contract-row-current {
  background: #f0fdf4; /* green-50 */
}

.contract-row-current:hover td {
  background: #dcfce7; /* green-100 */
}

.contract-row-due {
  background: #fff7ed; /* orange-50 */
}

.contract-row-due:hover td {
  background: #ffedd5; /* orange-100 */
}

.contract-row-late {
  background: #fef2f2; /* red-50 */
}

.contract-row-late:hover td {
  background: #fee2e2; /* red-100 */
}

/* Status badges */
.status-badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}

.status-badge-current {
  background: #d1fae5; /* green-200 */
  color: #065f46; /* green-900 */
}

.status-badge-due {
  background: #fed7aa; /* orange-200 */
  color: #7c2d12; /* orange-900 */
}

.status-badge-late {
  background: #fecaca; /* red-200 */
  color: #7f1d1d; /* red-900 */
}

/* Text toggle control */
.text-toggle-container {
  margin: 16px 0;
}

.text-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.text-toggle-text {
  font-size: 14px;
  color: #374151;
  font-weight: 500;
}

.text-toggle {
  width: 48px;
  height: 24px;
  background: #d1d5db;
  border-radius: 12px;
  position: relative;
  transition: background 0.2s ease;
}

.text-toggle-slider {
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 10px;
  position: absolute;
  top: 2px;
  left: 2px;
  transition: left 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.text-toggle-slider--on {
  left: 26px;
}

.text-toggle-label:hover .text-toggle {
  background: #9ca3af;
}

.text-toggle-label:has(.text-toggle-slider--on) .text-toggle {
  background: #2563eb;
}

.text-toggle-label:has(.text-toggle-slider--on):hover .text-toggle {
  background: #1d4ed8;
}

/* ---- Responsive Contracts List ---- */

/* Desktop: show table, hide mobile cards */
.contracts-table-desktop {
  display: table;
}

.contracts-mobile-list {
  display: none;
}

/* Mobile: hide table, show cards */
@media (max-width: 768px) {
  .contracts-table-desktop {
    display: none;
  }

  .contracts-mobile-list {
    display: block;
  }

  .contract-mobile-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    margin: 12px 0;
    overflow: hidden;
    position: relative;
  }

  .contract-mobile-card__main {
    padding: 12px 36px 12px 14px;
    cursor: pointer;
  }

  .contract-mobile-card__main:active {
    background: #f9fafb;
  }

  .contract-mobile-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
  }

  .contract-mobile-card__title {
    font-weight: 600;
    font-size: 15px;
    color: #111827;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .contract-mobile-card__toggle {
    position: absolute;
    top: 12px;
    right: 10px;
    width: 24px;
    height: 24px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    color: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
  }

  .contract-mobile-card__toggle:active {
    background: #f3f4f6;
  }

  .contract-mobile-card__toggle .bi {
    font-size: 12px;
    line-height: 1;
  }

  .contract-mobile-card__details {
    border-top: 1px solid #e5e7eb;
    padding: 12px 14px;
    background: #f9fafb;
  }

  .contract-mobile-card__detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 6px 0;
    gap: 12px;
  }

  .contract-mobile-card__detail-label {
    font-size: 13px;
    color: #6b7280;
    font-weight: 500;
  }

  .contract-mobile-card__detail-value {
    font-size: 14px;
    color: #111827;
    text-align: right;
  }

  /* Status-based card backgrounds */
  .contract-card-current {
    background: #f0fdf4; /* green-50 */
    border-color: #bbf7d0; /* green-200 */
  }

  .contract-card-current .contract-mobile-card__main:active {
    background: #dcfce7; /* green-100 */
  }

  .contract-card-due {
    background: #fff7ed; /* orange-50 */
    border-color: #fed7aa; /* orange-200 */
  }

  .contract-card-due .contract-mobile-card__main:active {
    background: #ffedd5; /* orange-100 */
  }

  .contract-card-late {
    background: #fef2f2; /* red-50 */
    border-color: #fecaca; /* red-200 */
  }

  .contract-card-late .contract-mobile-card__main:active {
    background: #fee2e2; /* red-100 */
  }
}

