/* ═══════════════════════════════════════════════════════════
   USER MANAGEMENT PAGE STYLES
═══════════════════════════════════════════════════════════ */

.page-header {
  margin-bottom: 2.5rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
}

.page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0;
  letter-spacing: -0.02em;
}

/* ═══════════════════════════════════════════════════════════
   CREATE USER FORM
═══════════════════════════════════════════════════════════ */
.create-user-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.2rem 1.5rem;
  margin: 0 auto 1.5rem;
  max-width: 75%;
  box-shadow: 0 2px 12px rgba(14,40,65,0.07);
}

.registered-users-section {
  margin: 0 auto;
  max-width: 75%;
}

.form-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--navy);
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 2px solid var(--border);
  letter-spacing: -0.01em;
}

.user-form {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.8rem;
}

.form-row.form-row-5 {
  grid-template-columns: repeat(5, 1fr);
  gap: 0.7rem;
  align-items: end;
}

.form-group-note {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 1rem;
}

.form-group-submit {
  padding-top: 1rem;
}

.form-group-submit .btn {
  width: 100%;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.file-input-compact {
  padding: 0.35rem 0.5rem !important;
  font-size: 0.7rem !important;
  background: var(--off) !important;
  cursor: pointer;
}

.form-row.single {
  grid-template-columns: 1fr;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.form-group.full-width {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 0.2rem;
}

.required {
  color: #dc2626;
}

.form-control,
.form-group input,
.form-group select,
.form-group textarea {
  background: var(--off);
  border: 1px solid var(--border);
  color: var(--navy);
  padding: 0.45rem 0.7rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.8rem;
  transition: all 0.22s ease;
  width: 100%;
  box-sizing: border-box;
}

.form-control:focus,
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--teal);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(32,120,136,0.08);
}

/* File Input Styling */
.file-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 1rem;
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.22s ease;
  cursor: pointer;
}

.file-input-wrapper:hover {
  border-color: var(--teal);
  background: #fff;
}

.file-input-wrapper input[type="file"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  cursor: pointer;
}

.file-label {
  background: var(--navy);
  color: #fff;
  padding: 0.45rem 0.85rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s ease;
}

.file-input-wrapper:hover .file-label {
  background: var(--teal);
}

.file-name {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Form Actions */
.form-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  padding-top: 0.8rem;
  border-top: 1px solid var(--border);
  margin-top: 0.5rem;
}

.form-actions .btn {
  padding: 0.5rem 1.2rem;
  font-size: 0.85rem;
}

.required-note {
  font-size: 0.75rem;
  color: var(--muted);
  font-style: italic;
}

/* ═══════════════════════════════════════════════════════════
   REGISTERED USERS TABLE
═══════════════════════════════════════════════════════════ */
.registered-users-section {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(14,40,65,0.07);
}

.registered-users-section .section-title {
  padding: 1rem 1.5rem 0.8rem;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
  background: var(--off);
  font-size: 0.75rem;
}

.table-wrapper {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 550px;
  scrollbar-width: thin;
  scrollbar-color: var(--teal) transparent;
}

.table-wrapper::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: var(--teal);
  border-radius: 3px;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.users-table thead {
  background: var(--off);
  border-bottom: 2px solid var(--border);
}

.users-table th {
  padding: 0.7rem 1rem;
  text-align: left;
  font-weight: 700;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--off);
  z-index: 1;
}

.users-table td {
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--navy);
  vertical-align: middle;
  font-size: 0.8rem;
}

.users-table tbody tr {
  transition: background-color 0.2s ease;
}

.users-table tbody tr:hover {
  background-color: rgba(32,120,136,0.04);
}

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

/* Column Widths */
.col-photo { width: 50px; }
.col-username { width: 90px; }
.col-fullname { min-width: 160px; }
.col-position { min-width: 140px; }
.col-email { min-width: 180px; }
.col-emp { width: 80px; }
.col-phone { width: 100px; }
.col-birthday { width: 90px; }
.col-start { width: 90px; }
.col-actions { width: 100px; text-align: center; }

/* Photo Cell */
.photo-cell {
  text-align: center;
}

.user-photo {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  object-fit: cover;
  border: 1px solid var(--border);
}

/* Actions Cell */
.actions-cell {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border: 1px solid var(--border);
  background: var(--off);
  color: var(--navy);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}

.btn-icon.danger {
  color: #dc2626;
}

.btn-icon.danger:hover {
  background: #dc2626;
  color: #fff;
  border-color: #dc2626;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 1200px) {
  .form-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .table-wrapper {
    font-size: 0.8rem;
  }

  .col-fullname { min-width: 120px; }
  .col-position { min-width: 110px; }
  .col-email { min-width: 150px; }
}

@media (max-width: 992px) {
  .header-top {
    flex-wrap: wrap;
  }

  .page-title {
    flex: 1;
    font-size: 1.6rem;
  }

  .form-row {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
  }

  .create-user-section {
    padding: 2rem;
  }

  .table-wrapper {
    font-size: 0.75rem;
  }

  .users-table th,
  .users-table td {
    padding: 0.7rem 0.8rem;
  }

  .col-photo { width: 40px; }
  .col-username { width: 70px; }
  .col-fullname { min-width: 100px; }
  .col-position { min-width: 90px; }
  .col-email { min-width: 120px; }
  .col-emp { width: 60px; }
  .col-phone { width: 80px; }
  .col-birthday { width: 70px; }
  .col-start { width: 70px; }

  .user-photo {
    width: 32px;
    height: 32px;
  }

  .btn-icon {
    width: 28px;
    height: 28px;
    font-size: 0.65rem;
  }
}

