@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700&display=swap');

:root {
  --bg-color: #0b0f19;
  --panel-bg: rgba(17, 24, 39, 0.7);
  --panel-border: rgba(255, 255, 255, 0.08);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --accent-color: #6366f1; /* Indigo */
  --accent-gradient: linear-gradient(135deg, #818cf8 0%, #6366f1 100%);
  --success-color: #10b981; /* Emerald */
  --success-gradient: linear-gradient(135deg, #34d399 0%, #059669 100%);
  --danger-color: #ef4444;
  --input-bg: rgba(31, 41, 55, 0.5);
  --input-focus-border: #818cf8;
  --shadow-primary: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --transition-speed: 0.3s;
}

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

body {
  font-family: 'Outfit', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  overflow-x: hidden;
  padding: 2rem 1rem;
}

/* Background Glow Effects */
.bg-glow-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.bg-glow-1 {
  position: absolute;
  top: 15%;
  left: 20%;
  width: 400px;
  height: 400px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, rgba(99, 102, 241, 0) 70%);
  filter: blur(40px);
  animation: float 20s infinite alternate;
}

.bg-glow-2 {
  position: absolute;
  bottom: 15%;
  right: 15%;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.12) 0%, rgba(168, 85, 247, 0) 70%);
  filter: blur(50px);
  animation: float 25s infinite alternate-reverse;
}

@keyframes float {
  0% {
    transform: translate(0, 0) scale(1);
  }
  100% {
    transform: translate(50px, 30px) scale(1.1);
  }
}

/* Container */
.container {
  width: 100%;
  max-width: 1200px;
  display: flex;
  flex-direction: column;
  gap: 2rem;
  z-index: 1;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 1rem;
}

header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
  font-weight: 300;
}

/* Glassmorphic Panel Base */
.glass-panel {
  background: var(--panel-bg);
  border: 1px solid var(--panel-border);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 24px;
  padding: 2.5rem;
  box-shadow: var(--shadow-primary);
  transition: box-shadow var(--transition-speed), border-color var(--transition-speed);
}

/* Dropzone Styles */
.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 2px dashed rgba(99, 102, 241, 0.4);
  border-radius: 20px;
  padding: 3rem 2rem;
  background: rgba(31, 41, 55, 0.3);
  cursor: pointer;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  text-align: center;
  position: relative;
  overflow: hidden;
}

.dropzone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.05) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-speed);
  pointer-events: none;
}

.dropzone:hover {
  border-color: var(--accent-color);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.15);
  transform: translateY(-2px);
}

.dropzone:hover::before {
  opacity: 1;
}

.dropzone.dragover {
  border-color: var(--success-color);
  background: rgba(16, 185, 129, 0.08);
  box-shadow: 0 0 25px rgba(16, 185, 129, 0.2);
  transform: scale(1.02);
}

.dropzone-icon {
  width: 64px;
  height: 64px;
  background: rgba(99, 102, 241, 0.1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1.5rem;
  color: var(--accent-color);
  transition: transform var(--transition-speed), color var(--transition-speed);
}

.dropzone:hover .dropzone-icon {
  transform: scale(1.1) rotate(5deg);
  color: #818cf8;
}

.dropzone.dragover .dropzone-icon {
  color: var(--success-color);
  background: rgba(16, 185, 129, 0.15);
}

.dropzone h3 {
  font-size: 1.3rem;
  margin-bottom: 0.5rem;
  font-weight: 500;
}

.dropzone p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
}

.file-info {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--success-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.5rem 1rem;
  border-radius: 50px;
  border: 1px solid rgba(16, 185, 129, 0.2);
  animation: fadeIn 0.3s ease;
}

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

/* Loader */
.loader-container {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  margin: 2rem 0;
}

