/**
 * SimplitPOS AI - Estilos
 */

/* Base */
* {
  font-family: 'Poppins', sans-serif;
}

body {
  background: #f5f3f0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

.main-content {
  flex: 1;
}

/* Header */
.header-line {
  height: 3px;
  background: linear-gradient(90deg, #FF8602, #FFa940);
}

/* Cards */
.card {
  background: #faf9f7;
  border: 2px solid #FF8602;
  box-shadow: 0 2px 8px rgba(255, 134, 2, 0.15);
  transition: all 0.15s ease;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(255, 134, 2, 0.25);
}

/* KPI Cards */
.kpi-card {
  background: #faf9f7;
  border: 2px solid #fed7aa;
  border-left: 5px solid #FF8602;
}

.kpi-card.success {
  border-left-color: #10b981;
}

.kpi-card.warning {
  border-left-color: #f59e0b;
}

.kpi-card.info {
  border-left-color: #FF8602;
}

/* Inputs */
.input-light {
  background: #faf9f7;
  border: 2px solid #fcd5a5;
  transition: all 0.2s ease;
}

.input-light:focus {
  border-color: #FF8602;
  box-shadow: 0 0 0 3px rgba(255, 134, 2, 0.2);
  background: #fffefa;
  outline: none;
}

/* Textarea dentro del contenedor */
#questionInput {
  line-height: 1.5;
}

@media (min-width: 640px) {

  /* Desktop: una sola línea, sin scrollbar visible */
  #questionInput {
    white-space: nowrap;
    overflow: hidden;
    max-height: 28px;
  }
}

@media (max-width: 639px) {

  /* Mobile: expandir verticalmente */
  #questionInput {
    max-height: 100px;
    overflow-y: auto;
  }
}

