:root {
  --bg-color: #0f111a;
  --card-bg: rgba(255, 255, 255, 0.03);
  --card-border: rgba(255, 255, 255, 0.08);
  --primary-color: #6366f1;
  --primary-hover: #4f46e5;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --input-bg: rgba(0, 0, 0, 0.2);
  --input-border: rgba(255, 255, 255, 0.1);
  --input-focus: #818cf8;
  --error: #ef4444;
  --success: #10b981;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
}

/* Background Glow Effect */
.glow-bg {
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 50% 50%, rgba(99, 102, 241, 0.15), transparent 60%);
  z-index: -1;
  pointer-events: none;
}

.container {
  width: 100%;
  max-width: 800px;
  padding: 2rem;
  z-index: 10;
}

header {
  text-align: center;
  margin-bottom: 2rem;
}

.logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--primary-color), var(--primary-hover));
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4);
}

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

.form-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  padding: 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

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

.input-group.full-width {
  grid-column: 1 / -1;
  margin-bottom: 1.5rem;
}

label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

input, select, textarea {
  background: var(--input-bg);
  border: 1px solid var(--input-border);
  color: var(--text-main);
  border-radius: 10px;
  padding: 0.8rem 1rem;
  font-family: inherit;
  font-size: 0.95rem;
  transition: all 0.3s ease;
  outline: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.2);
}

input::placeholder, textarea::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

option {
  background-color: #1e293b;
  color: var(--text-main);
}

.file-upload-wrapper {
  margin-bottom: 2rem;
}

.file-drop-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 100%;
  padding: 2rem;
  border: 2px dashed var(--input-border);
  border-radius: 12px;
  background-color: rgba(255, 255, 255, 0.02);
  transition: all 0.3s ease;
  cursor: pointer;
  text-align: center;
}

.file-drop-area:hover, .file-drop-area.is-active {
  background-color: rgba(99, 102, 241, 0.05);
  border-color: var(--primary-color);
}

.file-input {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 100%;
  cursor: pointer;
  opacity: 0;
  z-index: 10;
}

.upload-icon {
  color: var(--primary-color);
  margin-bottom: 0.5rem;
}

.file-msg {
  font-size: 0.9rem;
  color: var(--text-muted);
}

.file-name {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--primary-color);
  font-weight: 500;
}

.btn-primary {
  width: 100%;
  padding: 1rem;
  background: linear-gradient(135deg, var(--primary-hover), var(--primary-color));
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px -10px rgba(99, 102, 241, 0.8);
}

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

.btn-primary:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

/* Loader */
.btn-loader {
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 50%;
  border-top: 2px solid white;
  width: 20px;
  height: 20px;
  animation: spin 1s linear infinite;
  display: inline-block;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: #1e293b;
  border-left: 4px solid var(--success);
  padding: 1rem 1.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 10px 30px -10px rgba(0,0,0,0.5);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 100;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

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

.toast-icon {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: bold;
}

.toast.error .toast-icon {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error);
}

.toast-message {
  font-size: 0.95rem;
  font-weight: 500;
}

/* Tabs & Navigation */
.header-top {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1.5rem;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 2rem;
}

.tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  padding: 0.6rem 1.5rem;
  border-radius: 30px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
}

.tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
}

.tab-btn.active {
  background: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

/* View Sections */
.view-section {
  display: block;
  animation: fadeIn 0.4s ease-in-out;
}

.view-section.hidden {
  display: none !important;
}

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

/* Grid & Cards - Horizontal Layout */
.opportunities-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-width: 900px;
  margin: 0 auto;
}