@media (max-width: 768px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .create-user-section {
    padding: 1.5rem;
    margin-bottom: 2rem;
  }

  .form-title {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .form-actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .form-actions .btn {
    width: 100%;
  }

  .page-title {
    font-size: 1.4rem;
  }

  .table-wrapper {
    font-size: 0.7rem;
  }

  .users-table th,
  .users-table td {
    padding: 0.6rem 0.6rem;
  }

  .col-fullname { min-width: 90px; }
  .col-position { min-width: 80px; }
  .col-email { display: none; }
  .col-emp { width: 50px; }
  .col-phone { width: 70px; }
  .col-birthday { width: 60px; }
  .col-start { width: 60px; }

  .user-photo {
    width: 28px;
    height: 28px;
  }

  .btn-icon {
    width: 24px;
    height: 24px;
    font-size: 0.6rem;
  }
}

@media (max-width: 480px) {
  .header-top {
    flex-direction: column;
    gap: 1rem;
  }

  .page-title {
    font-size: 1.2rem;
    width: 100%;
  }

  .header-top .btn {
    width: 100%;
  }

  .form-group label {
    font-size: 0.7rem;
  }

  .form-group input,
  .form-group select {
    font-size: 0.85rem;
    padding: 0.6rem 0.8rem;
  }

  .table-wrapper {
    font-size: 0.65rem;
  }

  .users-table th,
  .users-table td {
    padding: 0.5rem 0.4rem;
  }

  .col-photo { width: 35px; }
  .col-username { width: 50px; }
  .col-fullname { min-width: 80px; }
  .col-position { display: none; }
  .col-email { display: none; }
  .col-emp { width: 45px; }
  .col-phone { width: 60px; }
  .col-birthday { width: 50px; }
  .col-start { width: 50px; }

  .user-photo {
    width: 24px;
    height: 24px;
  }

  .btn-icon {
    width: 22px;
    height: 22px;
    font-size: 0.55rem;
  }
}

/* ═══════════════════════════════════════════════════════════
   EDIT USER MODAL
═══════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(14, 40, 65, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  animation: modalFadeIn 0.2s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-container {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 1100px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes modalSlideIn {
  from { transform: translateY(-30px); opacity: 0; }
  to   { transform: translateY(0); opacity: 1; }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%);
  color: #fff;
  border-radius: 16px 16px 0 0;
}

.modal-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  letter-spacing: 0.02em;
}

.modal-header h2 i {
  color: var(--teal-light);
  font-size: 1.1rem;
}

.modal-close {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: rotate(90deg);
}

.modal-form {
  padding: 2rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding-top: 1.5rem;
  margin-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal-actions .btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
}

.edit-current-photo {
  width: 100%;
  height: 38px;
  background: var(--off);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 1rem;
  overflow: hidden;
}

.edit-current-photo img {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  object-fit: cover;
}

/* ═══════════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════════ */
@media (max-width: 992px) {
  .create-user-section,
  .registered-users-section { max-width: 95%; }

  .form-row.form-row-5 { grid-template-columns: repeat(3, 1fr); }
  .modal-container { max-width: 95%; }
  .modal-form .form-row.form-row-5 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .create-user-section,
  .registered-users-section { max-width: 100%; padding: 1rem; }

  .form-row,
  .form-row.form-row-5 { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }

  .form-actions {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }
  .form-actions .btn { width: 100%; }

  /* Registered Users — convert to cards on mobile */
  .registered-users-section .section-title {
    padding: 0.8rem 1rem;
  }
  .table-wrapper { max-height: none; overflow: visible; }
  .users-table thead { display: none; }
  .users-table,
  .users-table tbody,
  .users-table tr,
  .users-table td { display: block; width: 100%; }

  .users-table tr {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 0.6rem 0;
    padding: 0.75rem 1rem;
    position: relative;
  }

  .users-table td {
    padding: 0.35rem 0;
    border: none;
    text-align: right;
    font-size: 0.85rem;
  }
  .users-table td::before {
    content: attr(data-label);
    float: left;
    font-weight: 700;
    font-size: 0.7rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .users-table td.photo-cell {
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.65rem;
    margin-bottom: 0.5rem;
    text-align: center;
  }
  .users-table td.photo-cell::before { display: none; }

  .users-table td.actions-cell {
    border-top: 1px solid var(--border);
    padding-top: 0.65rem;
    margin-top: 0.5rem;
    justify-content: flex-end;
  }
  .users-table td.actions-cell::before { display: none; }

  /* Modal full-screen on mobile */
  .modal-overlay { padding: 0; }
  .modal-container {
    max-width: 100%;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  .modal-header { border-radius: 0; padding: 1rem 1.25rem; }
  .modal-form { padding: 1rem; }
  .modal-form .form-row.form-row-5 { grid-template-columns: 1fr; }
  .modal-actions {
    flex-direction: column-reverse;
  }
  .modal-actions .btn { width: 100%; }
}

@media (max-width: 480px) {
  .form-row,
  .form-row.form-row-5 { grid-template-columns: 1fr; }
  .form-title { font-size: 0.85rem; }
}
