/* Elephant Shoes Design System */
/* Node-Based Business Platform */

/* === FONTS === */
@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* === VARIABLES === */
:root {
  /* Brand Colors */
  --es-accent: #14b8a6;
  --es-accent-hover: #0d9488;
  --es-accent-muted: rgba(20, 184, 166, 0.15);
  
  /* Neutrals */
  --es-bg: #0f0f0f;
  --es-bg-elevated: #171717;
  --es-bg-card: #1c1c1c;
  --es-bg-input: #242424;
  --es-border: #2a2a2a;
  --es-border-hover: #3a3a3a;
  
  /* Text */
  --es-text: #fafafa;
  --es-text-muted: #a1a1aa;
  --es-text-dim: #71717a;
  
  /* Status */
  --es-success: #22c55e;
  --es-warning: #f59e0b;
  --es-error: #ef4444;
  --es-info: #3b82f6;
  
  /* Sizing */
  --es-radius: 8px;
  --es-radius-lg: 12px;
  --es-sidebar-width: 260px;
  
  /* Typography */
  --es-font-heading: 'Instrument Serif', serif;
  --es-font-body: 'Plus Jakarta Sans', sans-serif;
}

/* === RESET === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--es-font-body);
  background: var(--es-bg);
  color: var(--es-text);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, textarea, select {
  font-family: inherit;
}

/* === LAYOUT === */
body {
  display: flex;
}

.sidebar {
  width: var(--es-sidebar-width);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  background: var(--es-bg-elevated);
  border-right: 1px solid var(--es-border);
  display: flex;
  flex-direction: column;
  z-index: 100;
}

.main-content {
  flex: 1;
  margin-left: var(--es-sidebar-width);
  min-height: 100vh;
  padding: 2rem;
}

/* === SIDEBAR === */
.sidebar-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--es-border);
}

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

.logo h1 {
  font-family: var(--es-font-heading);
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.logo .version {
  font-size: 0.7rem;
  color: var(--es-text-dim);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.nav-section {
  padding: 0 0.75rem;
  margin-bottom: 1.5rem;
}

.nav-section-title {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--es-text-dim);
  padding: 0 0.75rem;
  margin-bottom: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--es-radius);
  color: var(--es-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.nav-link:hover {
  background: var(--es-accent-muted);
  color: var(--es-text);
}

.nav-link.active {
  background: var(--es-accent-muted);
  color: var(--es-accent);
}

.nav-link .icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--es-border);
}

.business-info {
  font-size: 0.8rem;
  color: var(--es-text-muted);
}

/* === LOADING === */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60vh;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--es-border);
  border-top-color: var(--es-accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* === SETUP === */
.setup-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.setup-card {
  background: var(--es-bg-card);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius-lg);
  padding: 2.5rem;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.setup-card h2 {
  font-family: var(--es-font-heading);
  font-size: 1.75rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.setup-card p {
  color: var(--es-text-muted);
  margin-bottom: 1.5rem;
}

.setup-card form {
  text-align: left;
}

/* === PAGE HEADER === */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 2rem;
}

.page-title {
  font-family: var(--es-font-heading);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
}

.page-subtitle {
  color: var(--es-text-muted);
  font-size: 0.9rem;
  margin-top: 0.25rem;
}

/* === STATS === */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--es-bg-card);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--es-radius);
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-icon svg {
  width: 20px;
  height: 20px;
}

.stat-icon.blue {
  background: rgba(59, 130, 246, 0.15);
  color: #3b82f6;
}

.stat-icon.green {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}

.stat-icon.teal {
  background: var(--es-accent-muted);
  color: var(--es-accent);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

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

/* === SECTIONS === */
.section {
  margin-bottom: 2.5rem;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.section-header h2 {
  font-family: var(--es-font-heading);
  font-size: 1.25rem;
  font-weight: 400;
}

/* === EMPTY STATE === */
.empty-state {
  background: var(--es-bg-card);
  border: 1px dashed var(--es-border);
  border-radius: var(--es-radius-lg);
  padding: 3rem;
  text-align: center;
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--es-text-dim);
  margin-bottom: 1rem;
}

.empty-state h3 {
  font-family: var(--es-font-heading);
  font-size: 1.25rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--es-text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

/* === NODE CARDS === */
.nodes-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.node-card {
  background: var(--es-bg-card);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius-lg);
  padding: 1.25rem;
  transition: all 0.2s ease;
  cursor: pointer;
}

.node-card:hover {
  border-color: var(--es-accent);
  transform: translateY(-2px);
}

.node-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.node-icon {
  width: 40px;
  height: 40px;
  background: var(--es-accent-muted);
  border-radius: var(--es-radius);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--es-accent);
}

