/* Main App styles */
.App {
  height: 100vh;
  width: 100vw;
  overflow: auto;
  background-color: var(--neutral-200);
  color: var(--text-primary);
}

.App-logo {
  height: 40vmin;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  .App-logo {
    animation: App-logo-spin infinite 20s linear;
  }
}

.App-header {
  background-color: var(--primary-color);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: calc(10px + 2vmin);
  color: var(--text-on-dark);
}

.App-link {
  color: var(--accent-color);
}

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

/* Chat component styles */
.chat-container {
  height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--neutral-100);
}

.chat-header {
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  border-bottom: 1px solid var(--gray-200);
}

.chat-header .nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--primary-color);
  transition: opacity 0.2s ease;
}

.chat-header .nav-logo:hover {
  opacity: 0.8;
}

.chat-header .logo-icon {
  color: var(--primary-color);
}

.chat-header .logo-text {
  font-weight: 600;
  font-size: 16px;
}

.chat-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--primary);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.clear-chat-button {
  position: absolute;
  right: 16px;
  z-index: 10;
  color: white;
}

.app-logo {
  height: 30px;
  width: auto;
  object-fit: contain;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  padding-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.chat-input-container {
  padding: 0.25rem 0.5rem;
  margin-bottom: 0.25rem;
  border-top: 1px solid var(--border-color);
  background-color: var(--neutral-100);
  position: relative;
  min-height: 44px;
  display: flex;
  flex-direction: column;
}

.input-wrapper {
  display: flex;
  align-items: flex-start;
  background-color: var(--neutral-200);
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  position: relative;
  min-height: 44px;
  max-height: 140px;
  margin-bottom: 0.5rem;
  overflow: hidden !important;
}

textarea.chat-input {
  display: block !important;
  width: 100% !important;
  border: none !important;
  background: none !important;
  font-family: inherit !important;
  font-size: 0.95rem !important;
  line-height: 1.15 !important;
  padding: 0 !important;
  padding-right: 90px !important;
  margin: 0 !important;
  resize: none !important;
  min-height: 24px !important;
  max-height: none !important;
  height: 100% !important;
  overflow-y: visible !important;
  white-space: pre-wrap !important;
  color: var(--text-primary) !important;
  flex: 1 1 auto !important;
  outline: none !important;
  box-sizing: border-box !important;
}

.input-buttons {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: transparent;
  padding: 2px 0;
  height: 40px;
  z-index: 10;
}

.footer-text {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-align: center;
}

.send-button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Chat message styles */
.message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
}

.message.user {
  align-self: flex-end;
}

.message.assistant {
  align-self: flex-start;
}

.message-content {
  padding: 1rem;
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
}

.message.user .message-content {
  background-color: var(--primary-light);
  color: var(--text-on-dark);
  border-top-right-radius: 0;
}

.message.assistant .message-content {
  background-color: var(--neutral-200);
  color: var(--text-primary);
  border-top-left-radius: 0;
}

.message-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 0.25rem;
  align-self: flex-end;
}

.message.user .message-time {
  margin-right: 0.5rem;
}

.message.assistant .message-time {
  margin-left: 0.5rem;
}

/* Welcome screen styles */
.welcome-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
  flex: 1;
  background: linear-gradient(180deg, rgba(240, 244, 255, 0.5) 0%, rgba(255, 255, 255, 0) 100%);
}

/*
   The container IS a cloud shape:
   - We use `clip-path` to form a polygon that resembles a cloud.
   - Adjust points to get the exact look you want.
*/
.welcome-header {
  width: 100%;
  max-width: 600px;
  height: 220px;
  margin-bottom: 2.5rem;
  background: linear-gradient(135deg, #f0f4ff 0%, #ffffff 100%);
  box-shadow:
    0 12px 30px rgba(26, 58, 126, 0.12),
    0 4px 8px rgba(26, 58, 126, 0.06),
    inset 0 -8px 12px rgba(255, 255, 255, 0.8),
    inset 0 2px 4px rgba(26, 58, 126, 0.1);
  border: 1px solid rgba(26, 58, 126, 0.08);
  transition: all 0.3s ease;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  /* This is the key: a rough "cloud" polygon shape */
  clip-path: polygon(
    20% 0%,
    80% 0%,
    90% 10%,
    100% 25%,
    95% 40%,
    100% 50%,
    90% 65%,
    95% 80%,
    80% 100%,
    20% 100%,
    5% 80%,
    10% 65%,
    0% 50%,
    5% 40%,
    0% 25%,
    10% 10%
  );
}

.welcome-title {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #1a3a7e 0%, #2a4cad 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  margin-bottom: 0;
  letter-spacing: -0.02em;
  text-align: center;
  width: 100%;
  padding: 0 1.5rem;
  text-shadow: 2px 2px 4px rgba(255, 255, 255, 0.5);
}

.welcome-text {
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--text-secondary);
  max-width: 550px;
  margin-bottom: 3rem;
  text-align: center;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.25rem;
  max-width: 650px;
  width: 100%;
}

