/* =============================================================================
   NIM VECTORS THEME - nimvector.cc
   NIM Brand Colors and Custom Styles
============================================================================= */

:root {
  /* NIM Brand Colors */
  --nim-primary: #0674bb;
  --nim-primary-dark: #055a94;
  --nim-primary-light: #0891d8;
  --nim-primary-lighter: #e6f4fc;

  /* Neutral Colors */
  --nim-bg: #f8f9fa;
  --nim-surface: #ffffff;
  --nim-border: #e2e8f0;
  --nim-text: #1a202c;
  --nim-text-muted: #64748b;

  /* Status Colors */
  --nim-success: #22c55e;
  --nim-warning: #f59e0b;
  --nim-error: #ef4444;
  --nim-info: #3b82f6;

  /* Shadows */
  --nim-shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --nim-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --nim-shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --nim-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Transitions */
  --nim-transition: all 0.2s ease;
}

/* Dark mode */
.dark {
  --nim-bg: #0f172a;
  --nim-surface: #1e293b;
  --nim-border: #334155;
  --nim-text: #f1f5f9;
  --nim-text-muted: #94a3b8;
}

/* =============================================================================
   BASE STYLES
============================================================================= */

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--nim-bg);
  color: var(--nim-text);
  margin: 0;
  padding: 0;
  min-height: 100vh;
}

/* =============================================================================
   LAYOUT
============================================================================= */

.app-container {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 280px;
  background: var(--nim-surface);
  border-right: 1px solid var(--nim-border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

/* =============================================================================
   HEADER
============================================================================= */

.header {
  background: var(--nim-surface);
  border-bottom: 1px solid var(--nim-border);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--nim-primary);
}

.header-logo img {
  height: 32px;
  width: auto;
}

/* =============================================================================
   BUTTONS
============================================================================= */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0.5rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--nim-transition);
  text-decoration: none;
}

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

.btn-primary {
  background: var(--nim-primary);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: var(--nim-primary-dark);
}

.btn-secondary {
  background: var(--nim-surface);
  color: var(--nim-text);
  border-color: var(--nim-border);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--nim-bg);
}

.btn-ghost {
  background: transparent;
  color: var(--nim-text-muted);
}

.btn-ghost:hover:not(:disabled) {
  background: var(--nim-bg);
  color: var(--nim-text);
}

.btn-sm {
  padding: 0.375rem 0.75rem;
  font-size: 0.75rem;
}

.btn-icon {
  padding: 0.5rem;
}

/* =============================================================================
   INPUTS
============================================================================= */

.input {
  width: 100%;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  border: 1px solid var(--nim-border);
  border-radius: 0.5rem;
  background: var(--nim-surface);
  color: var(--nim-text);
  transition: var(--nim-transition);
}

.input:focus {
  outline: none;
  border-color: var(--nim-primary);
  box-shadow: 0 0 0 3px var(--nim-primary-lighter);
}

.input::placeholder {
  color: var(--nim-text-muted);
}

textarea.input {
  resize: vertical;
  min-height: 100px;
}

select.input {
  cursor: pointer;
}

/* =============================================================================
   CARDS
============================================================================= */

.card {
  background: var(--nim-surface);
  border: 1px solid var(--nim-border);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: var(--nim-shadow-sm);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--nim-border);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--nim-text);
}

/* =============================================================================
   CHAT UI
============================================================================= */

.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.message {
  display: flex;
  gap: 1rem;
  max-width: 85%;
}

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

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--nim-primary-lighter);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 600;
  color: var(--nim-primary);
}

.message.user .message-avatar {
  background: var(--nim-primary);
  color: white;
}

.message-content {
  background: var(--nim-surface);
  border: 1px solid var(--nim-border);
  border-radius: 1rem;
  padding: 1rem;
  line-height: 1.6;
}

.message.user .message-content {
  background: var(--nim-primary);
  color: white;
  border-color: var(--nim-primary);
}

.message-content pre {
  background: var(--nim-bg);
  padding: 1rem;
  border-radius: 0.5rem;
  overflow-x: auto;
  margin: 0.5rem 0;
}

.message-content code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.875rem;
}

/* =============================================================================
   CHAT INPUT
============================================================================= */

.chat-input-container {
  padding: 1rem 1.5rem;
  background: var(--nim-surface);
  border-top: 1px solid var(--nim-border);
}

.chat-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: flex-end;
}

.chat-input {
  flex: 1;
  min-height: 48px;
  max-height: 200px;
  padding: 0.75rem 1rem;
  font-size: 0.9375rem;
  border: 1px solid var(--nim-border);
  border-radius: 1.5rem;
  background: var(--nim-bg);
  resize: none;
  overflow-y: auto;
}