.opportunity-card {
  background: var(--card-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.3s, box-shadow 0.3s;
  position: relative;
  overflow: hidden;
}

@media (min-width: 768px) {
  .opportunity-card {
    flex-direction: row;
  }
}

.opportunity-card:hover {
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  border-color: rgba(99, 102, 241, 0.4);
}

.card-header-horizontal {
  flex: 2;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 10;
}

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

.card-image-small {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: contain;
  background-color: #f8fafc;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-grant { color: #047857; background: #d1fae5; border: 1px solid #a7f3d0; }
.badge-vc { color: #1d4ed8; background: #dbeafe; border: 1px solid #bfdbfe; }
.badge-accel { color: #6d28d9; background: #ede9fe; border: 1px solid #ddd6fe; }
.badge-other { color: #b45309; background: #fef3c7; border: 1px solid #fde68a; }

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 0.25rem;
}
.card-provider {
  font-weight: 500;
  color: #cbd5e1;
  margin-bottom: 0.25rem;
  display: block;
}
.card-desc-clamp {
  color: var(--text-muted);
  font-size: 0.9rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
}

.card-right-sidebar {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem;
  background: rgba(255, 255, 255, 0.02);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0 0 12px 12px;
}

@media (min-width: 768px) {
  .card-right-sidebar {
    border-top: none;
    border-left: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 0 12px 12px 0;
  }
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.9rem;
  color: #cbd5e1;
  margin-bottom: 0.75rem;
}

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

.bg-green { background: #d1fae5; color: #15803d; }
.bg-orange { background: #ffedd5; color: #c2410c; }
.stat-val-big { font-size: 1rem; font-weight: 600; color: var(--text-main); }

.card-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
}

.btn-icon {
  flex: 1;
  padding: 0.6rem;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.2s;
}

.btn-preview { background: rgba(255, 255, 255, 0.1); color: var(--text-main); }
.btn-preview:hover { background: rgba(255, 255, 255, 0.2); }
.btn-edit { background: rgba(99, 102, 241, 0.2); color: #818cf8; }
.btn-edit:hover { background: rgba(99, 102, 241, 0.3); }
.btn-delete { background: rgba(239, 68, 68, 0.1); color: var(--error); }
.btn-delete:hover { background: rgba(239, 68, 68, 0.2); }

.btn-cancel {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--input-border);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-cancel:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
}

/* Modal Styling */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}

.modal.hidden {
  display: none !important;
}

.modal-content {
  background: var(--bg-color);
  border: 1px solid var(--card-border);
  width: 90%;
  max-width: 1000px;
  height: 90vh;
  border-radius: 16px;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
}

.close-modal {
  position: absolute;
  top: 1rem;
  right: 1.5rem;
  font-size: 2rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.close-modal:hover { color: var(--text-main); }

.preview-layout {
  display: flex;
  flex-direction: column;
}

@media (min-width: 768px) {
  .preview-layout {
    flex-direction: row;
  }
}

.preview-sidebar {
  flex: 1;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 3rem 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.preview-image-container {
  width: 120px;
  height: 120px;
  background: white;
  border-radius: 12px;
  padding: 10px;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-image-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.preview-title { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.5rem; }
.preview-provider { color: var(--text-muted); font-weight: 500; margin-bottom: 1.5rem; }
.preview-badge-container { margin-bottom: 2rem; }

.preview-stats { width: 100%; display: flex; flex-direction: column; gap: 1rem; }
.stat-box { display: flex; align-items: center; gap: 1rem; padding: 1rem; background: var(--card-bg); border: 1px solid var(--card-border); border-radius: 8px; }
.stat-text { text-align: left; }
.stat-label { font-size: 0.75rem; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin-bottom: 0.2rem; }
.stat-value { font-weight: 700; color: var(--text-main); }

.preview-main {
  flex: 2;
  padding: 3rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

.preview-section-block h2 { font-size: 1.25rem; font-weight: 700; margin-bottom: 1rem; display: flex; align-items: center; gap: 0.5rem; }
.preview-icon { color: var(--primary-color); }
.preview-long-text { color: #cbd5e1; line-height: 1.7; font-size: 1.05rem; white-space: pre-wrap; }
.eligibility-box { background: rgba(253, 230, 138, 0.05); border: 1px solid rgba(253, 230, 138, 0.2); padding: 1.5rem; border-radius: 12px; }
.eligibility-box .preview-long-text { color: #fef3c7; }

@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
}

/* Login UI */
.login-wrapper {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.login-wrapper.hidden {
  display: none !important;
}

.login-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.8);
  border-radius: 24px;
  width: 100%;
  max-width: 400px;
  padding: 3rem 2.5rem;
  position: relative;
  z-index: 10;
}

.login-input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--input-border);
  border-radius: 12px;
  padding: 0.8rem 1rem;
  color: var(--text-main);
  width: 100%;
  font-size: 0.95rem;
  margin-top: 0.5rem;
  transition: all 0.3s ease;
}

.login-input:focus {
  outline: none;
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.header-logout {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-logout:hover {
  background: rgba(239, 68, 68, 0.2);
}