.suggestion-button {
  background-color: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  color: var(--gray-800);
  font-weight: 500;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.suggestion-button:hover {
  border-color: var(--primary-color);
  background-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.suggestion-icon {
  color: #1a3a7e;
  width: 32px;
  height: 32px;
  padding: 6px;
  background-color: rgba(26, 58, 126, 0.1);
  border-radius: 8px;
  transition: all 0.25s ease;
}

.suggestion-button:hover .suggestion-icon {
  transform: scale(1.1);
  background-color: rgba(26, 58, 126, 0.2);
}

/* App Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1.5rem;
  background-color: white;
  border-bottom: 1px solid var(--neutral-300);
  position: sticky;
  top: 0;
  z-index: 50;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.app-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

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

.settings-button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.5rem;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.settings-button:hover {
  background-color: var(--neutral-200);
  color: var(--primary-color);
}

.logout-button {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.5rem;
  background-color: var(--neutral-100);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.logout-button:hover {
  background-color: var(--danger-lighter);
  color: var(--danger-color);
}

.tab-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  background-color: transparent;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--gray-600);
}

.tab-button:hover:not(:disabled) {
  background-color: var(--gray-100);
  color: var(--gray-900);
}

.tab-button.active {
  background-color: var(--primary-lighter);
  color: var(--primary-color);
}

.tab-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.main-content {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* Update existing styles */
.app-container {
  display: flex;
  height: 100vh;
  background-color: var(--white);
}

.sidebar {
  width: 600px;
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  background-color: var(--white);
}

.document-container {
  flex: 1;
  min-width: 500px;
  display: flex;
  flex-direction: column;
  background-color: var(--gray-50);
  overflow: hidden;
}

.document-header {
  display: flex;
  flex-direction: column;
  margin-bottom: 1rem;
  padding-bottom: 0;
  border-bottom: none;
}

.document-title {
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  color: var(--gray-900) !important;
  margin: 0 0 1rem 0 !important;
  padding-bottom: 0.5rem !important;
  border-bottom: 1px solid var(--gray-200) !important;
  background: linear-gradient(90deg, var(--primary-color) 0%, var(--primary-light) 100%);
  background-clip: text;
  -webkit-background-clip: text;
  color: transparent !important;
  letter-spacing: -0.02em;
}

.document-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--gray-200);
  padding-bottom: 0;
}

.document-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--gray-600);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  top: 1px;
}

.document-tab:hover:not(:disabled) {
  color: var(--gray-900);
}

.document-tab.active {
  color: var(--primary-color);
  border-bottom: 2px solid var(--primary-color);
}

.document-tab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.document-tab svg {
  color: currentColor;
}

.document-empty-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem;
  background-color: var(--gray-50);
  border-radius: 0.5rem;
  color: var(--gray-500);
  font-size: 0.9375rem;
}

/* Document content styling */
.document-content {
  padding: 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
  height: 100%;
  width: 100%;
}

.document-view {
  height: 100%;
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

.document-sections {
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

.document-heading {
  margin-top: 1.25rem;
  margin-bottom: 0.75rem;
  font-weight: 600;
  color: var(--gray-900);
}

.heading-1 {
  font-size: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--gray-200);
}

.heading-2 {
  font-size: 1.25rem;
  margin-top: 1.5rem;
}

.heading-3 {
  font-size: 1.125rem;
}

.document-paragraph {
  margin-bottom: 1rem;
  line-height: 1.6;
  color: var(--gray-700);
}

.document-code-block {
  margin: 1rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  max-width: 100%;
}

.document-code-block pre {
  max-width: 100%;
  overflow-x: auto;
}

.document-code-block code {
  font-size: 0.875rem !important;
  line-height: 1.5 !important;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background-color: #1e293b;
  color: #e2e8f0;
  font-size: 0.75rem;
}

/* Document tags styling */
.document-tags-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
  padding: 0.5rem 0;
  width: 100%;
}

.document-tag-container {
  margin-bottom: 0.5rem;
  flex-shrink: 0;
}

.document-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  font-weight: 500;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  transition: all 0.2s;
  white-space: nowrap;
  max-width: 100%;
  height: 32px;
}

.document-tag span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.document-tag svg {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-right: 0.25rem;
}

.document-tag.success {
  background-color: rgba(16, 185, 129, 0.1);
  color: rgb(6, 95, 70);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.document-tag.error {
  background-color: rgba(239, 68, 68, 0.1);
  color: rgb(153, 27, 27);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.document-tag.pending {
  background-color: rgba(245, 158, 11, 0.1);
  color: rgb(146, 64, 14);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.document-tag.info {
  background-color: rgba(37, 99, 235, 0.1);
  color: rgb(30, 64, 175);
  border: 1px solid rgba(37, 99, 235, 0.2);
}

.document-tag.neutral {
  background-color: rgba(107, 114, 128, 0.1);
  color: rgb(55, 65, 81);
  border: 1px solid rgba(107, 114, 128, 0.2);
}

.document-tag:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Responsive styles */
@media (max-width: 1280px) {
  .sidebar {
    width: 450px;
  }
}

@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: 60vh;
    border-right: none;
    border-bottom: 1px solid var(--gray-200);
  }

  .document-container {
    min-width: auto;
    height: 40vh;
  }
}

@media (max-width: 768px) {
  .header-actions {
    flex-wrap: wrap;
  }

  .tab-button {
    font-size: 13px;
    padding: 4px 8px;
  }
}