.node-icon svg {
  width: 22px;
  height: 22px;
}

.node-type-badge {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--es-text-dim);
  background: var(--es-bg-input);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.node-name {
  font-family: var(--es-font-heading);
  font-size: 1.125rem;
  font-weight: 400;
  margin-bottom: 0.375rem;
}

.node-description {
  font-size: 0.8rem;
  color: var(--es-text-muted);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.node-meta {
  font-size: 0.75rem;
  color: var(--es-text-dim);
}

/* === BUTTONS === */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--es-radius);
  border: none;
  transition: all 0.15s ease;
}

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

.btn-primary {
  background: var(--es-accent);
  color: #000;
}

.btn-primary:hover {
  background: var(--es-accent-hover);
}

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

.btn-secondary {
  background: var(--es-bg-input);
  color: var(--es-text);
  border: 1px solid var(--es-border);
}

.btn-secondary:hover {
  background: var(--es-border);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: var(--es-error);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
}

.btn-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--es-text-muted);
  border-radius: var(--es-radius);
  transition: all 0.15s ease;
}

.btn-close:hover {
  background: var(--es-bg-input);
  color: var(--es-text);
}

.btn-close svg {
  width: 18px;
  height: 18px;
}

/* === FORMS === */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--es-text-muted);
  margin-bottom: 0.5rem;
}

input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
input[type="date"],
textarea,
select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 0.9rem;
  background: var(--es-bg-input);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius);
  color: var(--es-text);
  transition: all 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--es-accent);
  box-shadow: 0 0 0 3px var(--es-accent-muted);
}

input::placeholder,
textarea::placeholder {
  color: var(--es-text-dim);
}

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

/* === MODAL === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
}

.modal {
  background: var(--es-bg-card);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius-lg);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

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

.modal-header h2 {
  font-family: var(--es-font-heading);
  font-size: 1.25rem;
  font-weight: 400;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

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

/* === NODE TYPE SELECTOR === */
.node-type-selector {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.node-type-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  padding: 1rem;
  background: var(--es-bg-input);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius);
  color: var(--es-text-muted);
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.node-type-option:hover {
  border-color: var(--es-border-hover);
  color: var(--es-text);
}

.node-type-option.selected {
  border-color: var(--es-accent);
  background: var(--es-accent-muted);
  color: var(--es-accent);
}

.node-type-option .icon {
  width: 24px;
  height: 24px;
}

.type-description {
  font-size: 0.8rem;
  color: var(--es-text-muted);
  padding: 0.75rem;
  background: var(--es-bg-input);
  border-radius: var(--es-radius);
}

/* === TABLES === */
.table-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--es-text-dim);
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--es-border);
}

td {
  padding: 1rem;
  border-bottom: 1px solid var(--es-border);
  font-size: 0.9rem;
}

tr:hover td {
  background: var(--es-bg-elevated);
}

/* === BADGES === */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.625rem;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-radius: 4px;
}

.badge-success {
  background: rgba(34, 197, 94, 0.15);
  color: var(--es-success);
}

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

.badge-error {
  background: rgba(239, 68, 68, 0.15);
  color: var(--es-error);
}

.badge-info {
  background: rgba(59, 130, 246, 0.15);
  color: var(--es-info);
}

/* === TOAST NOTIFICATIONS === */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  z-index: 300;
}

.toast {
  background: var(--es-bg-card);
  border: 1px solid var(--es-border);
  border-radius: var(--es-radius);
  padding: 1rem 1.25rem;
  min-width: 280px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideIn 0.2s ease;
}

.toast.success {
  border-left: 3px solid var(--es-success);
}

.toast.error {
  border-left: 3px solid var(--es-error);
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .sidebar.open {
    transform: translateX(0);
  }
  
  .main-content {
    margin-left: 0;
    padding: 1rem;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .nodes-grid {
    grid-template-columns: 1fr;
  }
  
  .node-type-selector {
    grid-template-columns: 1fr;
  }
}
