/* DOSPEM Clone API layer stylesheet (dca-) */
:root {
  --dca-radius: 0.75rem;
}

@keyframes dcaFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes dcaShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Toast container & items */
#dca-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  max-width: calc(100vw - 2rem);
}

.dca-toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-radius: var(--dca-radius);
  font-size: 0.8125rem;
  font-family: inherit;
  color: var(--foreground, #111);
  background: var(--card, #fff);
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  animation: dcaFadeIn 0.2s ease-out;
  min-width: 16rem;
  max-width: 24rem;
}

.dca-toast-success {
  border-left: 4px solid #10b981;
}

.dca-toast-error {
  border-left: 4px solid #ef4444;
}

.dca-toast-info {
  border-left: 4px solid var(--primary, #6366f1);
}

.dca-toast-action {
  color: var(--primary, #6366f1);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}

.dca-toast-close {
  background: transparent;
  border: none;
  color: var(--muted-foreground, #666);
  cursor: pointer;
  font-size: 1rem;
  padding: 0 0.25rem;
}

/* Modal Overlay & Dialog */
.dca-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: dcaFadeIn 0.15s ease-out;
}

.dca-modal-dialog {
  background: var(--card, #fff);
  color: var(--foreground, #111);
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: var(--dca-radius);
  width: 100%;
  max-width: 32rem;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: inherit;
}

.dca-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border, rgba(0,0,0,0.1));
}

.dca-modal-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.dca-modal-body {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: calc(80vh - 8rem);
  overflow-y: auto;
}

.dca-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  border-top: 1px solid var(--border, rgba(0,0,0,0.1));
  background: var(--muted, rgba(0,0,0,0.02));
}

/* Buttons */
.dca-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.4375rem 0.875rem;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  font-family: inherit;
  text-decoration: none;
}

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

.dca-btn-primary {
  background: var(--primary, #6366f1);
  color: var(--primary-foreground, #fff);
}

.dca-btn-primary:hover:not(:disabled) {
  opacity: 0.92;
}

.dca-btn-outline {
  background: transparent;
  border-color: var(--border, rgba(0,0,0,0.15));
  color: var(--foreground, #111);
}

.dca-btn-outline:hover:not(:disabled) {
  background: var(--muted, rgba(0,0,0,0.05));
}

.dca-btn-danger {
  background: #ef4444;
  color: #fff;
}

.dca-btn-danger:hover:not(:disabled) {
  background: #dc2626;
}

.dca-btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 0.375rem;
}

/* Form Fields */
.dca-field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.dca-label {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground, #111);
}

.dca-input, .dca-textarea, .dca-select {
  width: 100%;
  border-radius: 0.5rem;
  border: 1px solid var(--border, rgba(0,0,0,0.15));
  background: var(--background, #fff);
  color: var(--foreground, #111);
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  box-sizing: border-box;
}

.dca-input:focus, .dca-textarea:focus, .dca-select:focus {
  border-color: var(--primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

.dca-textarea {
  min-height: 5.5rem;
  resize: vertical;
}

/* Error Box */
.dca-error-box {
  padding: 0.625rem 0.875rem;
  border-radius: 0.5rem;
  font-size: 0.8125rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #dc2626;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0;
  animation: dcaFadeIn 0.15s ease-out;
}

.dark .dca-error-box {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #f87171;
}

/* Badges */
.dca-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.125rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--muted, rgba(0,0,0,0.06));
  color: var(--foreground, #111);
}

.dca-badge-success {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.dark .dca-badge-success {
  color: #34d399;
}

.dca-badge-warning {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}
.dark .dca-badge-warning {
  color: #fbbf24;
}

.dca-badge-info {
  background: rgba(99, 102, 241, 0.12);
  color: #4f46e5;
}
.dark .dca-badge-info {
  color: #818cf8;
}

/* Honest Chat Disclaimer */
.dca-disclaimer {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 500;
  background: var(--muted, rgba(0,0,0,0.06));
  color: var(--muted-foreground, #666);
  border: 1px solid var(--border, rgba(0,0,0,0.08));
}

/* Chat Messages */
.dca-chat-msg {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1rem;
  font-size: 0.84375rem;
  line-height: 1.5;
  animation: dcaFadeIn 0.2s ease-out;
}

.dca-chat-user {
  flex-direction: row-reverse;
}

.dca-chat-user .dca-chat-bubble {
  background: var(--primary, #6366f1);
  color: var(--primary-foreground, #fff);
  border-radius: 1rem 1rem 0.25rem 1rem;
  padding: 0.625rem 0.875rem;
  max-width: 80%;
  word-break: break-word;
  white-space: pre-wrap;
}

.dca-chat-assistant .dca-chat-bubble {
  background: var(--card, #fff);
  color: var(--foreground, #111);
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: 1rem 1rem 1rem 0.25rem;
  padding: 0.75rem 1rem;
  max-width: 85%;
  word-break: break-word;
  white-space: pre-wrap;
}

.dca-chat-time {
  font-size: 0.65rem;
  color: var(--muted-foreground, #888);
  margin-top: 0.25rem;
}

/* Notes & List Rows */
.dca-card {
  background: var(--card, #fff);
  color: var(--foreground, #111);
  border: 1px solid var(--border, rgba(0,0,0,0.1));
  border-radius: var(--dca-radius);
  padding: 1rem;
  transition: all 0.15s ease;
}

.dca-note-card {
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.dca-note-card:hover {
  border-color: var(--primary, #6366f1);
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.dca-empty-state {
  text-align: center;
  padding: 3.5rem 1.5rem;
  color: var(--muted-foreground, #666);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.dca-empty-title {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--foreground, #111);
}

.dca-empty-desc {
  font-size: 0.8125rem;
  max-width: 24rem;
}

/* Skeleton animation */
.dca-skeleton {
  background: linear-gradient(90deg, var(--muted, rgba(0,0,0,0.06)) 25%, var(--accent, rgba(0,0,0,0.12)) 50%, var(--muted, rgba(0,0,0,0.06)) 75%);
  background-size: 200% 100%;
  animation: dcaShimmer 1.5s infinite;
  border-radius: 0.375rem;
}
