
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-primary:disabled {
  background-color: var(--border);
  color: var(--text-muted);
  cursor: not-allowed;
}

.btn-outline-danger {
  background-color: transparent;
  border: 1px solid var(--status-busy);
  color: var(--status-busy);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-outline-danger:hover {
  background-color: var(--status-busy);
  color: white;
}

.btn-block {
  width: 100%;
}

.btn-secondary {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.btn-secondary:hover {
  background-color: var(--bg-body);
}

.btn-round {
  border-radius: 50px;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-flat);
}

.selection-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-item:hover {
  border-color: var(--primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
}

.form-group {
  margin-bottom: 20px;
  flex-direction: column;
}

.form-label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-main);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-input:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #eee;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #666;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  left: 20px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: white;
  color: var(--text-main);
  padding: 12px 20px;
  border-radius: var(--radius-sm);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-left: 4px solid var(--primary);
  width: 100%; /* Full width up to max-width */
  max-width: 350px;
  pointer-events: auto;
  animation: slideIn 0.3s ease-out;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  will-change: transform, opacity;
}

@media (max-width: 480px) {
  .toast-container {
    top: 10px;
    right: 10px;
    left: 10px;
  }
  
  .toast {
    max-width: none; /* Take full available width */
    font-size: 13px;
    padding: 10px 15px;
  }
}

.toast-error {
  border-left-color: var(--status-busy);
}

.toast-success {
  border-left-color: var(--status-avail);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast-fade-out {
  animation: slideOut 0.3s ease-in forwards;
}

@keyframes slideOut {
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Modal Components */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 20px;
  box-sizing: border-box;
}

.modal-content {
  background: white;
  padding: 30px;
  border-radius: var(--radius);
  width: 100%;
  max-width: 500px;
  min-width: 320px;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  flex-shrink: 0;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  animation: modalAppear 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  will-change: transform, opacity;
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--border);
}

.modal-header h2, .modal-header h3 {
  margin: 0;
}

.modal-close, .btn-close {
  background: none;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.2s;
}

.modal-close:hover, .btn-close:hover {
  color: var(--primary);
}

@media (max-width: 480px) {
  .modal-content {
    padding: 20px;
    min-width: unset;
  }
}

.modal-lg { max-width: 800px; }
.modal-md { max-width: 600px; }
.modal-sm { max-width: 400px; }

@keyframes modalAppear {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.hidden {
  display: none !important;
}

#main-header {
  background: white;
  border-bottom: 1px solid var(--border);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 500;
}

#main-header .container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 20px;
}

.main-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

/* Hamburger Menu Toggle */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.menu-toggle span {
  width: 100%;
  height: 3px;
  background-color: var(--primary);
  border-radius: 10px;
  transition: all 0.3s linear;
  position: relative;
  transform-origin: 1px;
}

.menu-toggle.active span:first-child {
  transform: rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(20px);
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg);
}

@media (max-width: 768px) {
  .menu-toggle {
    display: flex;
  }

  .nav-links {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: white;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
    transition: right 0.3s ease-in-out;
    box-shadow: -5px 0 15px rgba(0,0,0,0.1);
    z-index: 1000;
    padding: 40px 20px;
  }

  .nav-links.active {
    right: 0;
  }

  .nav-link {
    font-size: 18px;
    width: 100%;
    text-align: center;
    padding: 10px 0;
  }

  .btn-logout {
    width: 100%;
    padding: 12px;
    font-size: 16px;
  }
}

.nav-link {
  text-decoration: none;
  color: var(--text-main);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary);
}

.brand-link {
  text-decoration: none;
  color: var(--primary);
}

