/* styles.css - Modern, clean UI cho SAH Tool */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary-color: #2563eb;
  --secondary-color: #64748b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --warning-color: #f59e0b;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --text-color: #1e293b;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --header-bg: #1e293b;
  --header-text: #ffffff;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
}

/* Header */
.header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background-color: var(--header-bg);
  color: var(--header-text);
  padding: 0.5rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.header-logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-logo {
  height: 40px;
  width: auto;
  object-fit: contain;
}

.header-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
}

.header-info {
  display: flex;
  gap: 1.5rem;
  font-size: 0.9rem;
}

.server-status,
.server-time {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.status-dot,
.user-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background-color: var(--success-color);
  box-shadow: 0 0 5px var(--success-color);
}

.status-dot.offline {
  background-color: var(--danger-color);
}

.header-right {
  display: flex;
  align-items: center;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  background-color: rgba(255, 255, 255, 0.1);
  padding: 0 1rem;
  border-radius: 8px;
}

.user-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.user-status-dot.ok {
  background-color: var(--success-color);
  box-shadow: 0 0 5px var(--success-color);
}

.user-status-dot.error {
  background-color: var(--danger-color);
  box-shadow: 0 0 5px var(--danger-color);
}

.user-status-dot.checking {
  background-color: var(--warning-color);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.user-details {
  display: flex;
  flex-direction: column;
  font-size: 0.85rem;
  border-left: 1px solid rgba(255, 255, 255, 0.2);
  padding-left: 1rem;
}

.user-details div span {
  font-weight: 600;
  color: yellow;
}

.user-actions {
  display: flex;
  gap: 0.5rem;
}

/* Container */
.container {
  max-width: 100%;
  margin: 0 auto;
  padding: 0.5rem 2rem;
  padding-top: calc(70px + 0.5rem);
  /* Add padding-top to account for fixed header */
}

/* Main Layout */
.main-layout {
  display: flex;
  gap: 1.5rem;
  align-items: flex-start;
}

/* Right Sidebar Menu */
.right-sidebar {
  position: fixed;
  top: calc(70px + 1rem);
  /* Position below fixed header with margin */
  right: 2rem;
  width: 250px;
  min-width: 250px;
  background-color: var(--card-bg);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  padding: 1rem 0;
  z-index: 999;
  max-height: calc(100vh - 70px - 2rem);
  overflow-y: auto;
}

.sidebar-header {
  padding: 0 1rem 1rem 1rem;
  border-bottom: 1px solid var(--border-color);
  margin-bottom: 0.5rem;
}

.sidebar-header h3 {
  font-size: 1.1rem;
  color: var(--text-color);
  margin: 0;
  font-weight: 600;
}

.sidebar-menu {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.5rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: none;
  background-color: transparent;
  color: var(--text-color);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  text-decoration: none;
  border-bottom: 2px solid var(--primary-color);
}

.sidebar-item:hover {
  background-color: var(--bg-color);
}

.sidebar-item.active {
  background-color: var(--primary-color);
  color: white;
}

.sidebar-icon {
  font-size: 1.25rem;
  flex-shrink: 0;
}

.sidebar-text {
  flex: 1;
}

/* Right Sidebar Scrollbar */
.right-sidebar::-webkit-scrollbar {
  width: 6px;
}

.right-sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.right-sidebar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

.right-sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--secondary-color);
}

