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

:root {
  --primary: #4F46E5;
  --primary-hover: #4338CA;
  --secondary: #0EA5E9;
  --background: #0F172A;
  --surface: rgba(30, 41, 59, 0.7);
  --surface-border: rgba(255, 255, 255, 0.1);
  --text-primary: #F8FAFC;
  --text-secondary: #94A3B8;
  --success: #10B981;
  --error: #EF4444;
}

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

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--background);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Utility Classes */
.hidden {
  display: none !important;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

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

@keyframes blobFloat {
  0% { transform: translate(0, 0) scale(1); }
  33% { transform: translate(30px, -50px) scale(1.1); }
  66% { transform: translate(-20px, 20px) scale(0.9); }
  100% { transform: translate(0, 0) scale(1); }
}

.fade-in { animation: fadeIn 0.5s ease-out; }
.slide-up { animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1); }

/* Background Blobs */
.blob {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  z-index: -1;
  opacity: 0.5;
  animation: blobFloat 20s infinite ease-in-out alternate;
}

.blob-1 {
  top: -10%;
  left: -10%;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(79,70,229,0.4) 0%, rgba(15,23,42,0) 70%);
}

.blob-2 {
  bottom: -10%;
  right: -10%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(circle, rgba(14,165,233,0.3) 0%, rgba(15,23,42,0) 70%);
  animation-delay: -5s;
}

/* Layout */
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 2rem;
  max-width: 1200px;
  margin: 0 auto;
}

.app-header {
  text-align: center;
  margin-bottom: 3rem;
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.logo-icon {
  color: var(--secondary);
  width: 32px;
  height: 32px;
}

h1 {
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 span {
  color: var(--secondary);
}

.subtitle {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.app-main {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.app-footer {
  text-align: center;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--surface-border);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

/* Glassmorphism Components */
.glass-card {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  border-radius: 1.5rem;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  position: relative;
  overflow: hidden;
}

/* File Upload */
.upload-section {
  max-width: 800px;
  margin: 0 auto;
  width: 100%;
}

.file-upload-container {
  width: 100%;
}

.drop-zone {
  border: 2px dashed rgba(148, 163, 184, 0.3);
  border-radius: 1rem;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: rgba(15, 23, 42, 0.4);
}

.drop-zone:hover, .drop-zone.dragging {
  border-color: var(--primary);
  background: rgba(79, 70, 229, 0.1);
}

.drop-zone.has-file {
  border-color: var(--success);
  background: rgba(16, 185, 129, 0.1);
  border-style: solid;
}

.file-input-hidden {
  display: none;
}

.upload-icon {
  color: var(--primary);
  margin-bottom: 1rem;
  transition: transform 0.3s ease;
  width: 64px;
  height: 64px;
}

.drop-zone:hover .upload-icon {
  transform: translateY(-5px);
}

.drop-zone h3 {
  font-size: 1.25rem;
  margin-bottom: 0.5rem;
}

.drop-zone p {
  color: var(--text-secondary);
}

.file-info-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  justify-content: center;
}

.file-icon {
  color: var(--success);
  width: 48px;
  height: 48px;
}

.file-details {
  text-align: left;
}

.file-details h4 {
  font-size: 1.1rem;
  margin-bottom: 0.25rem;
}

.file-details p {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.clear-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.clear-btn:hover {
  background: var(--error);
}

.clear-btn i {
  width: 16px;
  height: 16px;
}

.error-banner {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #FCA5A5;
  padding: 1rem;
  border-radius: 0.75rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Processing State */
.processing-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  border-radius: 1.5rem;
}

.spinner {
  color: var(--secondary);
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
  width: 48px;
  height: 48px;
}

/* Instructions */
.instructions {
  margin-top: 3rem;
  background: var(--surface);
  border: 1px solid var(--surface-border);
  border-radius: 1rem;
  padding: 2rem;
}

.instructions h3 {
  margin-bottom: 1.5rem;
  font-size: 1.25rem;
  color: var(--text-primary);
  text-align: center;
}

.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.step {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 1rem;
}

.step-number {
  width: 40px;
  height: 40px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  box-shadow: 0 4px 14px rgba(79, 70, 229, 0.4);
}

.step p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.5;
}

/* Results Section & Table */
.results-section {
  width: 100%;
}

.back-btn {
  background: transparent;
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  padding: 0.75rem 1.25rem;
  border-radius: 0.5rem;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 2rem;
  transition: all 0.2s;
}

.back-btn i {
  width: 18px;
  height: 18px;
}

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

.table-header-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.table-header-info h2 {
  font-size: 1.5rem;
}

.table-title {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.generate-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.generate-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(79, 70, 229, 0.4);
}

.generate-btn i {
  width: 18px;
  height: 18px;
}

.badge {
  background: rgba(14, 165, 233, 0.2);
  color: var(--secondary);
  padding: 0.25rem 0.75rem;
  border-radius: 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  border: 1px solid rgba(14, 165, 233, 0.3);
}

.table-wrapper {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--surface-border);
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  overflow-x: auto;
}

.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

.glass-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.glass-table th {
  background: rgba(0, 0, 0, 0.2);
  padding: 1.25rem 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  border-bottom: 1px solid var(--surface-border);
  white-space: nowrap;
}

.th-content {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.th-content i {
  width: 16px;
  height: 16px;
}

.glass-table td {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  transition: color 0.2s;
}

.glass-table tr {
  animation: slideUp 0.4s ease-out forwards;
  opacity: 0;
  transition: background 0.2s;
}

.glass-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.glass-table tr:hover td {
  color: var(--text-primary);
}

.university-badge {
  background: rgba(79, 70, 229, 0.15);
  color: #A5B4FC;
  padding: 0.35rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  display: inline-block;
}

.email-link {
  color: var(--secondary);
  text-decoration: none;
  transition: opacity 0.2s;
}

.email-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.cv-link {
  color: var(--secondary);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: opacity 0.2s;
  font-weight: 500;
}

.cv-link:hover {
  opacity: 0.8;
  text-decoration: underline;
}

.cv-link i {
  width: 14px;
  height: 14px;
}

.review-select {
  background: rgba(15, 23, 42, 0.5);
  border: 1px solid var(--surface-border);
  color: var(--text-primary);
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.review-select:focus {
  border-color: var(--secondary);
  background: rgba(15, 23, 42, 0.8);
}

.review-select option {
  background: #1E293B;
  color: var(--text-primary);
}

/* Responsive */
@media (max-width: 768px) {
  .app-container {
    padding: 1rem;
  }
  
  h1 {
    font-size: 2rem;
  }
  
  .glass-table th, .glass-table td {
    padding: 1rem;
  }
}

/* History Section */
.history-card {
  margin-top: 2rem;
}

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

.history-header h3 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.25rem;
  color: var(--text-primary);
}

.history-header h3 i {
  width: 20px;
  height: 20px;
  color: var(--secondary);
}

.clear-history-btn {
  background: rgba(239, 68, 68, 0.1);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s;
}

.clear-history-btn:hover {
  background: rgba(239, 68, 68, 0.2);
}

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

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 0.75rem;
  cursor: pointer;
  transition: all 0.2s;
}

.history-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}

.history-item-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.history-item-name {
  font-weight: 500;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.history-item-meta {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.history-item-action {
  color: var(--primary);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.history-item:hover .history-item-action {
  opacity: 1;
}

.history-item-action i {
  width: 16px;
  height: 16px;
}