.loader {
  width: 48px;
  height: 48px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-left-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

.loader-text {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* App Content Section */
.app-content {
  display: none;
  animation: fadeIn 0.5s ease-out forwards;
}

.app-content.visible {
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

/* Section Titles */
.section-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--panel-border);
  padding-bottom: 0.75rem;
}

.section-header h2 {
  font-size: 1.4rem;
  font-weight: 600;
  color: #fff;
}

.section-header svg {
  color: var(--accent-color);
}

/* Form Layout Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1.5rem;
  margin-bottom: 2.5rem;
}

.col-12 { grid-column: span 12; }
.col-8  { grid-column: span 8; }
.col-6  { grid-column: span 6; }
.col-4  { grid-column: span 4; }
.col-3  { grid-column: span 3; }

@media (max-width: 768px) {
  .col-8, .col-6, .col-4, .col-3 {
    grid-column: span 12;
  }
}

/* Form Group & Input Styling */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-control {
  font-family: inherit;
  font-size: 1rem;
  color: var(--text-primary);
  background: var(--input-bg);
  border: 1px solid var(--panel-border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  width: 100%;
  transition: all var(--transition-speed);
  outline: none;
}

.form-control:focus {
  border-color: var(--input-focus-border);
  background: rgba(31, 41, 55, 0.8);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}

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

/* Button & Action Bar Styles */
.actions-bar {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 2rem;
  border-top: 1px solid var(--panel-border);
  padding-top: 1.5rem;
  flex-wrap: wrap;
}

.btn {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  border: none;
  transition: all var(--transition-speed) cubic-bezier(0.4, 0, 0.2, 1);
  color: #fff;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-gradient);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #9395f8 0%, #7678f2 100%);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
  transform: translateY(-1px);
}

.btn-success {
  background: var(--success-gradient);
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.btn-success:hover {
  background: linear-gradient(135deg, #4ad8a4 0%, #06a977 100%);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--panel-border);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Toast Message Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: rgba(17, 24, 39, 0.95);
  border: 1px solid var(--success-color);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  padding: 1rem 1.5rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-primary);
  z-index: 100;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none;
}

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

.toast-icon {
  color: var(--success-color);
  display: flex;
  align-items: center;
}

/* Footer Section */
footer {
  margin-top: auto;
  padding-top: 3rem;
  text-align: center;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 300;
}

footer a {
  color: var(--accent-color);
  text-decoration: none;
}

footer a:hover {
  text-decoration: underline;
}

/* Custom Scrollbar for Form controls and Document */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

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

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Excel & Workspace UI Styles */
.settings-toggle-container {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
}

.settings-panel {
  margin-bottom: 2rem;
  padding: 2rem;
  border-color: rgba(99, 102, 241, 0.2);
  animation: slideDown 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.1) forwards;
}

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

.help-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Spinner Rotate class */
.spin {
  animation: spin 1s linear infinite !important;
}

/* Workspace Grid Layout */
.workspace-container {
  display: grid;
  grid-template-columns: 350px 1fr;
  gap: 1.5rem;
  align-items: start;
  width: 100%;
}

.pdf-sidebar {
  display: flex;
  flex-direction: column;
  padding: 1.5rem !important;
  max-height: 800px;
}

.pdf-details-panel {
  padding: 2.5rem !important;
}

/* PDF List Styles */
.pdf-list-container {
  overflow-y: auto;
  max-height: 600px;
  padding-right: 0.25rem;
}

.pdf-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pdf-item {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  position: relative;
  transition: all var(--transition-speed) ease;
}

.pdf-item:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-1px);
}

.pdf-item.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-color);
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.1);
}

.pdf-item-content {
  flex-grow: 1;
  min-width: 0; /* truncate text inside */
}

.pdf-item-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}

.pdf-item-meta {
  font-size: 0.8rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  gap: 0.5rem;
}

.pdf-status-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pdf-item.status-loading .pdf-status-icon {
  color: var(--accent-color);
  background: rgba(99, 102, 241, 0.1);
}

.pdf-item.status-success .pdf-status-icon {
  color: var(--success-color);
  background: rgba(16, 185, 129, 0.1);
}

.pdf-item.status-error .pdf-status-icon {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.1);
}

.btn-remove-pdf {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
  border-radius: 6px;
  transition: all var(--transition-speed);
  opacity: 0; /* hide by default */
}

.pdf-item:hover .btn-remove-pdf {
  opacity: 1;
}

.btn-remove-pdf:hover {
  color: var(--danger-color);
  background: rgba(239, 68, 68, 0.1);
}

@media (max-width: 1024px) {
  .workspace-container {
    grid-template-columns: 1fr;
  }
  .pdf-sidebar {
    max-height: 400px;
  }
}

/* Collapsible Section Optional Fields */
.collapsible-section {
  width: 100%;
  margin-top: 1rem;
}

.collapsible-content {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  padding: 2rem 1.5rem;
  margin-bottom: 1.5rem;
}
