/* Vydyhai Platform Styles */

:root {
  --primary-color: #3b82f6;
  --success-color: #10b981;
  --warning-color: #eab308;
  --danger-color: #ef4444;
  --gray-light: #f3f4f6;
  --gray-dark: #111827;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  margin: 0;
  padding: 0;
  max-width: 100%;
  overflow-x: hidden;
}

/* Mobile overflow & media fixes */
html, body { max-width: 100%; overflow-x: hidden; }
*, *::before, *::after { box-sizing: border-box; }
img, video, canvas, svg { max-width: 100%; height: auto; }
/* Ensure long text/URLs wrap inside chat bubbles */
.whitespace-pre-wrap { overflow-wrap: anywhere; word-break: break-word; }

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.animate-fadeIn {
  animation: fadeIn 0.5s ease-out;
}

.animate-pulse {
  animation: pulse 2s infinite;
}

.animate-spin {
  animation: spin 1s linear infinite;
}

/* Custom scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--gray-light);
}

::-webkit-scrollbar-thumb {
  background: #9ca3af;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #6b7280;
}

/* Cards hover effect */
.card-hover {
  transition: all 0.3s ease;
}

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

/* Progress bars */
.progress-bar {
  position: relative;
  overflow: hidden;
}

.progress-bar::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.3),
    transparent
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Confidence Index styles */
.confidence-ring {
  position: relative;
  display: inline-block;
}

.confidence-ring svg {
  transform: rotate(-90deg);
}

.confidence-ring-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 2rem;
  font-weight: bold;
}

/* Tooltip styles */
.tooltip {
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s;
}

.tooltip.show {
  opacity: 1;
}

/* File upload zone */
.upload-zone {
  border: 2px dashed #d1d5db;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  transition: all 0.3s;
  cursor: pointer;
}

.upload-zone:hover {
  border-color: var(--primary-color);
  background-color: #eff6ff;
}

.upload-zone.dragover {
  border-color: var(--primary-color);
  background-color: #dbeafe;
}

/* Status badges */
.status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.status-badge.active {
  background-color: #dcfce7;
  color: #166534;
}

.status-badge.pending {
  background-color: #fef3c7;
  color: #92400e;
}

.status-badge.completed {
  background-color: #dbeafe;
  color: #1e40af;
}

/* Notification styles */
.notification {
  position: fixed;
  top: 1rem;
  right: 1rem;
  padding: 1rem 1.5rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  z-index: 9999;
  animation: slideIn 0.3s ease-out;
}

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

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border: 3px solid rgba(0, 0, 0, 0.1);
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s ease-in-out infinite;
}

/* iOS input row fix + input-adjoined button style */
.input-row { display: flex; gap: .75rem; align-items: center; }
.input-row.gap-0 { gap: 0; }
.input-row > * { min-width: 0; }
.input-row .shrink-0 { flex-shrink: 0; }

/* Adjoined send button visually merged with input */
.input-adjoined { display: flex; align-items: center; border: 1px solid #d1d5db; border-radius: 0.5rem; background: #fff; overflow: visible; } /* reverted to flex container for reliable clicks */
.input-adjoined input { border: 0; }
.input-adjoined input { border-radius: 0.5rem 0 0 0.5rem; border: 0; padding-right: 0.75rem; width: 100%; min-width: 0; }
.input-adjoined .send-btn { position: relative; margin-left: auto; width: 2.5rem; height: 2.5rem; display: inline-flex; align-items: center; justify-content: center; background: #2563eb; color: #fff; border-left: 0; border-radius: 0 0.5rem 0.5rem 0; cursor: pointer; }
.input-adjoined .send-btn:hover { background: #1d4ed8; }
.input-adjoined input { padding-right: 3rem; }
.input-adjoined:focus-within { outline: 2px solid rgba(59,130,246,.3); outline-offset: 0; }

/* Mobile input and button polish */
#file-button { border: 0; background: transparent; cursor: pointer; }
#file-button:focus { outline: none; box-shadow: none; }
.input-adjoined input { -webkit-appearance: none; appearance: none; }
.input-adjoined .send-btn { box-shadow: none; }

/* Sticky mobile layout: pinned header, compact progress, messages scroll, pinned input */
.sticky-enabled {
  --header-height: 64px;
  --top-progress-height: 36px;
}

/* Header pinned */
.sticky-enabled .chat-header {
  position: sticky;
  top: env(safe-area-inset-top, 0);
  z-index: 40;
  background: #f9fafb;
  padding-top: env(safe-area-inset-top, 0);
}

/* Top compact progress (2nd floor) + top estimates banner (3rd floor) are inside #chat-card before #chat-messages */
.sticky-enabled #top-progress { position: sticky; top: calc(env(safe-area-inset-top, 0) + var(--header-height)); z-index: 35; }
.sticky-enabled #top-estimates-banner { position: sticky; top: calc(env(safe-area-inset-top, 0) + var(--header-height) + var(--top-progress-height)); z-index: 34; }

/* Full-height column with scrollable messages */
.sticky-enabled .chat-col { display: flex; flex-direction: column; min-height: 100svh; }
.sticky-enabled #chat-card { display: flex; flex-direction: column; min-height: calc(100svh - env(safe-area-inset-bottom, 0)); overflow: visible; }
.sticky-enabled #chat-messages { flex: 1 1 auto; overflow-y: auto; -webkit-overflow-scrolling: touch; height: auto; min-height: 0; padding-bottom: calc(env(safe-area-inset-bottom, 0) + 96px); }

/* Pinned input at bottom */
.sticky-enabled #chat-input-bar { position: sticky; bottom: env(safe-area-inset-bottom, 0); background: #fff; z-index: 50; padding-bottom: calc(env(safe-area-inset-bottom, 0) + 8px); border-top: 1px solid #e5e7eb; box-shadow: 0 -2px 10px rgba(0,0,0,0.03); }

/* Sidebar blocks sticky under header */
.sticky-enabled .sidebar-sticky { position: sticky; top: calc(env(safe-area-inset-top, 0) + var(--header-height) + 8px); }

/* iOS safe area pad for adjoined input */
.sticky-enabled .input-adjoined { padding-bottom: env(safe-area-inset-bottom, 0); }

/* Responsive utilities */
@media (max-width: 768px) {
  .hide-mobile {
    display: none;
  }
}

@media (min-width: 769px) {
  .hide-desktop {
    display: none;
  }
}