.chat-input:focus {
  outline: none;
  border-color: var(--nim-primary);
}

.chat-send-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--nim-primary);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--nim-transition);
}

.chat-send-btn:hover:not(:disabled) {
  background: var(--nim-primary-dark);
}

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

/* =============================================================================
   SIDEBAR
============================================================================= */

.sidebar-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--nim-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
}

.conversation-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.conversation-item {
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: var(--nim-transition);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.conversation-item:hover {
  background: var(--nim-bg);
}

.conversation-item.active {
  background: var(--nim-primary-lighter);
  color: var(--nim-primary);
}

.conversation-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
}

/* =============================================================================
   TABS
============================================================================= */

.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--nim-border);
  padding: 0 1rem;
}

.tab {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--nim-text-muted);
  background: transparent;
  border: none;
  cursor: pointer;
  position: relative;
  transition: var(--nim-transition);
}

.tab:hover {
  color: var(--nim-text);
}

.tab.active {
  color: var(--nim-primary);
}

.tab.active::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--nim-primary);
}

/* =============================================================================
   MODAL
============================================================================= */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: var(--nim-transition);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--nim-surface);
  border-radius: 1rem;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--nim-shadow-lg);
  transform: scale(0.95);
  transition: var(--nim-transition);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

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

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--nim-border);
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* =============================================================================
   GENERATION GALLERY
============================================================================= */

.generation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.generation-card {
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--nim-border);
  background: var(--nim-surface);
  transition: var(--nim-transition);
}

.generation-card:hover {
  box-shadow: var(--nim-shadow-md);
}

.generation-card img,
.generation-card video {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.generation-card-info {
  padding: 0.75rem;
}

/* =============================================================================
   LOADING STATES
============================================================================= */

.loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--nim-border);
  border-top-color: var(--nim-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.skeleton {
  background: linear-gradient(90deg, var(--nim-bg) 25%, var(--nim-border) 50%, var(--nim-bg) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

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

/* =============================================================================
   UTILITY CLASSES
============================================================================= */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.p-4 { padding: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.text-sm { font-size: 0.875rem; }
.text-muted { color: var(--nim-text-muted); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hidden { display: none; }

/* =============================================================================
   RESPONSIVE
============================================================================= */

@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .message {
    max-width: 95%;
  }
}

/* =============================================================================
   TIER BADGES
============================================================================= */

.tier-badge {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.tier-badge .tier-name {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}

.tier-badge .tier-name::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
}

/* Tier Colors */
.tier-admin {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.tier-admin .tier-name::before {
  background: white;
}

.tier-creator_enterprise, .tier-enterprise {
  background: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  color: white;
}

.tier-creator_enterprise .tier-name::before, .tier-enterprise .tier-name::before {
  background: white;
}

.tier-creator_professional, .tier-professional {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
}

.tier-creator_professional .tier-name::before, .tier-professional .tier-name::before {
  background: white;
}

.tier-creator_essential, .tier-essential {
  background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
  color: white;
}

.tier-creator_essential .tier-name::before, .tier-essential .tier-name::before {
  background: white;
}

.tier-fff_premium, .tier-premium {
  background: linear-gradient(135deg, #a855f7 0%, #9333ea 100%);
  color: white;
}

.tier-fff_premium .tier-name::before, .tier-premium .tier-name::before {
  background: white;
}

.tier-fff_basic, .tier-basic {
  background: var(--nim-bg);
  color: var(--nim-text-muted);
  border: 1px solid var(--nim-border);
}

/* Model Selector Tier Indicators */
select optgroup {
  font-weight: 600;
  color: var(--nim-primary);
  background: var(--nim-bg);
}

select option {
  padding: 0.5rem;
}

select option:disabled {
  color: var(--nim-text-muted);
  font-style: italic;
}

/* Inline tier badges for model list */
.tier-label {
  display: inline-block;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  font-size: 0.625rem;
  font-weight: 600;
  text-transform: uppercase;
  margin-left: 0.25rem;
}

.tier-label-essential { background: #dcfce7; color: #166534; }
.tier-label-professional { background: #dbeafe; color: #1e40af; }
.tier-label-enterprise { background: #fef3c7; color: #92400e; }
.tier-label-basic { background: #f3f4f6; color: #4b5563; }
.tier-label-premium { background: #f3e8ff; color: #7c3aed; }
.tier-label-blocked { background: #fee2e2; color: #991b1b; }
