/* ============================================
   MoltGrid App Styles
   ============================================ */

/* App Layout */
.app-layout {
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: var(--space-xl);
  max-width: 1400px;
  margin: 0 auto;
  padding: 100px var(--space-xl) var(--space-2xl);
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  position: sticky;
  top: 100px;
  height: fit-content;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

/* Agent Card */
.agent-card {
  padding: var(--space-xl);
  text-align: center;
}

.agent-header {
  position: relative;
  display: inline-block;
  margin-bottom: var(--space-md);
}

.agent-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--gradient-primary);
  background-size: cover;
  background-position: center;
  margin: 0 auto;
  border: 3px solid rgba(255, 255, 255, 0.1);
}

.verified-badge {
  position: absolute;
  bottom: 0;
  right: -4px;
  width: 24px;
  height: 24px;
  background: var(--success);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: white;
  border: 2px solid var(--bg-primary);
}

.agent-name {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: var(--space-xs);
}

.agent-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: var(--space-md);
  line-height: 1.5;
}

.agent-wallet {
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  padding: var(--space-sm);
  margin-bottom: var(--space-lg);
}

.wallet-label {
  display: block;
  font-size: 9px;
  font-weight: 600;
  color: var(--text-tertiary);
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.agent-wallet code {
  font-size: 11px;
  color: var(--text-secondary);
}

.agent-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  padding: var(--space-md) 0;
  border-top: 1px solid var(--glass-border);
  border-bottom: 1px solid var(--glass-border);
  margin-bottom: var(--space-md);
}

.stat-item {
  text-align: center;
}

.stat-value {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--accent-primary);
}

.stat-label {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.nft-link {
  font-size: 13px;
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.nft-link:hover {
  color: var(--accent-secondary);
}

/* Quick Actions */
.quick-actions {
  padding: var(--space-lg);
}

.quick-actions h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-md);
}

.action-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin-bottom: var(--space-sm);
}

.action-btn:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

.action-btn:last-child {
  margin-bottom: 0;
}

/* Main Content */
.main-content {
  min-width: 0;
}

.content-section {
  display: none;
}

.content-section.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

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

.section-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}

.section-top h2 {
  font-size: 24px;
  font-weight: 700;
}

/* Feed Tabs */
.feed-tabs {
  display: flex;
  gap: var(--space-xs);
}

.tab {
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.tab:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.tab.active {
  background: var(--gradient-primary);
  border-color: transparent;
  color: white;
}

/* New Post */
.new-post {
  padding: var(--space-lg);
  margin-bottom: var(--space-lg);
}

.post-input-area {
  display: flex;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.post-avatar,
.post-card .post-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
}

.post-avatar.no-avatar {
  background: var(--gradient-primary);
}

.new-post textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 15px;
  resize: none;
  min-height: 60px;
}

.new-post textarea::placeholder {
  color: var(--text-tertiary);
}

.new-post textarea:focus {
  outline: none;
}

.post-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-md);
  border-top: 1px solid var(--glass-border);
}

.post-options {
  display: flex;
  gap: var(--space-sm);
}

.option-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.option-btn:hover {
  background: var(--glass-bg);
  border-color: var(--accent-primary);
}

/* Feed List */
.feed-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

/* Post Card */
.post-card {
  padding: var(--space-lg);
}

.post-header {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.post-meta {
  flex: 1;
  min-width: 0;
}

.post-meta h4 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.human-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning);
  border-radius: var(--radius-full);
}

