/* Gold & Indigo themed styling for AfraTether Mock Sandbox */
:root {
  --bg-primary: #080e18;
  --card-bg: rgba(14, 25, 44, 0.7);
  --card-border: rgba(255, 255, 255, 0.05);
  --text-main: #f3f4f6;
  --text-muted: #8e9bb0;
  
  --gold: #f39c12;
  --gold-glow: rgba(243, 156, 18, 0.25);
  --navy: #3b82f6;
  --navy-glow: rgba(59, 130, 246, 0.2);
  --green: #00db8b;
  --green-glow: rgba(0, 219, 139, 0.2);
  --orange: #e67e22;
  --orange-glow: rgba(230, 126, 34, 0.25);
  --red: #ff3c3c;
  --red-glow: rgba(255, 60, 60, 0.2);

  --font-en: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-fa: 'Vazirmatn', Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: var(--font-fa);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

/* Background Glow Orbs */
.glow-orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(160px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.35;
}
.orb-gold {
  width: 450px;
  height: 450px;
  background: var(--gold);
  top: -150px;
  right: -50px;
}
.orb-navy {
  width: 500px;
  height: 500px;
  background: var(--navy);
  bottom: -150px;
  left: -100px;
}

.app-container {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  animation: fadeIn 0.5s ease-out forwards;
}

/* Glass Card */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.45);
}

.glass-card:hover {
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 12px 40px 0 rgba(0, 0, 0, 0.55);
}

/* Header */
.main-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
}

.header-right {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--gold), #f1c40f);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-en);
  font-weight: 700;
  font-size: 1.5rem;
  color: #000;
  box-shadow: 0 0 15px var(--gold-glow);
}

.logo-wrapper h1 {
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.gold-glow {
  background-color: var(--gold);
  box-shadow: 0 0 8px var(--gold);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(243, 156, 18, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(243, 156, 18, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(243, 156, 18, 0); }
}

/* Badges */
.badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-weight: 500;
  display: inline-block;
}

.badge-gold {
  background: var(--gold-glow);
  color: var(--gold);
  border: 1px solid rgba(243, 156, 18, 0.3);
}

.badge-cyan {
  background: var(--navy-glow);
  color: var(--navy);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

/* Stats Section */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.25rem 1.5rem;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.stat-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.stat-icon.gold { background: var(--gold-glow); color: var(--gold); }
.stat-icon.navy { background: var(--navy-glow); color: var(--navy); }
.stat-icon.green { background: var(--green-glow); color: var(--green); }
.stat-icon.orange { background: var(--orange-glow); color: var(--orange); }

.stat-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-info h3 {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 400;
}

.stat-info p {
  font-size: 1.6rem;
  font-weight: 700;
  color: #fff;
  font-family: var(--font-en);
}

.stat-info p .currency {
  font-size: 0.8rem;
  font-family: var(--font-fa);
  color: var(--text-muted);
  margin-right: 0.25rem;
}

/* Main Workspace */
.workspace-grid {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 1.5rem;
}

/* Sidebar forms */
.control-panel {
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  height: fit-content;
}

.sidebar-tabs-nav {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
  margin-bottom: 0.25rem;
}

.s-tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.5rem 0.4rem;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  flex: 1;
  font-family: var(--font-fa);
  transition: all 0.2s ease-in-out;
}

.s-tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.02);
}

.s-tab-btn.active {
  color: var(--gold);
  background: var(--gold-glow);
  border-color: rgba(243, 156, 18, 0.15);
}

.s-tab-btn.active[data-stab="stab-failure"] {
  color: var(--red);
  background: var(--red-glow);
  border-color: rgba(255, 56, 56, 0.15);
}

.s-tab-btn.active[data-stab="stab-deposit"] {
  color: var(--green);
  background: var(--green-glow);
  border-color: rgba(0, 219, 139, 0.15);
}

