* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
  min-height: 100vh;
  color: #e0e0e0;
  -webkit-overflow-scrolling: touch;
  overflow-x: hidden;
}

html {
  overflow-x: hidden;
}

.page {
  min-height: 100vh;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* Login Page */
.login-container {
  max-width: 400px;
  margin: 0 auto;
  padding: 40px 20px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-header {
  text-align: center;
  margin-bottom: 40px;
}

.login-header i {
  font-size: 64px;
  color: #4ade80;
  margin-bottom: 20px;
}

.login-header h1 {
  font-size: 28px;
  font-weight: 600;
  margin-bottom: 8px;
}

.login-header p {
  color: #888;
  font-size: 16px;
}

#login-form {
  background: rgba(255, 255, 255, 0.05);
  padding: 30px;
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

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

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: #ccc;
}

.form-group label i {
  margin-right: 8px;
  color: #4ade80;
}

.form-group input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 16px;
  transition: all 0.3s ease;
}

.form-group input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: #4ade80;
  outline: none;
}

.form-group input::placeholder {
  color: #666;
}

.error-message {
  color: #ef4444;
  font-size: 14px;
  margin-top: 16px;
  text-align: center;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  border: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  min-height: 44px;
}

.btn-primary {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  color: #000;
  width: 100%;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(74, 222, 128, 0.4);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.btn-warning {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
}

.btn-warning:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(251, 191, 36, 0.4);
}

.btn-success {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: #fff;
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(34, 197, 94, 0.4);
}

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

.btn-icon {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.1);
  color: #888;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Navbar */
.navbar {
  background: rgba(0, 0, 0, 0.3);
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 20px;
  font-weight: 600;
}

.nav-brand i {
  color: #4ade80;
  font-size: 24px;
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-user span {
  color: #888;
}

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px;
  width: 100%;
  box-sizing: border-box;
}

/* Cards */
.card {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 16px;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.card-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header h2 {
  font-size: 18px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-header h2 i {
  color: #4ade80;
}

.card-body {
  padding: 16px;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

/* Status Cards */
.status-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (min-width: 769px) {
  .status-cards {
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 24px;
  }
}

.status-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 24px;
}

.card-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
}

.chatbot-status {
  background: linear-gradient(
    135deg,
    rgba(74, 222, 128, 0.2) 0%,
    rgba(34, 197, 94, 0.2) 100%
  );
  color: #4ade80;
}

.token-status {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2) 0%,
    rgba(37, 99, 235, 0.2) 100%
  );
  color: #3b82f6;
}

.stats-icon {
  background: linear-gradient(
    135deg,
    rgba(168, 85, 247, 0.2) 0%,
    rgba(139, 92, 246, 0.2) 100%
  );
  color: #a855f7;
}

.balance-icon {
  background: linear-gradient(
    135deg,
    rgba(251, 191, 36, 0.2) 0%,
    rgba(245, 158, 11, 0.2) 100%
  );
  color: #fbbf24;
}

.card-content h3 {
  font-size: 14px;
  color: #888;
  margin-bottom: 8px;
  font-weight: 500;
}

.stat-number {
  font-size: 32px;
  font-weight: 700;
  color: #fff;
}

/* Balance Info */
.balance-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balance-details {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.balance-amount {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.balance-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
}

.balance-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.balance-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.balance-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.balance-stat .stat-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
}

.balance-stat .stat-value {
  font-size: 14px;
  font-weight: 600;
  color: #ccc;
}

/* Logs Container */
.logs-container {
  max-height: 700px;
  overflow-y: auto;
  overflow-x: auto;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  padding: 20px;
  min-height: 200px;
}

.api-logs-content {
  width: 100%;
  overflow-x: auto;
  color: #e0e0e0;
}

/* Override styles from v98store HTML */
.api-logs-content * {
  color: #e0e0e0 !important;
}

.api-logs-content table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  overflow: hidden;
  margin: 0;
}

.api-logs-content table th,
.api-logs-content table td {
  padding: 12px;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e0e0e0 !important;
  font-size: 13px;
}

.api-logs-content table th {
  background: rgba(74, 222, 128, 0.15) !important;
  color: #4ade80 !important;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.5px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.api-logs-content table tbody tr:hover {
  background: rgba(255, 255, 255, 0.08) !important;
}