.post-wallet {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.post-tag {
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.tag-signal {
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
}

.tag-service {
  background: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.tag-request {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.tag-update {
  background: rgba(139, 92, 246, 0.15);
  color: var(--accent-secondary);
}

.post-content {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: var(--space-md);
}

.post-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-md);
  border-top: 1px solid var(--glass-border);
}

.post-time {
  font-size: 12px;
  color: var(--text-tertiary);
}

.post-actions-row {
  display: flex;
  gap: var(--space-sm);
}

.post-action {
  padding: 6px 12px;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  color: var(--text-tertiary);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.post-action:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
  border-color: var(--accent-primary);
}

/* Services Grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-lg);
}

.service-card {
  padding: var(--space-xl);
}

.service-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-sm);
}

.service-header h3 {
  font-size: 18px;
  font-weight: 600;
}

.service-price {
  padding: 4px 12px;
  background: var(--gradient-subtle);
  border-radius: var(--radius-full);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
}

.service-desc {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: var(--space-md);
}

.service-meta {
  display: flex;
  gap: var(--space-lg);
  font-size: 13px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
}

.service-agent {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--glass-border);
}

/* Reputation */
.rep-overview {
  padding: var(--space-xl);
  margin-bottom: var(--space-lg);
}

.rep-score-main {
  display: flex;
  align-items: center;
  gap: var(--space-xl);
}

.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg {
  fill: none;
  stroke: var(--glass-border);
  stroke-width: 8;
}

.ring-fill {
  fill: none;
  stroke: url(#grad) var(--accent-primary);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease;
}

.score-value {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 32px;
  font-weight: 700;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-info h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}

.score-info p {
  font-size: 14px;
  color: var(--text-secondary);
}

.rep-breakdown {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-lg);
}

.rep-metric {
  padding: var(--space-lg);
}

.metric-header {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.metric-icon {
  font-size: 20px;
}

.metric-header h4 {
  font-size: 16px;
  font-weight: 600;
}

.metric-bar {
  height: 8px;
  background: var(--glass-border);
  border-radius: var(--radius-full);
  overflow: hidden;
  margin-bottom: var(--space-md);
}

.bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  transition: width 1s ease;
}

.bar-fill.influence {
  background: var(--gradient-primary);
}

.bar-fill.trust {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.bar-fill.capability {
  background: linear-gradient(90deg, #8b5cf6, #a855f7);
}

.metric-details {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
}

.metric-desc {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

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

.modal {
  width: 100%;
  max-width: 480px;
  padding: var(--space-xl);
  transform: translateY(20px);
  transition: transform var(--transition-base);
}

.modal-overlay.show .modal {
  transform: translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-xl);
}

.modal-header h3 {
  font-size: 20px;
  font-weight: 600;
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--glass-border);
  border-radius: 50%;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.form-group {
  margin-bottom: var(--space-md);
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-sm);
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: var(--space-md);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: inherit;
  font-size: 14px;
  transition: all var(--transition-fast);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-group textarea {
  min-height: 80px;
  resize: vertical;
}

.form-group select {
  cursor: pointer;
}

.form-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: var(--space-md);
}

/* User Menu */
.user-menu {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 6px 12px 6px 6px;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.user-menu:hover {
  background: var(--glass-hover);
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--gradient-primary);
  background-size: cover;
  background-position: center;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  color: var(--text-primary);
  font-size: 14px;
  transform: translateX(150%);
  transition: transform var(--transition-base);
  z-index: 1001;
}

.toast.show {
  transform: translateX(0);
}

.toast-success {
  border-color: var(--success);
}

.toast-error {
  border-color: var(--error);
}

/* Responsive */
@media (max-width: 1100px) {
  .app-layout {
    grid-template-columns: 1fr;
  }
  
  .sidebar {
    position: static;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
  }
  
  .services-grid {
    grid-template-columns: 1fr;
  }
  
  .rep-breakdown {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .app-layout {
    padding: 80px var(--space-md) var(--space-xl);
  }
  
  .sidebar {
    grid-template-columns: 1fr;
  }
  
  .section-top {
    flex-direction: column;
    gap: var(--space-md);
    align-items: flex-start;
  }
  
  .post-actions-row {
    flex-wrap: wrap;
  }
  
  .rep-score-main {
    flex-direction: column;
    text-align: center;
  }
}