.s-tab-btn.active[data-stab="stab-treasury"] {
  color: var(--navy);
  background: var(--navy-glow);
  border-color: rgba(59, 130, 246, 0.15);
}

.s-tab-btn .icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Sidebar Tab Contents */
.s-tab-content {
  display: none;
  flex-direction: column;
  gap: 1rem;
  animation: tabFadeIn 0.3s ease-out forwards;
}

.s-tab-content.active {
  display: flex;
}

.s-tab-content h2 {
  font-size: 1.02rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
  padding-bottom: 0.6rem;
  margin-bottom: 0.25rem;
}

/* Forms & Inputs */
form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

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

.form-sub-section {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 0.85rem;
  margin-top: 0.5rem;
  margin-bottom: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.sub-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--gold);
  margin-bottom: 0.25rem;
  border-bottom: 1px dashed rgba(243, 156, 18, 0.15);
  padding-bottom: 0.4rem;
}

label {
  font-size: 0.8rem;
  color: var(--text-muted);
}

input, select {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #fff;
  padding: 0.65rem 0.85rem;
  font-size: 0.85rem;
  outline: none;
  font-family: var(--font-fa);
  width: 100%;
  min-width: 0;
}

select option {
  background-color: #0d1522;
  color: #fff;
}

input[dir="ltr"], select[dir="ltr"] {
  font-family: var(--font-en);
}

input:focus, select:focus {
  border-color: var(--gold);
  background: rgba(243, 156, 18, 0.03);
  box-shadow: 0 0 10px rgba(243, 156, 18, 0.1);
}

/* Buttons */
.btn {
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  font-family: var(--font-fa);
}

.btn-primary {
  background: linear-gradient(135deg, var(--gold), #e67e22);
  color: #000;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(243, 156, 18, 0.2);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.35);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-success {
  background: var(--green);
  color: #000;
  font-weight: 600;
  box-shadow: 0 4px 15px var(--green-glow);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 219, 139, 0.4);
}

.btn-danger-outline {
  background: transparent;
  color: var(--red);
  border: 1px solid var(--red);
}

.btn-danger-outline:hover {
  background: var(--red-glow);
}

.btn-secondary-outline {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
}

.btn-secondary-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.btn-block {
  width: 100%;
}

.btn-xs {
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

.btn .icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.form-info-tip {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.02);
  padding: 0.75rem;
  border-right: 3px solid var(--gold);
  border-radius: 6px 0 0 6px;
  line-height: 1.5;
}

/* Monitoring Panel */
.monitoring-panel {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.tabs-navigation {
  display: flex;
  gap: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
  margin-bottom: 0.5rem;
}

.tab-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-fa);
  transition: all 0.2s ease-in-out;
}

.tab-btn:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.03);
}

.tab-btn.active {
  color: var(--gold);
  background: var(--gold-glow);
  border-color: rgba(243, 156, 18, 0.25);
  box-shadow: 0 0 12px rgba(243, 156, 18, 0.08);
}

.tab-btn .icon {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 1.5rem;
  animation: tabFadeIn 0.35s ease-out forwards;
}

.tab-content.active {
  display: flex;
}

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

.table-section {
  padding: 1.5rem;
}

.section-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.section-title-bar h2 {
  font-size: 1.1rem;
}

/* Styled Table */
.table-scroll-wrapper {
  overflow-x: auto;
  width: 100%;
}

.styled-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  text-align: right;
}

.styled-table th, .styled-table td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.styled-table th {
  color: var(--text-muted);
  font-weight: 500;
  background: rgba(255, 255, 255, 0.01);
}

.styled-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.styled-table td[dir="ltr"] {
  font-family: var(--font-en);
}

.styled-table td.uuid {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--font-en);
  font-size: 0.75rem;
  color: var(--text-muted);
}

.styled-table td.uuid:hover {
  color: var(--gold);
  text-decoration: underline;
  cursor: pointer;
}

.styled-table td.coin-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.coin-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
}