/* Buttons */
.btn-primary {
  background: #FF8602;
  color: white;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-primary:hover {
  background: #e67702;
  box-shadow: 0 4px 12px rgba(255, 134, 2, 0.4);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: #faf9f7;
  border: 2px solid #FF8602;
  color: #FF8602;
  font-weight: 500;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: #fff7ed;
}

.quick-btn {
  background: #faf9f7;
  border: 2px solid #fcd5a5;
  color: #92400e;
  transition: all 0.15s ease;
}

.quick-btn:hover {
  background: #FF8602;
  border-color: #FF8602;
  color: white;
}

/* Loading */
.loading-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.loading-dots span {
  width: 8px;
  height: 8px;
  background: #FF8602;
  border-radius: 50%;
  animation: bounce 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bounce {

  0%,
  80%,
  100% {
    transform: scale(0.6);
    opacity: 0.5;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Tables */
.table-light thead {
  background: #FF8602;
  color: white;
}

.table-light tbody tr {
  border-bottom: 1px solid #fed7aa;
  transition: background 0.15s ease;
  background: #faf9f7;
}

.table-light tbody tr:hover {
  background: #fff7ed;
}

/* Charts */
.chart-container {
  position: relative;
  height: 300px;
  background: #faf9f7;
  border-radius: 8px;
}

/* Scrollable chart container */
.chart-scroll-container {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: #FF8602 #f0eeeb;
  position: relative;
  width: 100%;
}

.chart-scroll-container canvas {
  display: block;
}

.chart-scroll-container::-webkit-scrollbar {
  height: 6px;
}

.chart-scroll-container::-webkit-scrollbar-track {
  background: #f0eeeb;
  border-radius: 3px;
}

.chart-scroll-container::-webkit-scrollbar-thumb {
  background: #FF8602;
  border-radius: 3px;
}

.chart-scroll-container::-webkit-scrollbar-thumb:hover {
  background: #e67702;
}

/* Indicador de scroll */
.scroll-hint {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 134, 2, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  pointer-events: none;
  animation: pulse-hint 2s ease-in-out infinite;
  z-index: 10;
}

@keyframes pulse-hint {

  0%,
  100% {
    opacity: 0.7;
  }

  50% {
    opacity: 1;
  }
}

/* Scroll indicator text */
.scroll-indicator {
  animation: fade-pulse 2s ease-in-out infinite;
}

@keyframes fade-pulse {

  0%,
  100% {
    opacity: 0.5;
  }

  50% {
    opacity: 1;
  }
}

/* Mobile optimizations */
@media (max-width: 640px) {

  /* Main container fix */
  .flex-1.flex.flex-col.min-w-0 {
    max-width: 100vw;
    overflow-x: hidden;
  }

  /* Chat container */
  #chatContainer {
    max-width: 100%;
    overflow-x: hidden;
  }

  #chatContainer .max-w-3xl {
    max-width: 100%;
    padding-left: 10px;
    padding-right: 10px;
  }

  /* Chart fixes */
  .chart-container {
    height: 260px;
    width: 100%;
    max-width: 100%;
  }

  .chart-scroll-container {
    width: 100%;
    min-height: 220px;
  }

  /* Bot message container - allow charts to scroll */
  .bot-message {
    max-width: 100%;
  }

  .bot-message>div {
    max-width: 100%;
  }

  .bot-message .bg-white {
    max-width: 100%;
  }

  /* Allow horizontal scroll for charts inside messages */
  .bot-message .bg-gray-50 {
    overflow: visible;
  }

  /* Input area fix */
  .shrink-0.bg-white.border-t {
    padding: 8px 12px;
  }

  .shrink-0.bg-white.border-t .max-w-3xl {
    max-width: 100%;
    padding: 0;
  }

  .shrink-0.bg-white.border-t .flex.gap-2 {
    gap: 8px;
  }

  /* Ensure button is visible */
  #askBtn {
    min-width: 44px;
    padding: 10px;
    flex-shrink: 0;
  }

  /* Pie chart on mobile */
  .bot-message canvas {
    max-width: none;
  }
}

/* Footer */
.footer {
  background: #1f2937;
  color: #9ca3af;
}

.footer a {
  color: #d1d5db;
  transition: color 0.2s ease;
}

.footer a:hover {
  color: #FF8602;
}

/* Modals */
.modal-backdrop {
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background: #faf9f7;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f0eeeb;
}

::-webkit-scrollbar-thumb {
  background: #d1cdc7;
  border-radius: 4px;
}

/* Watermark */
.card-watermark {
  position: relative;
  overflow: hidden;
}

.card-watermark::before {
  content: '';
  position: absolute;
  top: -100%;
  left: -100%;
  width: 300%;
  height: 300%;
  background-image: url('/watermark.svg');
  background-size: 500px 150px;
  background-repeat: repeat;
  background-position: center;
  opacity: 0.15;
  pointer-events: none;
  z-index: 10;
  transform: rotate(-20deg);
}

.card-watermark>* {
  position: relative;
  z-index: 1;
}

/* Animations */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-fade-in {
  animation: fade-in 0.3s ease-out;
}

/* Chat specific */
#chatContainer {
  background: linear-gradient(180deg, #f5f3f0 0%, #faf9f7 100%);
}

/* KPI cards mini para chat */
.kpi-card-mini {
  background: white;
  border: 1px solid #fed7aa;
  border-left: 3px solid #FF8602;
  border-radius: 8px;
  padding: 8px 12px;
}

.kpi-card-mini:hover {
  box-shadow: 0 2px 8px rgba(255, 134, 2, 0.15);
}

/* Sidebar */
#sidebar {
  scrollbar-width: thin;
  scrollbar-color: #4b5563 #1f2937;
}

#sidebar::-webkit-scrollbar {
  width: 6px;
}

#sidebar::-webkit-scrollbar-track {
  background: #1f2937;
}

#sidebar::-webkit-scrollbar-thumb {
  background: #4b5563;
  border-radius: 3px;
}

.chat-item:hover .delete-btn {
  opacity: 1;
}

/* Utilities */
.text-balance {
  text-wrap: balance;
}