.brand-name {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.btn-logout {
  background: none;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  cursor: pointer;
  color: var(--status-busy);
  transition: all 0.2s;
}

.btn-logout:hover {
  background: var(--status-busy);
  color: white;
  border-color: var(--status-busy);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

/* Mobile Tab Bar */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  height: 65px;
  border-top: 1px solid var(--border);
  z-index: 1500;
  justify-content: space-around;
  align-items: center;
  padding: 0 10px;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  color: var(--text-muted);
  flex: 1;
  padding: 8px 0;
  transition: all 0.2s;
  background: none;
  border: none;
  cursor: pointer;
}

.tab-item i {
  font-size: 20px;
  line-height: 1;
}

.tab-item span {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tab-item.active {
  color: var(--primary);
}

@media (max-width: 768px) {
  .mobile-tab-bar {
    display: flex;
  }
  
  #main-footer {
    padding-bottom: 80px; /* Add space for the tab bar */
  }
}

/* WhatsApp Connection Status */
.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 5px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.status-open { background-color: var(--status-avail); box-shadow: 0 0 8px var(--status-avail); }
.status-dot.status-connecting { background-color: var(--status-part); box-shadow: 0 0 8px var(--status-part); }
.status-dot.status-close { background-color: var(--status-busy); box-shadow: 0 0 8px var(--status-busy); }

/* WhatsApp Popup */
.whatsapp-popup {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 320px;
  background: white;
  border-radius: var(--radius);
  box-shadow: 0 10px 25px rgba(0,0,0,0.15);
  z-index: 3000;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideInUp 0.3s ease-out;
}

.whatsapp-popup.disconnected .whatsapp-popup-header {
  background: #dc3545;
}

@keyframes slideInUp {
  from { transform: translateY(100%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.whatsapp-popup-header {
  background: #25D366;
  color: white;
  padding: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background-color 0.3s ease;
}

.whatsapp-popup-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.whatsapp-popup-close {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
}

.whatsapp-popup-body {
  padding: 20px;
  text-align: center;
}

.whatsapp-disconnected-alert {
  background: #fff5f5;
  border: 1px solid #feb2b2;
  padding: 12px;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
  text-align: left;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.whatsapp-disconnected-alert .alert-icon {
  color: #c53030;
  font-size: 20px;
  line-height: 1;
}

.whatsapp-disconnected-alert h4 {
  color: #c53030;
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 2px 0;
}

.whatsapp-disconnected-alert p {
  color: #9b2c2c;
  font-size: 13px;
  line-height: 1.4;
  margin: 0;
}

.qr-code-container {
  background: #f8f9fa;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-code-container img {
  max-width: 100%;
  height: auto;
}

.whatsapp-pairing-code {
  font-family: monospace;
  font-size: 24px;
  letter-spacing: 4px;
  background: #f8f9fa;
  padding: 10px;
  border-radius: var(--radius-sm);
  margin-bottom: 15px;
  font-weight: bold;
  color: var(--text-main);
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid #25D366;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#main-footer {
  background: white;
  border-top: 1px solid var(--border);
  padding: 20px 0 10px 0;
  margin-top: auto;
}

#main-footer .container {
  max-width: 600px;
  margin: 0 auto;
  padding: 0 20px;
}

.footer-grid {
  display: grid;
  gap: 15px;
  margin-bottom: 15px;
}

.footer-info h3 {
  font-size: 1rem;
  margin-bottom: 2px;
  color: var(--text-main);
}

.footer-info p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-contact {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.contact-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.contact-item p, .contact-item a {
  font-size: 0.8rem;
  color: var(--text-main);
  text-decoration: none;
  margin: 0;
}

.contact-item a:hover {
  color: var(--primary);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  text-align: center;
}

.footer-bottom p {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.demo-banner {
  background-color: #FFF3E0;
  color: #E65100;
  border-bottom: 1px solid #FFE0B2;
  text-align: center;
  padding: 6px 16px;
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  position: relative;
  z-index: 1001;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.demo-banner span {
  font-size: 14px;
}

.form-group.full-width > div[style*="display: flex"] {
  flex-wrap: wrap;
}

@media (max-width: 600px) {

  .form-group.full-width > div[style*="display: flex"] {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 10px !important;
  }

  .form-group.full-width > div[style*="display: flex"] .form-input {
    width: 100% !important;
    flex: none !important;
    font-size: 16px;
  }

  .form-group.full-width > div[style*="display: flex"] .connection-status {
    margin: 5px 0;
  }

  .form-group.full-width > div[style*="display: flex"] .btn {
    width: 100%;
  }
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-top: 25px;
}

.page-btn {
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: white;
  color: var(--text-main);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-light);
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f1f5f9;
}

.mt-20 { margin-top: 20px; }

/* Admin Table Shared Styles */
.admin-table-container, .admin-table-wrapper {
    width: 100%;
    overflow-x: auto;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: white;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 600px;
}

.admin-table th {
    background: #f8fafc;
    font-weight: 700;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.admin-table td {
    padding: 16px 20px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    color: var(--text-main);
    vertical-align: middle;
}

.admin-table tr:hover td {
    background: #fcfcfc;
}

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

.empty-state {
    padding: 40px;
    text-align: center;
    color: var(--text-muted);
}

