/* ===== RESET AND BASE STYLES ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: "Poppins", sans-serif;
  line-height: 1.6;
  color: var(--text-primary);
  overflow-x: hidden;
  background: var(--bg-neutral);
}

/* ===== CONTENT AREA ===== */
.content-wrapper {
  padding: 25px;
}

/* ===== CONTACT PAGE STYLES ===== */
.contact-management-container {
  background: var(--bg-white);
  border-radius: 12px;
  padding: 25px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
  padding-bottom: 15px;
  border-bottom: 2px solid var(--bg-neutral);
}

.section-header h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}

/* Form Section */
.contact-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 30px;
}

.form-row {
  display: flex;
  gap: 20px;
}

.form-group {
  flex: 1;
}

.form-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
}

.form-control {
  width: 100%;
  padding: 10px 15px;
  border: 1px solid var(--bg-neutral);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: all 0.3s ease;
}

.form-control:focus {
  outline: none;
  border-color: var(--bg-primary);
  box-shadow: 0 0 0 2px var(--bg-primary-light);
}

.btn {
  padding: 10px 20px;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: var(--bg-primary);
  color: var(--text-white);
}

.btn-primary:hover {
  background: var(--bg-darker);
  transform: translateY(-2px);
}

.btn-secondary {
  background: var(--bg-neutral);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background: var(--bg-light);
  color: var(--text-black);
  transform: translateY(-2px);
}

.form-actions {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

/* Table Section */
.table-container {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 0;
}

.table thead th {
  background-color: var(--bg-primary);
  color: var(--text-white);
  font-weight: 500;
  padding: 12px 15px;
  text-align: left;
  border: none;
  white-space: nowrap;
}

.table tbody tr {
  border-bottom: 1px solid var(--bg-neutral);
  transition: all 0.3s ease;
}

.table tbody tr:hover {
  background-color: var(--bg-light);
}

.table tbody td {
  padding: 12px 15px;
  vertical-align: middle;
}

.table tbody tr:last-child {
  border-bottom: none;
}

.contact-link {
  color: var(--bg-primary);
  text-decoration: none;
  transition: color 0.3s ease;
}

.contact-link:hover {
  color: var(--bg-darker);
  text-decoration: underline;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-action {
  padding: 8px 10px;
  font-size: 0.9rem;
  border-radius: 4px;
  min-width: 36px;
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-edit {
  background-color: var(--bg-secondary);
  color: var(--text-white);
}

.btn-edit:hover {
  background-color: #a9ab5c;
}

.btn-delete {
  background-color: #dc3545;
  color: var(--text-white);
}

.btn-delete:hover {
  background-color: #c82333;
}

.timestamp {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ===== MOBILE CARD VIEW FOR CONTACT TABLE ===== */
.mobile-contact-card {
  display: none;
  background: var(--bg-white);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.mobile-contact-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--bg-neutral);
}

.mobile-contact-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-contact-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.mobile-contact-card-label {
  font-weight: 600;
  color: var(--text-muted);
  font-size: 0.85rem;
  flex-shrink: 0;
  margin-right: 10px;
}

.mobile-contact-card-value {
  color: var(--text-primary);
  font-size: 0.9rem;
  word-break: break-all;
  flex: 1;
  text-align: right;
}

/* Toggle Switch Styles */
.toggle-switch-container {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

input:checked + .toggle-slider {
  background-color: var(--toggle-btn);
}

input:checked + .toggle-slider:before {
  transform: translateX(26px);
}

/* Status Text Styles */
.status-text {
  font-size: 14px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  min-width: 70px;
  text-align: center;
}

.status-active {
  color: #155724;
  background-color: #d4edda;
  border: 1px solid #c3e6cb;
}

.status-inactive {
  color: #721c24;
  background-color: #f8d7da;
  border: 1px solid #f5c6cb;
}

/* Mobile Card Adjustments */
.mobile-contact-card-row .toggle-switch-container {
  justify-content: flex-start;
}

/* Table adjustments */
.table td,
.table th {
  vertical-align: middle;
}

/* Loading indicator */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #3498db;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Contact link styles */
.contact-link {
  color: #007bff;
  text-decoration: none;
}

.contact-link:hover {
  text-decoration: underline;
  color: #0056b3;
}

/* Mobile contact card styles */
.mobile-contact-card {
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 15px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.mobile-contact-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
}

.mobile-contact-card-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mobile-contact-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
}

.mobile-contact-card-label {
  font-weight: 600;
  color: #495057;
  min-width: 80px;
}

.mobile-contact-card-value {
  flex: 1;
  text-align: right;
  color: #6c757d;
  word-break: break-word;
}

.timestamp {
  font-size: 0.9em;
  color: #6c757d;
}

/* Hide columns based on data availability */
.hide-address {
  display: none;
}

.hide-phone {
  display: none;
}

.hide-email {
  display: none;
}

/* Mobile card adjustments */
.hide-address-mobile {
  display: none;
}

.hide-phone-mobile {
  display: none;
}

.hide-email-mobile {
  display: none;
}

/* Form mode indicator */
.form-mode-indicator {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  margin-left: 10px;
}

.insert-mode {
  background-color: #d1ecf1;
  color: #0c5460;
}

.update-mode {
  background-color: #d4edda;
  color: #155724;
}

/* Clear button style */
.clear-field-btn {
  margin-left: 5px;
  padding: 2px 6px;
  font-size: 0.8rem;
  border-radius: 4px;
  background-color: #f8f9fa;
  border: 1px solid #dee2e6;
  color: #6c757d;
  cursor: pointer;
}

.clear-field-btn:hover {
  background-color: #e9ecef;
  color: #495057;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
  .form-row {
    flex-direction: column;
    gap: 15px;
  }

  .content-wrapper {
    padding: 20px 15px;
  }

  .contact-management-container {
    padding: 20px 15px;
  }

  .section-header {
    flex-direction: column;
    gap: 15px;
    align-items: flex-start;
  }

  /* Show mobile cards */
  .mobile-contact-card {
    display: block;
  }

  /* Hide desktop table */
  .table-container {
    display: none;
  }
}

@media (max-width: 576px) {
  .content-wrapper {
    padding: 15px 10px;
  }

  .btn {
    padding: 8px 15px;
    font-size: 0.85rem;
  }

  .mobile-contact-card {
    padding: 12px;
  }

  .mobile-contact-card-header {
    margin-bottom: 10px;
    padding-bottom: 10px;
  }
}

/* ===== UTILITY CLASSES ===== */
.text-success {
  color: #388e3c;
}
.text-warning {
  color: #ff8f00;
}
.text-danger {
  color: #d32f2f;
}
.text-info {
  color: #0288d1;
}

.mb-0 {
  margin-bottom: 0;
}
.mt-20 {
  margin-top: 20px;
}
.mb-20 {
  margin-bottom: 20px;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.5s ease-out;
}