/* Status Badges */
.status-badge {
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.status-badge.active { background: rgba(0, 219, 139, 0.15); color: var(--green); }
.status-badge.inactive { background: rgba(255, 60, 60, 0.15); color: var(--red); }
.status-badge.settled { background: rgba(0, 219, 139, 0.15); color: var(--green); }
.status-badge.unsettled { background: rgba(243, 156, 18, 0.15); color: var(--gold); }
.status-badge.failed { background: rgba(255, 60, 60, 0.15); color: var(--red); }

.loading-state {
  text-align: center;
  padding: 2rem !important;
  color: var(--text-muted);
}

/* Real-time Logger Console */
.logs-section {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.logs-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logs-header h2 {
  font-size: 1.1rem;
}

.logs-header p {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.logs-console {
  background: #03060c;
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  height: 250px;
  overflow-y: auto;
  padding: 1rem;
  font-family: var(--font-en);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.log-row {
  display: flex;
  font-size: 0.75rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  gap: 1rem;
  align-items: flex-start;
  line-height: 1.4;
  border-right: 3px solid transparent;
}

.log-row.get { background: rgba(59, 130, 246, 0.04); border-right-color: var(--navy); }
.log-row.post { background: rgba(243, 156, 18, 0.04); border-right-color: var(--gold); }
.log-row.put { background: rgba(230, 126, 34, 0.04); border-right-color: var(--orange); }
.log-row.delete { background: rgba(255, 60, 60, 0.04); border-right-color: var(--red); }
.log-row.info { background: rgba(255, 255, 255, 0.02); color: var(--text-muted); }

.log-time {
  color: var(--text-muted);
  white-space: nowrap;
}

.log-method {
  font-weight: 700;
  width: 50px;
  text-align: center;
}

.log-row.get .log-method { color: var(--navy); }
.log-row.post .log-method { color: var(--gold); }
.log-row.put .log-method { color: var(--orange); }
.log-row.delete .log-method { color: var(--red); }

.log-url {
  flex: 1;
  color: #fff;
  word-break: break-all;
}

.log-status {
  font-weight: 700;
}

.log-status.success { color: var(--green); }
.log-status.error { color: var(--red); }

/* API Doc Explorer styles */
.api-catalog {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  margin-top: 0.5rem;
}

.api-category-title {
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  border-right: 4px solid var(--gold);
  padding-right: 0.75rem;
  margin-top: 1rem;
  margin-bottom: 0.25rem;
  font-family: var(--font-fa);
}

.api-card {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  border-color: rgba(255, 255, 255, 0.04);
}

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

.api-method-route {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-en);
}

.api-method {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  text-transform: uppercase;
}

.api-method.get { 
  background: rgba(59, 130, 246, 0.1); 
  color: var(--navy); 
  border: 1px solid rgba(59, 130, 246, 0.25); 
}
.api-method.post { 
  background: rgba(243, 156, 18, 0.1); 
  color: var(--gold); 
  border: 1px solid rgba(243, 156, 18, 0.25); 
}
.api-method.put { 
  background: rgba(230, 126, 34, 0.1); 
  color: var(--orange); 
  border: 1px solid rgba(230, 126, 34, 0.25); 
}

.api-route {
  font-size: 0.85rem;
  color: #fff;
  font-weight: 600;
}

.api-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.api-details-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.api-code-block {
  background: #03060b;
  border: 1px solid rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 0.75rem;
  font-family: var(--font-en);
  font-size: 0.73rem;
  color: #c0cedb;
  overflow-x: auto;
  max-height: 150px;
}

.api-code-block code {
  white-space: pre-wrap;
  word-break: break-word;
}

.api-code-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-fa);
  margin-bottom: 0.35rem;
  display: block;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.01);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--gold);
}

/* Footer */
.app-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

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

/* Responsive */
@media (max-width: 1100px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }
  .main-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
  }
  .header-left {
    align-self: flex-end;
  }
}
