/* =============================================
   STATES MANAGER MODULE
   Century Garage Door — WarehouseOS
   ============================================= */

/* ---- Nav item ---- */
.nav-item.states-nav {
  border-top: 1px solid #e2e8f0;
  margin-top: 4px;
  padding-top: 10px;
}

/* ---- Module wrapper ---- */
#view-states { padding: 0; }

/* ---- Module header ---- */
.states-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px 14px;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid #e5e7eb;
}
.states-header h1 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
}

/* ---- Manager grid ---- */
.states-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  padding: 20px 24px;
}
@media (max-width: 900px) {
  .states-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
  .states-grid {
    grid-template-columns: 1fr;
    padding: 12px 16px;
  }
  .states-header { padding: 14px 16px 12px; }
}

/* ---- Manager card ---- */
.state-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
  padding: 1.25rem;
  cursor: pointer;
  transition: box-shadow .15s, transform .1s;
  border: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.state-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,.12);
  transform: translateY(-1px);
}

/* ---- Avatar ---- */
.state-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.state-avatar-initials {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}
.state-card-top {
  display: flex;
  align-items: center;
  gap: 14px;
}
.state-card-info { flex: 1; min-width: 0; }
.state-card-name {
  font-size: 15px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.state-card-role {
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}
.state-badge {
  display: inline-block;
  background: #dbeafe;
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
}
.state-card-contacts {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.state-card-contacts a {
  font-size: 12px;
  color: #2563eb;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.state-card-contacts a:hover { text-decoration: underline; }
.state-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.state-meeting-badge {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  background: #f3f4f6;
  padding: 3px 8px;
  border-radius: 20px;
}
.state-last-status {
  font-size: 18px;
  line-height: 1;
}

/* ---- Empty state ---- */
.states-empty {
  text-align: center;
  padding: 60px 24px;
  color: #9ca3af;
  font-size: 15px;
}
.states-empty-icon {
  font-size: 48px;
  margin-bottom: 12px;
}

/* ---- Detail view ---- */
.states-detail {
  padding: 0;
}
.states-detail-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
.states-back-btn {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: #374151;
  transition: background .1s;
}
.states-back-btn:hover { background: #f3f4f6; }

.states-detail-profile {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: #f8fafc;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
.states-detail-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid #e5e7eb;
}
.states-detail-avatar-initials {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: white;
  border: 3px solid rgba(255,255,255,.6);
  flex-shrink: 0;
}
.states-detail-meta { flex: 1; min-width: 0; }
.states-detail-name {
  font-size: 20px;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 3px;
}
.states-detail-role {
  font-size: 13px;
  color: #6b7280;
  margin-bottom: 6px;
}
.states-detail-contacts {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  font-size: 13px;
}
.states-detail-contacts a {
  color: #2563eb;
  text-decoration: none;
}
.states-detail-contacts a:hover { text-decoration: underline; }

.states-detail-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}

/* ---- Tabs ---- */
.states-tabs {
  display: flex;
  gap: 0;
  padding: 0 24px;
  border-bottom: 2px solid #e2e8f0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.states-tabs::-webkit-scrollbar { display: none; }
.states-tab-btn {
  padding: 12px 20px;
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  background: none;
  border: none;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.states-tab-btn.active {
  color: #2563eb;
  border-bottom-color: #2563eb;
}
.states-tab-btn:hover:not(.active) { color: #374151; }

.states-tab-content {
  padding: 20px 24px;
}

/* ---- Meetings list ---- */
.states-meetings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.states-meeting-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}
.states-meeting-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: background .1s;
  min-height: 44px;
}
.states-meeting-row:hover { background: #f9fafb; }
.states-meeting-title {
  font-size: 14px;
  font-weight: 600;
  color: #1e293b;
  flex: 1;
  min-width: 0;
}
.states-meeting-date {
  font-size: 12px;
  color: #6b7280;
  white-space: nowrap;
}
.states-meeting-status {
  font-size: 18px;
  flex-shrink: 0;
}
.states-meeting-expand {
  padding: 16px;
  background: #f8fafc;
  border-top: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.states-meeting-expand label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.states-meeting-expand input,
.states-meeting-expand textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.states-meeting-expand input:focus,
.states-meeting-expand textarea:focus { border-color: #2563eb; }
.states-meeting-expand textarea { resize: vertical; min-height: 72px; }

.states-status-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.states-status-btn {
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .15s;
  min-height: 44px;
}
.states-status-btn.active-yes {
  background: #dcfce7;
  border-color: #16a34a;
  color: #15803d;
}
.states-status-btn.active-no {
  background: #fee2e2;
  border-color: #dc2626;
  color: #b91c1c;
}
.states-status-btn.active-pending {
  background: #fef9c3;
  border-color: #ca8a04;
  color: #92400e;
}
.states-status-btn:not(.active-yes):not(.active-no):not(.active-pending) {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}
.states-status-btn:hover { opacity: .85; }

.states-meeting-save-row {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* ---- Notes tab ---- */
.states-notes-area {
  width: 100%;
  min-height: 200px;
  padding: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.states-notes-area:focus { border-color: #2563eb; }
.states-notes-hint {
  font-size: 12px;
  color: #9ca3af;
  margin-top: 6px;
}

/* ---- Add Manager overlay/form ---- */
.states-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.states-form-card {
  background: #fff;
  border-radius: 16px;
  padding: 28px 28px 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  max-height: 90vh;
  overflow-y: auto;
}
.states-form-card h2 {
  margin: 0 0 20px;
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
}
.states-form-group {
  margin-bottom: 14px;
}
.states-form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.states-form-group input,
.states-form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.states-form-group input:focus,
.states-form-group select:focus { border-color: #2563eb; }
.states-form-photo-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.states-form-photo-preview {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #e5e7eb;
}
.states-form-photo-initials {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: white;
  background: #6366f1;
  flex-shrink: 0;
}
.states-form-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

/* ---- Buttons (re-usable) ---- */
.states-btn-primary {
  background: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background .15s;
}
.states-btn-primary:hover { background: #1d4ed8; }
.states-btn-secondary {
  background: #f1f5f9;
  color: #374151;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background .15s;
}
.states-btn-secondary:hover { background: #e2e8f0; }
.states-btn-danger {
  background: #fee2e2;
  color: #dc2626;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  min-height: 44px;
  transition: background .15s;
}
.states-btn-danger:hover { background: #fecaca; }

/* ---- Edit inline form ---- */
.states-edit-form {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 18px;
  margin: 16px 24px;
}
.states-edit-form label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.states-edit-form input {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  margin-bottom: 12px;
  outline: none;
  box-sizing: border-box;
}
.states-edit-form input:focus { border-color: #2563eb; }

@media (max-width: 600px) {
  .states-tabs { padding: 0 16px; }
  .states-tab-content { padding: 16px 16px; }
  .states-detail-profile { padding: 16px; gap: 14px; }
  .states-detail-header { padding: 12px 16px; }
  .states-meetings-header { flex-wrap: wrap; gap: 8px; }
  .states-form-card { padding: 22px 18px 20px; }
}