/* Content */
.content {
  position: relative;
  flex: 1;
  min-width: 0;
  /* Prevent flex item from overflowing */
  margin-right: calc(250px + 2rem + 1.5rem);
  /* Add margin-right to account for fixed sidebar (width + right position + gap) */
  margin-top: 1rem;
  /* Add top margin to align with sidebar */
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page-title {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
  color: var(--text-color);
}

/* Card */
.card {
  background-color: var(--card-bg);
  border-radius: 8px;
  padding: 0.5rem 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.card h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
  color: var(--text-color);
}

/* Buttons */
.btn {
  padding: 0.625rem 1.25rem;
  border: none;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.85rem;
}

.btn-primary {
  background-color: var(--primary-color);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background-color: #1d4ed8;
}

.btn-secondary {
  background-color: var(--secondary-color);
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background-color: #475569;
}

.btn-success {
  background-color: var(--success-color);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background-color: #059669;
}

.btn-danger {
  background-color: var(--danger-color);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: #dc2626;
}

.btn-warning {
  background-color: var(--warning-color);
  color: white;
}

.btn-warning:hover:not(:disabled) {
  background-color: #d97706;
}

.btn-info {
  background-color: #3b82f6;
  color: white;
}

.btn-info:hover:not(:disabled) {
  background-color: #2563eb;
}

.btn-group {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* Form Controls */
.control-group {
  margin-bottom: 1rem;
}

.control-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.control-group input[type="text"],
.control-group input[type="number"],
.control-group select {
  width: 100%;
  max-width: 400px;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.control-group input[type="text"]:focus,
.control-group input[type="number"]:focus,
.control-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.control-group input[type="checkbox"] {
  margin-right: 0.5rem;
}

/* Info Box */
.info-box {
  margin-top: 1rem;
  padding: 0;
  background-color: transparent;
  border-radius: 4px;
  max-height: 500px;
  overflow-y: auto;
  overflow-x: hidden;
}

#tayLuyenTrangBiInfo.info-box{
  max-height: none;
}


/* Board Info Display */
.board-info-display {
  margin-top: 12px;
  background: transparent;
  border-radius: 8px;
}

.board-info-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 6px 10px;
  font-size: 12px;
  text-align: center;
  border-radius: 6px;
  margin-bottom: 10px;
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.slots-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.board-info-item {
  display: flex;
  align-items: center;
  padding: 10px 15px;
  border-bottom: 1px solid #e9ecef;
  font-size: 13px;
  transition: background-color 0.2s;
}

.board-info-item:last-child {
  border-bottom: none;
}

.board-info-item:hover {
  background-color: #f8f9fa;
}

.board-info-item.main {
  border-left: 4px solid #28a745;
}

.board-info-item.side {
  border-left: 4px solid #17a2b8;
}

.board-info-item.stone {
  border-left: 4px solid #6f42c1;
}

.board-info-item.ncore {
  border-left: 4px solid #ffc107;
}

.info-label {
  font-weight: 600;
  color: #495057;
  min-width: 110px;
  display: inline-block;
}

.info-value {
  color: #212529;
  flex: 1;
}

/* Slot Group Display */
.slot-group {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 10px 8px;
  transition: all 0.3s;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.slot-group:hover {
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-2px);
}

.slot-group.current-slot {
  background: linear-gradient(135deg, #fff8e1 0%, #fffaf0 100%);
  border: 2px solid #ffc107;
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.slot-header {
  font-weight: 600;
  color: #667eea;
  font-size: 13px;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.current-slot .slot-header {
  color: #f57c00;
  border-bottom-color: #ffc107;
}

.current-badge {
  background: linear-gradient(135deg, #ffd54f, #ffb300);
  color: #5d4037;
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 600;
  text-transform: uppercase;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.slot-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.slot-item {
  font-size: 11.5px;
  color: #2c3e50;
  padding: 3px 5px;
  background: #f8f9fa;
  border-radius: 4px;
  border-left: 3px solid #dee2e6;
  transition: all 0.2s;
  line-height: 1.4;
}

.slot-item:hover {
  background: #e9ecef;
  border-left-color: #667eea;
  transform: translateX(2px);
}

.current-slot .slot-item {
  background: #fffef7;
  border-left-color: #ffb300;
}

.status-box {
  margin-top: 1rem;
  padding: 1rem;
  background-color: var(--bg-color);
  border-radius: 6px;
  border-left: 4px solid var(--primary-color);
  white-space: pre-wrap;
  font-family: "Courier New", monospace;
  font-size: 0.9rem;
}

.status-box {
  border-left-color: var(--success-color);
}

.status-box.error {
  border-left-color: var(--danger-color);
}

/* Logs */
.logs-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.logs-container {
  max-height: 600px;
  overflow-y: auto;
}

.log-item {
  padding: 10px 12px;
  border-bottom: 2px solid #e9ecef;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  transition: all 0.3s ease;
}

.log-item:last-child {
  border-bottom: 2px solid #e9ecef;
}

.log-item:hover {
  background-color: #f8f9fa;
}

.log-item.new-log {
  animation: slideIn 0.3s ease-out;
  background-color: #fff3cd;
}

/* Realtime logs - more compact and clean */
.log-item.realtime-log {
  padding: 6px 12px;
  border-left: 3px solid #2196f3;
  background-color: #f5f9ff;
}

.log-item.realtime-log .log-header {
  font-size: 0.8rem;
  opacity: 0.6;
  margin-bottom: 2px;
}

.log-item.realtime-log .log-body {
  font-size: 0.95rem;
  color: #333;
  font-weight: 500;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.log-content {
  flex: 1;
  min-width: 0;
}

.log-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  flex-wrap: wrap;
  font-size: 13px;
}

.log-badge {
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  line-height: 1.4;
}

.log-badge.success {
  background-color: #d1fae5;
  color: #065f46;
}

.log-badge.error {
  background-color: #fee2e2;
  color: #991b1b;
}

.log-badge.running {
  background-color: #dbeafe;
  color: #1e40af;
}

.log-badge.stopped {
  background-color: #f3f4f6;
  color: #374151;
}

.log-timestamp {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.log-data {
  font-size: 0.9rem;
  color: var(--text-color);
  margin-top: 0.5rem;
}

.log-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-icon {
  padding: 0.5rem;
  background-color: transparent;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon:hover {
  background-color: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
}

.text-muted {
  color: var(--text-muted);
  text-align: center;
  padding: 2rem;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  overflow-y: auto;
}

.modal.show {
  display: block;
}

.modal-content {
  background-color: var(--card-bg);
  max-width: 900px;
  margin: 2rem auto;
  border-radius: 8px;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#configModal .modal-content {
  width: 95%;
  max-width: 900px;
  max-height: 95%;
  height: fit-content;
  overflow-x: hidden;
}

.config-toolbar-sticky {
  position: sticky;
  top: 0;
  z-index: 5;
  background: white;
  padding-bottom: 5px;
  margin-bottom: 5px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  font-size: 1.5rem;
  color: var(--text-color);
}

.modal-close {
  background: none;
  border: none;
  font-size: 2rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: 0;
  width: 2rem;
  height: 2rem;
}

.modal-close:hover {
  color: var(--text-color);
}

.modal-body {
  padding: 10px 1rem 5px 1rem;
}

.config-section {
  margin-bottom: 2rem;
}

#configFormSection {
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 8px;
  border: 2px solid #e9ecef;
}

.config-section h3 {
  font-size: 1.25rem;
  margin-bottom: 1rem;
  color: var(--text-color);
}

.config-list {
  width: 100%;
}

.config-list .config-list-content {
  height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
}

.config-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.config-list::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.config-list::-webkit-scrollbar-thumb:hover {
  background: #555;
}

/* Config Group Section */
.config-group-section {
  margin-bottom: 10px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.config-group-section .group-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 5px 15px;
  color: white;
  cursor: pointer;
  user-select: none;
  transition: filter 0.2s;
}

.config-group-section .group-header:hover {
  filter: brightness(1.05);
}

.config-group-section .group-header .toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  margin-right: 8px;
  font-size: 0.9em;
}

.config-group-section.collapsed .group-header .toggle-icon {
  transform: rotate(-90deg);
}

.config-group-section .group-configs {
  padding: 10px;
  max-height: 400px;
  overflow-y: auto;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.config-group-section.collapsed .group-configs {
  max-height: 0;
  padding: 0 10px;
  overflow: hidden;
  opacity: 0;
}

.config-group-section .group-configs::-webkit-scrollbar {
  width: 6px;
}

.config-group-section .group-configs::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.config-group-section .group-configs::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.config-group-section .group-configs::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* Config Selector Group Section */
.config-selector-group-section {
  margin-bottom: 16px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.config-selector-group-section .group-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 10px 14px;
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: filter 0.2s;
}

.config-selector-group-section .group-header .toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  margin-right: 8px;
  font-size: 0.9em;
}

.config-selector-group-section.collapsed .group-header .toggle-icon {
  transform: rotate(-90deg);
}

.config-selector-group-section .group-header:hover {
  filter: brightness(1.05);
}

.config-selector-group-section .group-header label {
  color: white;
  font-weight: bold;
  font-size: 1em;
  margin: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}

.config-selector-group-section .group-header input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: white;
}

.config-selector-group-section .group-configs {
  padding: 8px;
  max-height: 500px;
  overflow-y: auto;
  background: #fafafa;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.config-selector-group-section.collapsed .group-configs {
  max-height: 0;
  padding: 0 8px;
  overflow: hidden;
  opacity: 0;
}

/* Phone Group in Selector */
.phone-group-selector {
  margin-bottom: 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  overflow: hidden;
  background: white;
}

.phone-header-selector {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.phone-header-selector:hover {
  filter: contrast(0.95);
}

.phone-configs-list {
  padding: 4px;
  background: #fbfcfd;
}

.config-item-compact {
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.2s;
  margin-bottom: 2px;
}

.config-item-compact:hover {
  background-color: #f1f5f9;
}

.config-item-compact.selected {
  background-color: #f0f9ff;
  border-color: #bae6fd;
}

.config-item-compact .config-checkbox {
  width: 16px;
  height: 16px;
  margin: 0;
}

.config-item-compact .config-name {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 2px;
}

.config-item-compact .config-details-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #64748b;
}

.config-selector-group-section .group-configs::-webkit-scrollbar {
  width: 6px;
}

.config-selector-group-section .group-configs::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.config-selector-group-section .group-configs::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.config-selector-group-section .group-configs::-webkit-scrollbar-thumb:hover {
  background: #999;
}

.config-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s;
}

.config-item:hover {
  border-color: var(--primary-color);
  background-color: var(--bg-color);
}

.config-item.active {
  border-color: var(--success-color);
  background-color: #ecfdf5;
}

.config-info {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}

.config-name {
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.config-details {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.config-actions {
  display: flex;
  gap: 0.5rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: var(--text-color);
}

.form-group input[type="text"],
.form-group input[type="password"],
.form-group select {
  width: 100%;
  padding: 0.625rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

.form-group input[type="text"]:focus,
.form-group input[type="password"]:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Enhanced Log Styling */
.log-board-info {
  padding: 8px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  margin-top: 6px;
}

.log-board-info.compact {
  padding: 6px 10px;
  background: linear-gradient(to right, #f8f9fa, #ffffff);
  border-left: 3px solid #667eea;
}

.board-line {
  font-size: 12.5px;
  padding: 2px 0;
  color: #2c3e50;
  line-height: 1.5;
}

.board-line:first-child {
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px solid #e9ecef;
}

.board-line strong {
  color: #667eea;
  font-weight: 600;
}

/* Old styles kept for backward compatibility */
.board-summary {
  margin-bottom: 12px;
  font-size: 14px;
}

.board-slot {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 5px 14px;
  border-radius: 5px;
  font-size: 13px;
  font-weight: 600;
  display: inline-block;
}

.board-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.board-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: white;
  border-radius: 6px;
  border-left: 4px solid #dee2e6;
  font-size: 13px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.board-item:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.board-item.main {
  border-left-color: #28a745;
}

.board-item.side {
  border-left-color: #17a2b8;
}

.board-item.stone {
  border-left-color: #6f42c1;
}

.board-item.ncore {
  border-left-color: #ffc107;
}

.item-label {
  font-weight: 600;
  color: #495057;
  min-width: 110px;
}

.item-value {
  flex: 1;
  color: #212529;
  font-weight: 500;
}

.item-detail {
  color: #6c757d;
  font-size: 11px;
  font-style: italic;
  background: #f8f9fa;
  padding: 2px 8px;
  border-radius: 3px;
}

.log-run-info {
  padding: 6px 10px;
  background: linear-gradient(to right, #f8f9fa, #ffffff);
  border-radius: 4px;
  margin-top: 4px;
  border-left: 3px solid #10b981;
}

.run-options,
.run-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0;
}

.run-options span,
.run-stats span {
  background: white;
  padding: 3px 8px;
  border-radius: 3px;
  font-size: 11.5px;
  border: 1px solid #dee2e6;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.log-toggle {
  background: #e9ecef;
  border: none;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12px;
  color: #495057;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s;
  font-weight: 500;
}

.log-toggle:hover {
  background: #dee2e6;
  transform: translateY(-1px);
}

.toggle-icon {
  font-size: 10px;
  transition: transform 0.2s;
  display: inline-block;
}

.log-data {
  max-height: 500px;
  overflow-y: auto;
  transition: all 0.3s ease;
  opacity: 1;
}

.log-data.collapsed {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

.log-data pre {
  margin: 8px 0 0 0;
  padding: 12px;
  background: #282c34;
  color: #abb2bf;
  border-radius: 6px;
  font-size: 12px;
  overflow-x: auto;
  line-height: 1.5;
}

.log-data-wrapper {
  margin-top: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .header {
    padding: 0.75rem 1rem;
  }

  .header-left {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .user-info {
    flex-direction: column;
    align-items: flex-start;
  }

  .container {
    padding-top: calc(120px + 0.5rem);
    /* More padding for taller header on mobile */
  }

  .main-layout {
    flex-direction: column;
  }

  .content {
    margin-right: 0;
    /* Remove margin on mobile */
    margin-top: 0;
    /* Remove top margin on mobile */
  }

  .right-sidebar {
    width: 100%;
    min-width: 100%;
    position: relative;
    top: 0;
    right: 0;
    max-height: none;
    order: -1;
    /* Move sidebar to top on mobile */
  }

  .sidebar-menu {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  .sidebar-item {
    flex: 1;
    min-width: calc(50% - 0.25rem);
    justify-content: center;
    background-color: #e2e0e0;
    font-size: 15px;
    padding: 0.5em;
  }

  .logs-controls {
    gap: 5px;
  }

  .log-item.realtime-log{
    padding: 6px;
  }

  .modal-content {
    margin: 1rem;
  }
  
}

/* Toast Notification */
.toast-container {
  position: fixed;
  top: 80px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  min-width: 300px;
  max-width: 500px;
  padding: 16px 20px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideInRight 0.3s ease-out;
  pointer-events: auto;
  border-left: 4px solid var(--primary-color);
}

.toast.success {
  border-left-color: var(--success-color);
}

.toast.error {
  border-left-color: var(--danger-color);
}

.toast.warning {
  border-left-color: var(--warning-color);
}

.toast.info {
  border-left-color: var(--primary-color);
}

.toast-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.toast.success .toast-icon {
  color: var(--success-color);
}

.toast.error .toast-icon {
  color: var(--danger-color);
}

.toast.warning .toast-icon {
  color: var(--warning-color);
}

.toast.info .toast-icon {
  color: var(--primary-color);
}

.toast-message {
  flex: 1;
  font-size: 14px;
  color: var(--text-color);
  line-height: 1.5;
}

.toast-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all 0.2s;
}

.toast-close:hover {
  background: var(--border-color);
  color: var(--text-color);
}

@keyframes slideInRight {
  from {
    transform: translateX(400px);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(400px);
    opacity: 0;
  }
}

.toast.removing {
  animation: slideOutRight 0.3s ease-in forwards;
}

/* Config Checkbox */
.config-checkbox {
  width: 20px;
  height: 20px;
  cursor: pointer;
  margin-right: 12px;
  flex-shrink: 0;
}

/* Running Tasks Display */
.running-task-item {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 12px;
  margin-bottom: 8px;
  background: var(--bg-color);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  overflow: hidden;
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Background màu xanh khi hoàn thành thành công */
.running-task-item.task-bg-success {
  background: #d1fae5;
  border-color: #10b981;
}

/* Background màu đỏ khi lỗi */
.running-task-item.task-bg-error {
  background: #fee2e2;
  border-color: #ef4444;
}

/* Background màu cam khi dừng */
.running-task-item.task-bg-stopped {
  background: #fed7aa;
  border-color: #f59e0b;
}

.task-progress-bg {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  opacity: 0.15;
  transition: width 0.3s ease;
  z-index: 0;
}

/* Khi task completed với success, progress bar màu xanh đậm hơn */
.running-task-item.task-bg-success .task-progress-bg {
  background: linear-gradient(90deg, #10b981 0%, #059669 100%);
  opacity: 0.25;
}

/* Khi task error, progress bar màu đỏ */
.running-task-item.task-bg-error .task-progress-bg {
  background: linear-gradient(90deg, #ef4444 0%, #dc2626 100%);
  opacity: 0.25;
}

.task-content {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.task-error-message {
  position: relative;
  z-index: 1;
  margin-top: 8px;
  padding: 8px;
  background: #fee2e2;
  border: 1px solid #fecaca;
  border-radius: 4px;
  color: #991b1b;
  font-size: 0.85rem;
}

.task-progress-text {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 40px;
  text-align: right;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: rgba(0, 0, 0, 0.1);
}

.task-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.task-feature {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.task-status {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  padding: 4px 12px;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 500;
}

.status-badge.running {
  background: #2196f3;
  color: white;
  animation: pulse 2s ease-in-out infinite;
}

.status-badge.success {
  background: #4caf50;
  color: white;
}

.status-badge.error {
  background: #f44336;
  color: white;
}

.status-badge.stopped {
  background: #ff9800;
  color: white;
}

.status-badge.completed {
  background: var(--secondary-color);
  color: white;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.7;
  }
}

/* Batch Run Buttons */
.batch-run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.selected-count {
  font-weight: bold;
}

/* Device Memory Settings Collapsible */
#deviceMemSection.collapsed #deviceMemContent {
  display: none !important;
}

#deviceMemSection .toggle-icon {
  transition: transform 0.3s ease;
  display: inline-block;
  width: 20px;
}

#deviceMemSection.collapsed .toggle-icon {
  transform: rotate(0deg);
}

#deviceMemSection:not(.collapsed) .toggle-icon {
  transform: rotate(90deg);
}

/* Config Selector Modal - Enhanced */
.config-selector-modal {
  max-width: 800px !important;
  min-width: 700px !important;
  width: 90%;
}

.config-selector-list {
  /* max-height: 500px; */
  overflow-y: auto;
  padding-right: 8px;
}

.config-selector-list::-webkit-scrollbar {
  width: 8px;
}

.config-selector-list::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.config-selector-list::-webkit-scrollbar-thumb {
  background: #888;
  border-radius: 4px;
}

.config-selector-list::-webkit-scrollbar-thumb:hover {
  background: #555;
}

.config-selector-item {
  margin-bottom: 12px;
}

.config-selector-item label {
  display: flex;
  align-items: center;
  cursor: pointer;
  padding: 16px 18px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  transition: all 0.2s ease;
}

.config-selector-item label:hover {
  border-color: var(--primary-color);
  background: #f8fafc;
  transform: translateX(4px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.config-selector-item input[type="checkbox"] {
  margin-right: 16px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  accent-color: var(--primary-color);
  flex-shrink: 0;
}

.config-selector-item .config-name {
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-color);
  margin-bottom: 6px;
}

.config-selector-item .config-info {
  flex: 1;
}

.config-selector-item .config-details {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.config-selector-item input[type="checkbox"]:checked+.config-info {
  color: var(--primary-color);
}

.config-selector-item input[type="checkbox"]:checked~* {
  font-weight: 500;
}

.config-selector-item label:has(input:checked) {
  border-color: var(--primary-color);
  background: linear-gradient(to right, #eff6ff, #ffffff);
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0.5rem;
  border-top: 1px solid var(--border-color);
  background: #f8fafc;
}

/* Fix input issues in Electron Desktop App */
input, textarea, select {
  -webkit-app-region: no-drag;
  user-select: text !important;
  cursor: text;
}


 .hero-card {
   border-radius: 8px;
   overflow: hidden;
   font-weight: bold;
   height: fix-content;
   display: flex;
   flex-direction: column;
 }

 .hero-header {
   color: rgb(163, 22, 22);
   text-align: center;
   font-size: 1.8em;
 }

 .hero-body {
   padding: 10px;
   text-align: center;
   flex: 1;
   display: flex;
   flex-direction: column;
   justify-content: center;
 }

 .equip-badge:hover {
   background-color: #f0f0f0 !important;
   transform: scale(1.05);
 }

/* Van Menh Trang Bi Specific Styles */

.hero-card-default {
    background: #ffffff;
}

.hero-header-default {
    background: linear-gradient(45deg, #007bff, #00d4ff);
}

.hero-card-green {
    background-color: #e8f5e9;
}

.hero-header-green {
    background-color: #66bb6a;
}

.hero-card-orange {
    background-color: #fff3e0;
}

.hero-header-orange {
    background-color: #ffa726;
}

.hero-card-locked {
    background: #e0e0e0;
    display: flex;
    align-items: center;
    justify-content: center;
    height: fix-content;
    border: 1px dashed #999;
    box-shadow: none !important; /* Override hover shadow */
    cursor: not-allowed;
}

.locked-icon {
    font-size: 3em; 
    color: #7f8c8d;
}

.equip-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    border-radius: 6px;
    padding: 4px 8px;
    cursor: pointer;
    text-align: left;
    transition: opacity 0.2s;
    font-weight: bold;
    font-size: 1.4em;
    height: fix-content;
}

.equip-btn:hover {
    font-size: 1.6em;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.8);
}

.equip-label {
    font-size: 0.85em;
    color: #555;
    font-weight: bold;
}

.equip-empty {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
    border: 1px dashed #ccc;
    background: #f9f9f9;
    border-radius: 6px;
    padding: 4px 8px;
    height: fix-content;
  }

.equip-empty-label {
    font-size: 0.85em;
    color: #999;
}

.equip-empty-text {
    font-size: 0.85em;
    color: #bbb;
    font-style: italic;
}

/* ========================================
   Config Search/Sort/Filter Toolbar
   ======================================== */

.config-toolbar {
  display: flex;
  /* flex-wrap: wrap; */
  gap: 10px;
  padding: 12px;
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 8px;
  margin-bottom: 15px;
  align-items: center;
  border: 1px solid #dee2e6;
}

.config-search-wrapper {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.config-search-wrapper input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.config-search-wrapper input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.config-search-wrapper::before {
  content: "🔍";
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  pointer-events: none;
}

.config-toolbar select {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
  cursor: pointer;
  min-width: 120px;
}

.config-toolbar select:focus {
  outline: none;
  border-color: var(--primary-color);
}

/* Tag filter button - match select styling */
.config-toolbar .tag-filter-dropdown button,
.config-toolbar .config-tag-filter-dropdown button {
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 0.85rem;
  background: white;
  cursor: pointer;
  min-width: 80px;
  white-space: nowrap;
}

.config-toolbar .tag-filter-dropdown button:hover,
.config-toolbar .config-tag-filter-dropdown button:hover {
  border-color: #adb5bd;
  background: #f8f9fa;
}

.config-toolbar-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.config-toolbar .selected-count {
  background: var(--primary-color);
  color: white;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Config Actions Dropdown */
.config-actions-dropdown {
  position: relative;
  display: inline-block;
}

.config-actions-toggle {
  background: transparent;
  border: 1px solid #dee2e6;
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-size: 1.1rem;
  transition: all 0.2s;
  color: #495057;
}

.config-actions-toggle:hover {
  background: #f8f9fa;
  border-color: #adb5bd;
}

.config-actions-menu {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  background: white;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 140px;
  overflow: hidden;
}

.config-actions-dropdown.open .config-actions-menu {
  display: block;
}

.config-actions-menu button {
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  text-align: left;
  cursor: pointer;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}

.config-actions-menu button:hover {
  background: #f8f9fa;
}

.config-actions-menu button.danger:hover {
  background: #fee2e2;
  color: #dc2626;
}

.config-actions-menu .divider {
  height: 1px;
  background: #e9ecef;
  margin: 4px 0;
}

/* Header Import Dropdown */
.header-import-dropdown {
  position: relative;
  display: inline-block;
}

.header-import-menu {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  width: 560px;
  max-height: 70vh;
  overflow: auto;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
  z-index: 2000;
  padding: 12px;
}

.header-import-dropdown.open .header-import-menu {
  display: block;
}

.import-dropzone {
  border: 2px dashed #cbd5f5;
  background: #f8fafc;
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  transition: all 0.2s ease;
}

.import-dropzone.dragover {
  border-color: #667eea;
  background: #eef2ff;
}

.import-dropzone-title {
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 4px;
}

.import-dropzone-subtitle {
  font-size: 0.85rem;
  color: #6b7280;
  margin-bottom: 10px;
}

.import-summary {
  margin-top: 10px;
  font-size: 0.9rem;
  color: #374151;
}

.import-preview {
  margin-top: 10px;
  max-height: 40vh;
  overflow: auto;
}

.import-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

/* Compact Config Item */
.config-item-compact {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  margin-bottom: 6px;
  transition: all 0.2s;
  cursor: pointer;
  background: #ffffff;
}

.config-item-compact:hover {
  border-color: var(--primary-color);
  filter: brightness(0.97);
}

/* Status-based backgrounds */
.config-item-compact.status-ok {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #a7f3d0;
}

.config-item-compact.status-error {
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
  border-color: #fecaca;
}

.config-item-compact.status-checking {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fde68a;
}

.config-item-compact.status-unchecked {
  background: #f9fafb;
  border-color: #e5e7eb;
}

/* Selected (checked) state - blue background, overrides status */
.config-item-compact.selected {
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%) !important;
  border-color: #93c5fd !important;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.2);
}

/* Active config (currently in use) */
.config-item-compact.active {
  border-color: var(--success-color);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.2);
}

.config-item-compact .config-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  flex-shrink: 0;
}

.config-item-compact .config-right-actions {
  display: flex;
  flex-direction: row;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
  margin-left: 8px;
}

.config-item-compact .config-right-btn {
  width: auto;
  height: auto;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  font-size: 0.75rem;
  padding: 4px 8px;
  line-height: 1.1;
  white-space: nowrap;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

.config-item-compact .config-right-btn.check {
  border-color: #2563eb;
  color: #1d4ed8;
  background: #eff6ff;
}

.config-item-compact .config-right-btn.check:hover:not(:disabled) {
  background: #dbeafe;
}

.config-item-compact .config-right-btn.select {
  border-color: #10b981;
  color: #065f46;
  background: #ecfdf5;
}

.config-item-compact .config-right-btn.select:hover:not(:disabled) {
  background: #d1fae5;
}

.config-item-compact .config-right-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.config-item-compact .config-name {
  font-weight: 600;
  font-size: 0.95rem;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.config-item-compact .config-id {
  font-size: 0.8rem;
  color: #64748b;
  font-family: monospace;
}

.config-item-compact .config-coin {
  font-weight: 600;
  color: #f59e0b;
  font-size: 0.9rem;
  white-space: nowrap;
}

.config-item-compact .config-phone {
  font-weight: 600;
  color: #0ea5e9;
  font-size: 0.85rem;
  white-space: nowrap;
}

/* 2-row layout wrapper */
.config-item-compact .config-content-wrapper {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.config-item-compact .config-main-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.config-item-compact .config-details-row {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: #64748b;
}

.config-item-compact .platform-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.config-item-compact .config-separator {
  color: #cbd5e1;
  font-weight: 300;
}

.config-item-compact .config-last-check {
  color: #64748b;
  font-size: 0.78rem;
}

.config-item-compact .config-username {
  color: #3b82f6;
  font-weight: 500;
}

.config-item-compact .config-level {
  color: #8b5cf6;
  font-weight: 600;
}

.config-item-compact .active-badge {
  background: #10b981;
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: 600;
}

/* Simplified Group Header */
.config-group-section .group-header-simple {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 10px 15px;
  color: white;
  cursor: pointer;
  user-select: none;
  transition: filter 0.2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.config-group-section .group-header-simple:hover {
  filter: brightness(1.05);
}

.config-group-section .group-header-simple .group-checkbox {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: white;
}

.config-group-section .group-header-simple .group-title {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 1rem;
}

.config-group-section .group-header-simple .toggle-icon {
  transition: transform 0.3s ease;
  font-size: 0.8em;
}

.config-group-section.collapsed .group-header-simple .toggle-icon {
  transform: rotate(-90deg);
}

/* Status Badge Styles */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge.ok {
  background: #d1fae5;
  color: #065f46;
}

.status-badge.error {
  background: #fee2e2;
  color: #991b1b;
}

.status-badge.checking {
  background: #fef3c7;
  color: #92400e;
}

.status-badge.unchecked {
  background: #f3f4f6;
  color: #6b7280;
}

/* Device Memory Collapsible */
.device-mem-section {
  border: 1px solid #e9ecef;
  border-radius: 8px;
  margin-bottom: 15px;
  overflow: hidden;
}

.device-mem-header {
  background: #f8f9fa;
  padding: 12px 15px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  transition: background 0.2s;
}

.device-mem-header:hover {
  background: #e9ecef;
}

.device-mem-header .toggle-icon {
  transition: transform 0.3s;
}

.device-mem-section.collapsed .device-mem-header .toggle-icon {
  transform: rotate(-90deg);
}

.device-mem-body {
  padding: 15px;
  background: white;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.device-mem-section.collapsed .device-mem-body {
  max-height: 0;
  padding: 0 15px;
  overflow: hidden;
  opacity: 0;
}

/* Config Selector Modal Layout Fixes */
/* Config Selector Modal Layout Fixes */
.config-selector-modal {
  display: flex;
  flex-direction: column;
  max-height: 95vh; /* Increased limit */
  height: 95vh; /* Force height */
  overflow: hidden; /* Prevent full modal scroll */
}

.config-selector-modal .modal-body {
  flex: 1;
  display: flex !important;
  flex-direction: column;
  overflow: hidden; /* Prevent body scroll */
  padding: 10px 15px 0 15px !important; /* Restore padding for top buttons */
}

.config-selector-list {
  display: flex !important;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 10px 0 0 0 !important; /* Remove horizontal padding here, managed by scroll container or individual items */
  width: 100%;
}

/* Ensure the scroll container takes available space */
.config-selector-scroll-container {
  flex: 1;
  overflow-y: auto;
  padding: 0 4px; /* Tiny padding for scrollbar */
}

/* Toolbar should not shrink */
.config-toolbar {
  flex-shrink: 0;
}

/* =========================================
   TAO CLONE - Account Selector Modal
   ========================================= */
.tao-clone-account-modal {
  display: flex;
  flex-direction: column;
  max-height: 85vh;
  overflow: hidden;
  width: 600px;
  max-width: 95vw;
}

.tao-clone-account-modal .modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.tao-clone-account-list-wrapper {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
  padding: 10px 15px;
}

.tao-clone-account-toolbar {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.tao-clone-account-toolbar input[type="text"] {
  flex: 1;
  min-width: 150px;
  padding: 6px 10px;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  font-size: 0.9rem;
}

.tao-clone-account-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.tao-clone-account-scroll::-webkit-scrollbar {
  width: 6px;
}

.tao-clone-account-scroll::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 3px;
}

.tao-clone-account-scroll::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 3px;
}

.tao-clone-account-scroll::-webkit-scrollbar-thumb:hover {
  background: #a1a1a1;
}

/* Group Section */
.tc-group-section {
  margin-bottom: 8px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  overflow: hidden;
}

.tc-group-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 8px 12px;
  color: white;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: filter 0.2s;
}

.tc-group-header:hover {
  filter: brightness(1.05);
}

.tc-group-header input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: white;
}

.tc-group-header .toggle-icon {
  display: inline-block;
  transition: transform 0.3s ease;
  margin-right: 8px;
  font-size: 0.9em;
}

.tc-group-section.collapsed .tc-group-header .toggle-icon {
  transform: rotate(-90deg);
}

.tc-group-header .group-label {
  font-weight: 600;
  color: white;
  flex: 1;
}

.tc-group-header .group-count {
  font-weight: normal;
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.85rem;
  margin-left: 4px;
}

.tc-group-body {
  padding: 0;
  background: #fafafa;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  opacity: 1;
}

.tc-group-section.collapsed .tc-group-body {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
}

/* Phone (Account) Row */
.tc-phone-item {
  border-top: 1px solid #e2e8f0;
}

.tc-phone-header {
  padding: 8px 12px;
  display: flex;
  align-items: center;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

.tc-phone-header:hover {
  filter: contrast(0.95);
}

.tc-phone-header.platform-ios {
  background: #fff5f5;
}

.tc-phone-header.platform-android {
  background: #f0fff4;
}

.tc-phone-header input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin-right: 10px;
  cursor: pointer;
  accent-color: #4CAF50;
}

.tc-phone-label {
  flex: 1;
  font-weight: 600;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 5px;
}

.tc-phone-label .config-count-badge {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: normal;
  color: #6c757d;
}

.tc-phone-arrow {
  font-size: 0.7rem;
  color: #adb5bd;
  transition: transform 0.2s;
}

/* Config detail (read-only) */
.tc-config-details {
  padding: 4px 10px 4px 40px;
  background: #fbfcfd;
  font-size: 0.85rem;
  border-top: 1px solid #f0f0f0;
}

.tc-config-row {
  padding: 4px 0;
  color: #555;
  border-bottom: 1px dashed #eee;
  display: flex;
  align-items: center;
  gap: 6px;
}

.tc-config-row:last-child {
  border-bottom: none;
}

.tc-config-row .config-name {
  font-weight: 600;
  color: #333;
}

.tc-config-row .config-username {
  color: #999;
  font-size: 0.85em;
}

@media (max-width: 768px) {
  .tao-clone-account-modal {
    width: 95vw;
    max-height: 90vh;
  }

  .tc-config-details {
    padding-left: 25px;
  }
}

/* =========================================
   RESPONSIVE LAYOUT (Mobile & Tablet)
   ========================================= */

/* Sidebar Toggle Button (Hidden on Desktop) */
.sidebar-toggle {
  display: none;
}

.sidebar-close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  color: var(--text-color);
  display: none; /* Mobile only */
}

@media (max-width: 900px) {
  .sidebar-close-btn {
    display: block;
  }
}

/* Sidebar Overlay (Hidden by default) */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1040;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
  backdrop-filter: blur(2px);
}

.sidebar-overlay.visible {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.3s ease;
}

/* ------------------------------------------------
   MEDIA QUERY: Mobile & Tablet (< 900px)
   ------------------------------------------------ */
@media (max-width: 900px) {
  
  /* 1. Reset Content Margin */
  /* 1. Reset Content Margin & Padding */
  .content {
    margin-right: 0 !important;
    margin-top: 1rem;
    width: 100%;
    padding-bottom: 80px;
  }

  .container {
    padding: 0.5rem 0rem; /* Reduced padding */
    padding-top: calc(60px + 0.5rem); /* Adjusted for 60px header */
  }

  /* Reduce Card Padding */
  .card {
    padding: 0.5rem 0.3rem;
    margin-bottom: 1rem;
  }
  
  .page-title {
    font-size: 1.4rem;
    margin-bottom: 1rem;
  }
  
  .card h3 {
    font-size: 1.1rem;
  }

  /* Remove duplicate sidebar definition (already defined later) */

  .sidebar-header {
    padding: 1rem;
    background: var(--bg-color);
    margin: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
  }

  .sidebar-menu {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 0.3rem;
  }

  /* 3. Header Adjustments */
  .header {
    padding: 0.5rem 1rem;
    justify-content: space-between;
    height: 60px; /* Explicit height for mobile */
    z-index: 2100; /* Ensure header is above sidebar */
  }

  .header-left {
    gap: 1rem;
  }

  .header-title {
    font-size: 1.1rem; 
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none; /* Hide title on very small screens */
  }
  
  @media (min-width: 400px) {
    .header-title { display: block; }
  }

  .header-logo {
    height: 32px;
  }
  
  .header-info {
    display: none; 
  }

  /* Adjust Sidebar for Mobile - RIGHT SIDE */
  .right-sidebar {
    position: fixed;
    top: 60px;
    right: 0;
    left: auto;
    width: 260px;
    height: calc(100vh - 60px);
    z-index: 2000;
    background-color: var(--card-bg);
    box-shadow: none;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(100%); /* Move fully to the right (off-screen) */
    padding-top: 0;
    display: flex;
    flex-direction: column;
    border-left: 1px solid var(--border-color);
    border-right: none;
  }

  .sidebar-overlay {
    z-index: 1900; 
    top: 60px; 
  }

  .right-sidebar.open {
    transform: translateX(0); /* Slide into view */
    box-shadow: -5px 0 25px rgba(0, 0, 0, 0.1);
  }

  /* Toggle Button Visible */
  .sidebar-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    cursor: pointer;
    margin-left: 8px; /* Standard margin */
    padding: 0;
    border-radius: 4px;
    transition: background 0.2s;
    min-width: 36px; /* Prevent shrinking */
  }

  .sidebar-toggle:active {
    background: rgba(255, 255, 255, 0.2);
  }

  /* User Info Compact */
  .user-info {
    padding: 0;
    background: transparent;
    gap: 0.5rem;
  }

  .user-details {
    display: none !important; 
  }

  .user-status {
    display: none !important;
  }
  
  /* User Actions - Compact Buttons */
  .user-actions {
    gap: 4px;
  }
  
  .user-actions .btn {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  /* Hide less critical buttons on mobile header */
  #btnSync, #btnLogin {
    display: none !important; /* Move these to sidebar if critical */
  }
}

/* Config List Toolbar Mobile */
@media (max-width: 768px) {
  /* Config Toolbar Improvements */
  .config-toolbar {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    padding: 12px !important;
    gap: 8px !important;
    background: #f1f5f9;
    border-radius: 8px;
    margin-bottom: 12px;
  }

  .config-search-wrapper {
    order: 3 !important; /* Put search at bottom for easier thumb reach */
    width: 100%;
  }

  .config-search-wrapper input {
    padding: 10px 12px 10px 38px !important;
    height: 42px !important;
    font-size: 16px !important; /* Prevent zoom */
  }

  .config-search-wrapper::before {
    left: 12px !important;
    font-size: 16px !important;
  }
  
  .config-toolbar select {
    width: 100% !important;
    height: 42px !important;
    font-size: 16px !important;
    order: 1 !important;
  }

  #configStatusFilter {
    order: 2 !important;
  }
  
  .config-filter-group {
    display: none !important; /* Not used if using toolbar selects */
  }
  
  /* Make buttons stretch */
  .config-toolbar-actions button,
  .config-add-btn {
    width: 100%;
    justify-content: center;
  }
  
  /* Config Item Compact Adjustments */
  .config-item-compact {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px;
    gap: 8px;
  }
  
  .config-item-compact .config-checkbox {
    position: absolute;
    top: 12px;
    left: 12px;
  }
  
  .config-item-compact .config-content-wrapper {
    width: 100%;
    padding-left: 28px; /* Space for checkbox */
  }
  
  .config-item-compact .config-right-actions {
    width: 100%;
    margin-left: 0;
    margin-top: 8px;
    justify-content: flex-end; /* Buttons to right */
    padding-top: 8px;
    border-top: 1px dashed #eee;
  }
  
  .config-main-info {
    width: 100%;
    justify-content: space-between;
  }
  
  .config-name {
    font-size: 1rem;
    max-width: 100%;
  }

  /* User Group Folder Header */
  .group-header-user {
    padding: 10px !important;
  }

  .group-header-user h3 {
    font-size: 0.95rem !important;
  }

  /* Phone Group Header Mobile Fix */
  .phone-header {
    flex-direction: column;
    align-items: stretch !important;
    gap: 6px; /* Reduced gap */
    padding: 10px !important; /* Reduced padding */
  }

  .phone-header > span {
    width: 100%;
    margin-bottom: 2px;
  }

  .phone-header > div {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr); /* Force 3 columns instead of auto-fit to be more predictable */
    gap: 4px !important; /* Tight gap */
    padding-top: 6px;
    border-top: 1px dashed rgba(0, 0, 0, 0.1);
  }

  .phone-header .btn-xs {
    width: 100%;
    justify-content: center;
    padding: 4px 2px !important; /* Very compact */
    margin: 0 !important;
    font-size: 0.75rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Specific fix for the hidden/toggle button to span full width if it's the 4th/5th item */
  .phone-header .btn-show-hidden,
  .phone-header .btn-show-active,
  .phone-header .btn-outline-secondary[title*="Hidden"] {
    grid-column: span 1; /* Keep it in the grid */
  }

  .phone-header .toggle-icon,
  .phone-header > div > span:last-child {
      display: none !important; /* Hide the arrow in grid to save space, or keep it specialized */
  }

  /* Improved Config Item Compact for Mobile */
  .config-item-compact {
    position: relative;
    padding: 8px !important; /* Reduced padding */
    margin-bottom: 8px !important;
    border-radius: 8px !important;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08) !important;
  }

  .config-item-compact .config-checkbox {
    top: 10px !important;
    left: 8px !important;
  }

  .config-item-compact .config-content-wrapper {
    padding-left: 24px !important;
    gap: 4px !important;
  }

  .config-main-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
  }

  .config-main-info .status-badge {
    font-size: 0.7rem !important;
    padding: 2px 6px !important;
  }

  .config-main-info .config-coin {
    font-size: 0.85rem !important;
    margin: 2px 0;
    width: 100%; /* Force coin to its own tight line or keep it inline */
  }

  .config-details-row {
    display: grid !important;
    grid-template-columns: 1fr 1.2fr; /* Give slightly more room to the second column (Username/Time) */
    gap: 4px 8px !important;
    font-size: 0.72rem !important;
    margin-top: 2px;
    color: var(--text-muted);
  }

  .config-details-row .config-separator {
    display: none !important; /* Hide separators in grid layout */
  }

  .config-item-compact .config-right-actions {
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important; /* Center buttons */
    align-items: center !important;
    gap: 10px !important;
    margin-top: 10px !important;
    padding-top: 10px !important;
    padding-right: 35px !important; /* Leave room for toggle on the right */
    border-top: 1px dashed rgba(0, 0, 0, 0.1) !important;
  }

  .config-actions-toggle {
    position: absolute !important;
    right: 8px !important;
    bottom: 8px !important;
    width: 32px !important;
    height: 32px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    margin: 0 !important;
    z-index: 10;
  }

  .config-right-btn {
    flex: 1;
    max-width: 100px;
    height: 32px !important;
    font-size: 0.8rem !important;
  }


  /* Form controls */
  .control-group input[type="text"],
  .control-group input[type="number"],
  .control-group select {
    font-size: 16px; /* Avoid zoom on IOS */
    padding: 8px;
  }
  
  .btn {
    padding: 0.5rem; /* Slightly smaller padding */
    font-size: 0.9rem;
  }

  /* Reduce Font Sizes for Settings */
  .control-group label {
    font-size: 0.9rem;
    margin-bottom: 4px;
  }

  .control-group input[type="text"],
  .control-group input[type="number"],
  .control-group select {
    font-size: 0.9rem; /* Avoid too small but keep readable */
    padding: 6px;
    height: 36px;
  }
  
  .control-group small {
    font-size: 0.75rem;
  }
  
  /* Reduced Logger Font Size */
  .log-item {
    padding: 6px 8px;
    font-size: 0.8rem;
  }
  
  .log-item.realtime-log .log-header {
    font-size: 0.7rem;
  }

  .log-item.realtime-log .log-body {
    font-size: 0.8rem;
  }
  
  .log-timestamp {
    font-size: 0.7rem;
  }

  .log-data pre {
    font-size: 0.75rem;
    padding: 8px;
  }

  /* Config Selector Modal Mobile */
  .config-selector-modal {
    width: 95% !important;
    min-width: 0 !important;
    max-width: 350px !important;
    height: 85vh !important;
    margin: 1rem auto;
  }
  
  .modal-content {
    width: 95% !important; 
    max-width: 350px !important; /* Enforce smaller width on mobile */
    margin: 10px auto;
  }
  
  /* Config Modal Improvements */
  #configModal .modal-content {
    max-width: 350px !important;
  }
  
  #configModal .config-section > div:first-child {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 15px;
  }
  
  #configModal .config-section > div:first-child h3 {
    margin: 0;
    font-size: 1.1rem;
  }
  
  #configModal .config-section > div:first-child > div:last-child {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    width: 100%;
  }
  
  /* Batch action button container - Adjust margin if needed, but don't force display */
  #configModal .modal-body > div:nth-child(2) > div:nth-child(2) {
    margin-bottom: 10px;
  }

  #btnDeselectAll {
     width: 100% !important;
     margin-bottom: 10px;
     justify-content: center; 
  }
  
  /* Feature Specific Grids */
  .config-section div[style*="grid-template-columns: 1fr 1fr"] {
    grid-template-columns: 1fr !important; /* Stack on mobile */
    gap: 10px !important;
  }
  
  .form-group {
    margin-bottom: 10px;
  }
  
  .form-group label {
    font-size: 0.85rem;
    margin-bottom: 2px;
  }
  
  .form-group input {
    font-size: 0.9rem;
    padding: 6px 10px;
    height: 34px;
  }
  
  .modal-header {
    padding: 10px 15px;
  }
  
  .modal-header h2 {
    font-size: 1.2rem;
  }
  
  .modal-body {
    padding: 10px !important;
  }
  
  .config-selector-item label {
    padding: 12px;
  }
  
  .config-selector-item .config-name {
    font-size: 1rem;
  }
  
  .modal-footer {
    padding: 10px;
    flex-direction: column;
  }
  
  .modal-footer button {
    width: 100%;
    margin: 0;
  }
}

/* Modals Mobile */
@media (max-width: 600px) {
  .modal-content {
    width: 95% !important;
    max-width: none !important;
    margin: 10px auto;
    max-height: 85vh;
  }
  
  .control-group input, 
  .control-group select {
    max-width: 100%;
  }

  .toast-container {
    bottom: 20px;
    right: 10px;
    left: 10px;
    width: auto; 
    gap: 8px;
  }
  
  .toast {
    max-width: 100%;
    min-width: 0;
    padding: 10px 14px;
    font-size: 0.85rem;
  }
  
  .toast-icon {
    font-size: 1.2rem;
  }
  
  .toast-message {
    font-size: 0.85rem;
  }
  
  .toast-close {
    font-size: 1.2rem;
  }
}

/* Config Item Compact Mobile */
@media (max-width: 480px) {
  .config-item-compact {
    padding: 10px;
    gap: 4px;
  }
  
  .config-main-info {
    flex-wrap: wrap; 
    gap: 6px;
    width: 100%; /* Full width */
  }
  
  .config-name {
    font-size: 0.95rem;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1; /* Take remaining space */
    min-width: 100px; 
  }
  
  .config-details-row {
     /* Stack details if needed or hide less important info */
     font-size: 0.75rem;
     flex-wrap: wrap;
     gap: 4px;
     margin-top: 4px;
  }
  
  /* Hide ID on very small screens or truncation */
  .config-id {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Buttons inside Item */
  .config-right-actions {
    margin-left: auto; /* Push to right */
  }
  
  .config-right-btn {
    padding: 4px 8px;
    font-size: 0.75rem;
  }
}

/* Feature Grid Layout */
.feature-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

@media (max-width: 900px) {
  .feature-grid-layout {
    gap: 5px;
  }
}
