/* Apps Interface Styles */

/* Apps Container */
.apps-container {
  display: none;
  flex-direction: column;
  gap: 2rem;
  animation: fadeIn 0.3s ease;
}

.apps-container.active {
  display: flex;
}

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

/* Header */
.apps-header {
  text-align: center;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.apps-header h2 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.apps-header p {
  color: #94a3b8;
  font-size: 0.95rem;
}

/* Auth Status */
.auth-status {
  padding: 1rem;
  border-radius: 10px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  text-align: center;
  margin-bottom: 1.5rem;
}

.success-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: #10b981;
  font-weight: 600;
}

#githubLoginBtn {
  padding: 0.75rem 1.5rem;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
}

#githubLoginBtn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

/* Mode Selector */
.mode-selector {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.mode-option {
  flex: 1;
  min-width: 150px;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.mode-option:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: #6366f1;
}

.mode-option.active {
  background: #6366f1;
  border-color: #6366f1;
  color: white;
}

.mode-option-title {
  font-weight: 600;
  margin-bottom: 0.3rem;
}

.mode-option-desc {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Theme Selector */
.theme-selector {
  margin-bottom: 2rem;
}

.theme-selector h4 {
  margin-bottom: 1rem;
  color: #e2e8f0;
  font-size: 0.95rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
}

.theme-btn {
  padding: 1rem;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
  color: #cbd5e1;
}

.theme-btn:hover {
  border-color: rgba(99, 102, 241, 0.5);
  background: rgba(99, 102, 241, 0.1);
}

.theme-btn.active {
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.theme-preview {
  width: 100%;
  height: 60px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--color1), var(--color2));
}

.theme-preview.modern {
  --color1: #e2e8f0;
  --color2: #64748b;
}

.theme-preview.bold {
  --color1: #f59e0b;
  --color2: #ec4899;
}

.theme-preview.premium {
  --color1: #1e293b;
  --color2: #fbbf24;
}

.theme-btn span {
  font-weight: 600;
  font-size: 0.9rem;
}

.theme-btn small {
  font-size: 0.75rem;
  opacity: 0.7;
}

/* Chat Area */
.app-chat-area {
  background: rgba(13, 27, 42, 0.6);
  border: 1px solid rgba(99, 102, 241, 0.2);
  border-radius: 12px;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.app-chat-area.hidden {
  display: none;
}

.chat-label {
  font-size: 0.9rem;
  color: #cbd5e1;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

#appChatInput {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 1rem;
  color: #f1f5f9;
  font-family: inherit;
  font-size: 0.95rem;
  min-height: 100px;
  resize: vertical;
  transition: all 0.2s;
}

#appChatInput:focus {
  outline: none;
  border-color: #6366f1;
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

/* Generate Button */
#generateAppBtn {
  padding: 1rem 2rem;
  background: linear-gradient(135deg, #6366f1, #06b6d4);
  border: none;
  border-radius: 8px;
  color: white;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 1rem;
  align-self: flex-start;
}

#generateAppBtn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

#generateAppBtn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Response Area */
#appResponse {
  padding: 2rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(99, 102, 241, 0.2);
  min-height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.generating {
  text-align: center;
  color: #94a3b8;
  font-size: 1.1rem;
}

.generating::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%, 20% { content: ''; }
  40% { content: '.'; }
  60% { content: '..'; }
  80%, 100% { content: '...'; }
}

.status-message {
  color: #06b6d4;
  text-align: center;
  font-weight: 500;
}

/* Success Card */
.success-card {
  text-align: left;
  width: 100%;
}

.success-header {
  font-size: 1.2rem;
  font-weight: 700;
  color: #10b981;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.result-section {
  margin-bottom: 1.5rem;
}

.result-section h4 {
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

.link-button {
  display: inline-block;
  padding: 0.75rem 1.25rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid #6366f1;
  border-radius: 6px;
  color: #a5b4fc;
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s;
  word-break: break-all;
}

.link-button:hover {
  background: rgba(99, 102, 241, 0.25);
  transform: translateX(4px);
}

.details-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 6px;
  overflow: hidden;
}

.details-table tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.details-table tr:last-child {
  border-bottom: none;
}

.details-table td {
  padding: 0.75rem;
}

.details-table td:first-child {
  color: #cbd5e1;
  font-weight: 600;
  width: 30%;
}

.details-table code {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-family: 'JetBrains Mono', monospace;
  color: #fbbf24;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary {
  padding: 0.75rem 1.5rem;
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid #6366f1;
  border-radius: 6px;
  color: #a5b4fc;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.btn-secondary:hover {
  background: rgba(99, 102, 241, 0.25);
  transform: translateY(-2px);
}

/* Error Card */
.error-card {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  border-radius: 8px;
  padding: 1.5rem;
  color: #fca5a5;
  font-weight: 500;
}

/* Connected Repositories Section inside Apps Builder */
.apps-repo-section {
  background: rgba(19, 29, 53, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.apps-repo-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.apps-repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 0.85rem;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}

.apps-repo-grid::-webkit-scrollbar {
  width: 6px;
}

.apps-repo-grid::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.apps-repo-card {
  background: rgba(30, 41, 59, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.apps-repo-card:hover {
  background: rgba(99, 102, 241, 0.12);
  border-color: rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

.apps-repo-card.selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: #6366f1;
}

.apps-repo-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.apps-repo-name {
  font-weight: 700;
  font-size: 0.88rem;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.apps-repo-desc {
  font-size: 0.75rem;
  color: #94a3b8;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  min-height: 2.1em;
}

.apps-repo-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding-top: 0.4rem;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

.apps-repo-links {
  display: flex;
  align-items: center;
  gap: 8px;
}

.apps-repo-link-btn {
  font-size: 0.7rem;
  color: #38bdf8;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.apps-repo-link-btn:hover {
  text-decoration: underline;
}

.apps-repo-select-btn {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.apps-repo-select-btn:hover {
  background: #6366f1;
  color: #fff;
}

/* Auth Card inside Apps */
.apps-auth-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.apps-auth-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.apps-auth-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid #10b981;
}

.apps-auth-details {
  text-align: left;
}

.apps-auth-username {
  font-weight: 700;
  font-size: 0.9rem;
  color: #fff;
}

.apps-auth-status {
  font-size: 0.72rem;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 4px;
}

.apps-auth-status-dot {
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 6px #10b981;
}

/* Responsive */
@media (max-width: 768px) {
  .theme-grid {
    grid-template-columns: 1fr;
  }

  .mode-selector {
    flex-direction: column;
  }

  .mode-option {
    min-width: auto;
  }

  .action-buttons {
    flex-direction: column;
  }

  .btn-secondary {
    width: 100%;
  }

  .apps-repo-grid {
    grid-template-columns: 1fr;
  }

  .apps-auth-card {
    flex-direction: column;
    align-items: stretch;
  }
}

