:root {
  --bg: #030712;
  --bg-gradient: linear-gradient(135deg, #030712 0%, #0b1528 100%);
  --sidebar-bg: rgba(15, 23, 42, 0.6);
  --card-bg: rgba(30, 41, 59, 0.45);
  --card-border: rgba(255, 255, 255, 0.06);
  --accent: #3b82f6;
  --accent-glow: rgba(59, 130, 246, 0.15);
  --text: #f8fafc;
  --text-muted: #94a3b8;
  
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  background-image: var(--bg-gradient);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  overflow-x: hidden;
}

/* App Container Layout */
.app-container {
  display: flex;
  width: 100%;
  min-height: 100vh;
}

/* Sidebar Styling */
.sidebar {
  width: 280px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--card-border);
  backdrop-filter: blur(20px);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 48px;
}

.brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(59, 130, 246, 0.25);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.brand h2 {
  font-size: 20px;
  font-weight: 800;
  background: linear-gradient(to right, #ffffff, #93c5fd);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  display: block;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 14px 18px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: var(--transition);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  transform: translateX(4px);
}

.nav-item.active {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #60a5fa;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.1);
}

.nav-icon {
  font-size: 18px;
}

.sidebar-footer {
  padding-top: 24px;
  border-top: 1px solid var(--card-border);
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

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

.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 48px 64px;
  overflow-y: auto;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.tab-content {
  display: none;
  animation: fadeIn 0.4s ease-out;
}

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

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

.header-section {
  margin-bottom: 40px;
}

.header-section h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 8px;
  letter-spacing: -0.5px;
}

.header-section p {
  color: var(--text-muted);
  font-size: 16px;
}

/* Glass Card Styling */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  backdrop-filter: blur(12px);
  border-radius: 24px;
  padding: 32px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.3);
}

/* Form Styles */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.form-section-title {
  grid-column: 1 / -1;
  font-size: 18px;
  font-weight: 700;
  color: #93c5fd;
  margin-top: 16px;
  border-bottom: 1px solid var(--card-border);
  padding-bottom: 8px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-group.full-width {
  grid-column: 1 / -1;
}

.input-group label {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
}

.input-group input[type="text"],
.input-group input[type="email"],
.input-group input[type="number"],
.input-group input[type="tel"],
.input-group select,
.input-group textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 14px 16px;
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: var(--transition);
}

.input-group input:focus,
.input-group select:focus,
.input-group textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.input-group textarea {
  resize: vertical;
}

.checkbox-group {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.checkbox-group input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
  cursor: pointer;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 24px;
}

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
  color: white;
  border: none;
  padding: 14px 28px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(37, 99, 235, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-danger-sm {
  background: var(--danger);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-danger-sm:hover {
  background: #dc2626;
}

.feedback-msg {
  font-size: 14px;
  font-weight: 600;
  transition: var(--transition);
}

.feedback-msg.success {
  color: var(--success);
}

/* Grants Grid / Finder */
.grants-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
  gap: 24px;
}

.grant-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.grant-card:hover {
  transform: translateY(-5px);
  border-color: rgba(59, 130, 246, 0.3);
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.4);
}

.grant-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
}

.grant-provider {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.match-badge {
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.match-badge.high {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
}

.match-badge.warning {
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: #fbbf24;
}

.match-badge.low {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
}

.grant-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 12px;
  line-height: 1.4;
}

.grant-amount {
  font-size: 24px;
  font-weight: 800;
  color: #60a5fa;
  margin-bottom: 16px;
}

.grant-desc {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
}

.grant-footer {
  border-top: 1px solid var(--card-border);
  padding-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.grant-reasons {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.reason-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.reason-bullet {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--text-muted);
}

.grant-footer .btn-fill {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 12px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.grant-footer .btn-fill:hover {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}

/* Automation Terminal tab */
.terminal-container {
  display: flex;
  flex-direction: column;
  height: 450px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 24px;
}

.terminal-header {
  background: #111827;
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #1f2937;
}

.terminal-dots {
  display: flex;
  gap: 6px;
}

.terminal-dots .dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.terminal-dots .dot.red { background: #ef4444; }
.terminal-dots .dot.yellow { background: #f59e0b; }
.terminal-dots .dot.green { background: #10b981; }

.terminal-title {
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  color: var(--text-muted);
}

.terminal-body {
  background: #090d16;
  flex-grow: 1;
  padding: 20px;
  overflow-y: auto;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  line-height: 1.7;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-line {
  display: flex;
  gap: 12px;
}

.log-line .timestamp {
  color: #4b5563;
  user-select: none;
}

.log-line.system { color: #818cf8; }
.log-line.info { color: #e2e8f0; }
.log-line.success { color: #34d399; }
.log-line.warning { color: #fbbf24; }
.log-line.error { color: #f87171; }

.terminal-instructions {
  padding: 24px;
}

.terminal-instructions h3 {
  font-size: 18px;
  color: #93c5fd;
  margin-bottom: 12px;
}

.terminal-instructions ul {
  list-style-type: none;
}

.terminal-instructions li {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-left: 20px;
  position: relative;
}

.terminal-instructions li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Spinner */
.loading-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 0;
  gap: 16px;
  color: var(--text-muted);
}

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

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

/* Dashboard Hero Banner */
.dashboard-hero {
  width: 100%;
  height: 180px;
  border-radius: 24px;
  overflow: hidden;
  margin-bottom: 32px;
  border: 1px solid var(--card-border);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.hero-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
}

/* Avatar / Profile Picture Upload */
.avatar-upload-container {
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 24px;
  margin-bottom: 8px;
}

.avatar-frame-wrapper {
  display: flex;
  align-items: center;
  gap: 24px;
}

.avatar-ring {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  padding: 4px;
  background: linear-gradient(135deg, #3b82f6 0%, #a855f7 100%);
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.25);
  display: flex;
  justify-content: center;
  align-items: center;
}

.avatar-ring img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  background: #1e293b;
}

.avatar-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.btn-avatar-upload {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
  width: fit-content;
}

.btn-avatar-upload:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.avatar-tip {
  font-size: 11px;
  color: var(--text-muted);
}

/* Grant Card Cover Images */
.grant-card-image {
  width: 100%;
  height: 150px;
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.grant-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.grant-card:hover .grant-image {
  transform: scale(1.08);
}