.api-logs-content table tbody tr:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

.api-logs-content .log-header {
  background: linear-gradient(
    135deg,
    rgba(26, 31, 54, 0.8) 0%,
    rgba(45, 55, 72, 0.8) 100%
  ) !important;
  color: white !important;
  padding: 30px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.api-logs-content .log-wrapper {
  background: transparent;
  padding: 0;
}

.api-logs-content .tabs-container {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.api-logs-content .table-container {
  background: transparent;
  border-radius: 0;
  box-shadow: none;
  border: none;
}

.loading-row {
  text-align: center;
  padding: 40px;
  color: #888;
  font-size: 14px;
}

.loading-row i {
  margin-right: 8px;
  color: #4ade80;
}

/* Toggle Switch */
.status-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #444;
  transition: 0.3s;
  border-radius: 28px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

input:checked + .slider {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

#chatbot-status-text {
  font-size: 16px;
  font-weight: 600;
}

/* Status Badges */
.status-badge {
  display: inline-block;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.status-badge.valid {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
}

.status-badge.invalid {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.status-badge.loading {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

.status-badge.warning {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
}

/* Input Group */
.input-group {
  display: flex;
  gap: 8px;
}

.input-group input {
  flex: 1;
}

/* Config Card */
.config-card .form-group {
  margin-bottom: 24px;
}

.config-card input {
  width: 100%;
  padding: 14px 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  font-size: 14px;
  font-family: "Monaco", "Menlo", monospace;
}

.config-card input:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: #4ade80;
  outline: none;
}

.help-text {
  display: block;
  margin-top: 8px;
  color: #666;
  font-size: 13px;
}

.help-text a {
  color: #3b82f6;
  text-decoration: none;
}

.help-text a:hover {
  text-decoration: underline;
}

.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button-group .btn {
  flex: 1;
  min-width: 150px;
}

/* Message */
.message {
  margin-top: 20px;
  padding: 16px;
  border-radius: 8px;
  font-size: 14px;
}

.message.success {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  border: 1px solid rgba(74, 222, 128, 0.3);
}

.message.warning {
  background: rgba(251, 191, 36, 0.2);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.message.error {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.message:empty {
  display: none;
}

/* Debug Card */
.debug-content {
  background: rgba(0, 0, 0, 0.3);
  padding: 16px;
  border-radius: 8px;
  font-family: "Monaco", "Menlo", monospace;
  font-size: 13px;
  max-height: 300px;
  overflow-y: auto;
}

.debug-content pre {
  white-space: pre-wrap;
  word-wrap: break-word;
}

.text-muted {
  color: #666;
}

/* Quick Links */
.quick-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.quick-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #fff;
  text-decoration: none;
  transition: all 0.3s ease;
}

.quick-link:hover {
  background: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.quick-link i {
  font-size: 20px;
  color: #4ade80;
}

/* Token Info */
.token-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.token-expires {
  font-size: 12px;
  color: #888;
}

/* Chat history */
.history-layout {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

@media (min-width: 769px) {
  .history-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
  }
}

.history-list {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 200px;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

@media (min-width: 769px) {
  .history-list {
    max-height: 420px;
  }
}

.conversation-item {
  width: 100%;
  padding: 14px;
  border: none;
  background: transparent;
  color: #fff;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  cursor: pointer;
  transition: background 0.2s ease;
  touch-action: manipulation;
  min-height: 60px;
  overflow: hidden;
}

.conversation-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.conversation-item:active {
  background: rgba(255, 255, 255, 0.08);
}

.conversation-item.active {
  background: rgba(74, 222, 128, 0.08);
  border-left: 3px solid #4ade80;
}

.conversation-user {
  font-weight: 600;
  word-break: break-all;
  font-size: 13px;
}

.conversation-last {
  font-size: 12px;
  color: #bbb;
  margin: 6px 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  font-size: 12px;
  color: #777;
}

.history-detail {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 12px;
  min-height: 200px;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.history-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 6px;
  width: 100%;
}

.history-detail-header > div:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.history-title {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.history-meta {
  color: #888;
  font-size: 12px;
  margin-top: 4px;
}

.history-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.history-actions .btn {
  padding: 5px 8px;
  font-size: 10px;
  white-space: nowrap;
}

.history-actions .btn i {
  font-size: 10px;
}

.history-actions .btn-text {
  display: none;
}

@media (min-width: 500px) {
  .history-actions .btn-text {
    display: inline;
  }
  .history-title {
    max-width: 280px;
  }
}

.history-messages {
  max-height: 300px;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.history-row {
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  box-sizing: border-box;
}

.history-row.assistant {
  border-left: 3px solid #4ade80;
}

.history-row.user {
  border-left: 3px solid #3b82f6;
}

.history-meta-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 11px;
  color: #888;
}

.history-row .content {
  white-space: pre-wrap;
  line-height: 1.4;
  word-wrap: break-word;
  overflow-wrap: break-word;
  word-break: break-word;
  font-size: 13px;
  max-width: 100%;
}

.empty-text {
  color: #777;
  font-size: 14px;
}

.empty-row,
.loading-row {
  padding: 14px;
  color: #ccc;
  text-align: center;
}

/* Responsive */
@media (max-width: 768px) {
  .status-cards {
    grid-template-columns: 1fr;
  }

  .button-group {
    flex-direction: column;
  }

  .button-group .btn {
    width: 100%;
  }

  .navbar {
    flex-direction: column;
    gap: 12px;
    padding: 12px 16px;
  }

  .nav-brand {
    font-size: 16px;
  }

  .nav-brand i {
    font-size: 20px;
  }

  .nav-user {
    width: 100%;
    justify-content: space-between;
  }

  .container {
    padding: 10px;
  }

  .quick-links {
    flex-direction: column;
  }

  .history-detail-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }

  .history-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .history-actions .btn {
    font-size: 12px;
    padding: 8px 12px;
  }

  .training-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-height: 350px;
  }

  .training-card-image {
    height: 90px;
  }

  .training-card-content {
    padding: 8px;
  }

  .training-card-price {
    font-size: 15px;
    margin-bottom: 4px;
  }

  .training-card-desc {
    display: none;
  }

  .training-card-badges {
    gap: 3px;
    margin-bottom: 6px;
  }

  .training-card-badges .badge {
    padding: 2px 5px;
    font-size: 9px;
  }

  .training-card-actions {
    flex-direction: row;
    gap: 4px;
  }

  .training-card-actions .btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .card {
    border-radius: 10px;
    margin-bottom: 12px;
  }

  .card-header {
    padding: 12px 14px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .card-header h2 {
    font-size: 14px;
    gap: 6px;
  }

  .card-body {
    padding: 14px;
  }

  .status-card {
    padding: 14px;
    gap: 12px;
  }

  .card-icon {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .stat-number {
    font-size: 22px;
  }

  .image-upload-area {
    height: 140px;
  }

  .multi-preview-img {
    height: 55px;
  }

  .instruction-input {
    font-size: 16px;
    padding: 12px;
  }

  .quick-tags {
    gap: 6px;
  }

  .quick-tag {
    padding: 6px 10px;
    font-size: 12px;
    min-height: 32px;
  }

  .form-actions {
    flex-direction: row;
    gap: 8px;
  }

  .form-actions .btn {
    padding: 12px 16px;
    font-size: 13px;
  }

  .btn-train {
    padding: 12px 16px;
    font-size: 13px;
  }

  /* Detail Modal Mobile */
  .detail-modal-content {
    width: 95%;
    padding: 14px;
    max-height: 90vh;
  }

  .detail-img {
    max-height: 180px;
  }

  .detail-price {
    font-size: 22px;
  }

  .detail-desc {
    font-size: 12px;
    padding: 10px;
  }

  /* Config card mobile */
  .config-card input {
    font-size: 13px;
    padding: 10px;
  }

  .input-group {
    flex-direction: column;
  }

  .input-group input {
    width: 100%;
  }

  /* Login mobile */
  .login-container {
    padding: 20px 16px;
  }

  .login-header i {
    font-size: 48px;
  }

  .login-header h1 {
    font-size: 22px;
  }

  #login-form {
    padding: 20px;
  }

  .form-group input {
    padding: 12px 14px;
  }

  /* Toggle switch */
  .switch {
    width: 46px;
    height: 24px;
  }

  .slider:before {
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
  }

  input:checked + .slider:before {
    transform: translateX(22px);
  }

  #chatbot-status-text {
    font-size: 14px;
  }

  .section-title {
    font-size: 14px;
    margin-bottom: 15px;
  }

  .training-data-panel {
    padding: 12px;
  }
}

/* Extra small screens */
@media (max-width: 400px) {
  .training-grid {
    grid-template-columns: 1fr;
  }

  .training-card-desc {
    display: block;
    -webkit-line-clamp: 1;
  }

  .quick-tags {
    justify-content: center;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .status-cards .card {
    margin-bottom: 12px;
  }
}

/* ============================================
   TRAINING TOOL STYLES
   ============================================ */

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-actions .badge {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
}

.training-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 15px;
}

@media (min-width: 769px) {
  .training-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 25px;
  }
}

.training-form-panel {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.section-title {
  font-size: 16px;
  margin-bottom: 20px;
  color: #4ade80;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title i {
  font-size: 14px;
}

/* Quick Tags */
.quick-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.quick-tag {
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  color: #94a3b8;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  touch-action: manipulation;
  min-height: 36px;
}

.quick-tag:hover {
  background: rgba(74, 222, 128, 0.2);
  border-color: #4ade80;
  color: #4ade80;
}

.quick-tag:active {
  background: rgba(74, 222, 128, 0.3);
  transform: scale(0.95);
}

.quick-tag.danger {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.quick-tag.danger:hover {
  background: rgba(239, 68, 68, 0.3);
  border-color: #ef4444;
}

/* Instruction Input */
.instruction-input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(0, 0, 0, 0.3);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  color: #e2e8f0;
  font-size: 15px;
  transition: all 0.2s;
}

.instruction-input:focus {
  outline: none;
  border-color: #4ade80;
  background: rgba(0, 0, 0, 0.4);
}

.instruction-input::placeholder {
  color: #64748b;
}

/* Training Result */
.training-result {
  margin-top: 15px;
  padding: 15px;
  border-radius: 10px;
}

.result-success {
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
}

.result-success i {
  color: #22c55e;
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.result-price {
  font-size: 22px;
  font-weight: 700;
  color: #4ade80;
}

.result-desc {
  font-size: 13px;
  color: #94a3b8;
  margin-top: 8px;
}

.result-warning {
  background: rgba(234, 179, 8, 0.15);
  border: 1px solid rgba(234, 179, 8, 0.3);
  border-radius: 10px;
  padding: 15px;
  text-align: center;
}

.result-warning i {
  color: #eab308;
  font-size: 24px;
  margin-bottom: 8px;
  display: block;
}

.result-warning span {
  font-size: 18px;
  font-weight: 600;
  color: #fbbf24;
}

/* Multi Result Items */
.result-multi-summary {
  margin-bottom: 12px;
}

.result-multi-summary strong {
  font-size: 18px;
  color: #4ade80;
}

.result-multi-summary p {
  color: #94a3b8;
  margin-top: 4px;
}

.result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  margin-top: 6px;
}

.result-item.error {
  background: rgba(239, 68, 68, 0.2);
}

.result-item-num {
  background: rgba(74, 222, 128, 0.2);
  color: #4ade80;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 600;
  font-size: 12px;
}

.result-item.error .result-item-num {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.result-item-price {
  font-weight: 600;
  color: #4ade80;
}

.result-item-type {
  color: #94a3b8;
  font-size: 13px;
}

/* Train Button */
.btn-train {
  background: linear-gradient(135deg, #4ade80, #22c55e) !important;
  font-size: 15px;
  padding: 14px 24px;
}

.btn-train:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(74, 222, 128, 0.35);
}

/* Multi Image Hint */
.multi-hint {
  font-size: 12px;
  color: #64748b;
  font-weight: normal;
}

/* Image Count Info */
.image-count-info {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 12px;
  background: rgba(74, 222, 128, 0.1);
  border: 1px solid rgba(74, 222, 128, 0.2);
  border-radius: 8px;
  color: #4ade80;
  font-size: 13px;
}

.image-count-info.hidden {
  display: none;
}

/* Multi Preview Grid */
.multi-preview-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 6px;
}

.multi-preview-img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.more-count {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 6px;
  color: #fff;
  font-weight: 600;
  font-size: 18px;
}

/* Image Upload Area */
.image-upload-area {
  width: 100%;
  height: 180px;
  border: 2px dashed rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.3s;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.2);
  margin-bottom: 10px;
}

.image-upload-area:hover {
  border-color: #4ade80;
  background: rgba(74, 222, 128, 0.05);
}

.image-upload-area img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.upload-placeholder {
  text-align: center;
  color: #666;
}

.upload-placeholder i {
  font-size: 40px;
  margin-bottom: 10px;
  color: #4ade80;
}

.upload-placeholder p {
  margin-bottom: 5px;
}

.upload-placeholder small {
  font-size: 12px;
  color: #555;
}

/* AI Analyze Button */
.btn-ai-analyze {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #8b5cf6, #6366f1);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-ai-analyze:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(139, 92, 246, 0.4);
}

.btn-ai-analyze:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-analyzing {
  text-align: center;
  padding: 10px;
  color: #8b5cf6;
  font-size: 14px;
}

.ai-analyzing i {
  margin-right: 8px;
}

/* Form Rows */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.price-row input {
  font-size: 18px;
  font-weight: 600;
  color: #4ade80;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

.form-actions .btn {
  flex: 1;
}

/* Training Data Panel */
.training-data-panel {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 12px;
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.training-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
}

.training-filter-bar select {
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
  font-size: 13px;
}

/* Training Grid */
.training-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 15px;
  max-height: 600px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.training-card {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
  transition: all 0.3s;
}

.training-card:hover {
  transform: translateY(-3px);
  border-color: #4ade80;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.training-card-image {
  height: 130px;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.training-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.training-card-content {
  padding: 12px;
}

.training-card-price {
  font-size: 20px;
  font-weight: bold;
  color: #4ade80;
  margin-bottom: 8px;
}

.training-card-price.no-quote {
  color: #f87171;
  font-size: 16px;
}

.training-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}

.training-card-badges .badge {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
}

.badge-size {
  background: rgba(59, 130, 246, 0.2);
  color: #3b82f6;
}

.badge-type {
  background: rgba(168, 85, 247, 0.2);
  color: #a855f7;
}

.training-card-desc {
  font-size: 12px;
  color: #888;
  margin-bottom: 10px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.training-card-actions {
  display: flex;
  gap: 8px;
}

.training-card-actions .btn {
  flex: 1;
  padding: 6px 10px;
  font-size: 12px;
}

/* Empty State */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.empty-state i {
  font-size: 50px;
  margin-bottom: 15px;
  color: #4ade80;
  opacity: 0.5;
}

.empty-state p {
  font-size: 14px;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
}

.toast {
  padding: 15px 25px;
  border-radius: 10px;
  color: white;
  font-weight: 500;
  margin-top: 10px;
  animation: slideInRight 0.3s ease;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
}

.toast-success {
  background: linear-gradient(135deg, #4ade80, #22c55e);
}

.toast-error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.toast-info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

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

/* Detail Modal */
.detail-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  animation: fadeIn 0.2s;
}

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

.detail-modal-content {
  background: #1e293b;
  border-radius: 16px;
  padding: 24px;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  animation: scaleIn 0.2s;
}

@keyframes scaleIn {
  from {
    transform: scale(0.9);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.detail-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: #94a3b8;
  font-size: 24px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  transition: 0.2s;
}

.detail-close:hover {
  background: rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.detail-img {
  width: 100%;
  max-height: 300px;
  object-fit: contain;
  border-radius: 10px;
  margin-bottom: 16px;
  background: #0f172a;
}

.detail-price {
  font-size: 28px;
  font-weight: 700;
  color: #4ade80;
  margin-bottom: 16px;
  text-align: center;
}

.detail-price.no-quote {
  color: #fbbf24;
  font-size: 22px;
}

.detail-desc {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 10px;
  padding: 16px;
  color: #cbd5e1;
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 16px;
  white-space: pre-wrap;
}

.detail-modal .btn-danger {
  width: 100%;
}

/* Training card clickable */
.training-card {
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  touch-action: manipulation;
}

.training-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.training-card:active {
  transform: scale(0.98);
}
