/* ===========================
   Modern shadcn-like Design System
   OpenAI-inspired Color Palette
   =========================== */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Rubik:ital,wght@0,300..900;1,300..900&display=swap');

/* CSS Variables for Theming */
:root {
  /* Light Theme Colors - Keep light mode simple, focus on dark mode */
  --background: 255 255 255;
  --foreground: 10 10 10;
  --card: 255 255 255;
  --card-foreground: 10 10 10;
  --popover: 255 255 255;
  --popover-foreground: 10 10 10;

  /* Vibrant Teal accent colors (2025 aesthetic) */
  --primary: 0 200 150; /* Vibrant teal */
  --primary-foreground: 255 255 255;
  --secondary: 249 250 251;
  --secondary-foreground: 10 10 10;

  /* Muted colors */
  --muted: 243 244 246;
  --muted-foreground: 107 114 128;

  /* Borders and inputs */
  --border: 229 231 235;
  --input: 229 231 235;
  --ring: 0 200 150;

  /* Status colors */
  --success: 34 197 94;
  --warning: 251 191 36;
  --error: 239 68 68;
  --info: 59 130 246;

  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* Border radius */
  --radius: 0.5rem;
  --radius-sm: 0.375rem;
  --radius-lg: 0.75rem;

  /* Transitions */
  --transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  /* Dark Theme Colors - Premium Black aesthetic (2025) */
  --background: 5 5 10;
  --foreground: 245 245 250;
  --card: 15 15 25;
  --card-foreground: 245 245 250;
  --popover: 25 25 40;
  --popover-foreground: 245 245 250;

  /* Vibrant Teal for dark mode - HIGH CONTRAST */
  --primary: 0 220 180;
  --primary-foreground: 5 5 10;
  --secondary: 25 25 40;
  --secondary-foreground: 245 245 250;

  /* Muted colors with better contrast */
  --muted: 35 35 55;
  --muted-foreground: 170 170 190;

  /* Borders and inputs */
  --border: 35 35 55;
  --input: 25 25 40;
  --ring: 0 220 180;

  /* Status colors with enhanced vibrancy */
  --success: 50 220 130;
  --warning: 255 200 50;
  --error: 255 100 100;
  --info: 100 180 255;

  /* Shadows - deeper for 3D effect */
  --shadow-sm: 0 2px 8px 0 rgb(0 0 0 / 0.5);
  --shadow: 0 4px 12px 0 rgb(0 0 0 / 0.6), 0 2px 4px 0 rgb(0 0 0 / 0.4);
  --shadow-md: 0 8px 20px -1px rgb(0 0 0 / 0.7), 0 4px 8px -2px rgb(0 0 0 / 0.5);
  --shadow-lg: 0 20px 40px -3px rgb(0 0 0 / 0.8), 0 8px 16px -4px rgb(0 0 0 / 0.6);
}

/* ===========================
   Base Styles
   =========================== */

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

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

body {
  font-family: "Rubik", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background-color: rgb(var(--background));
  color: rgb(var(--foreground));
  line-height: 1.5;
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
}

/* Ensure all elements inherit Rubik font */
button, input, textarea, select, optgroup {
  font-family: inherit;
  font-size: inherit;
  line-height: inherit;
}

/* ===========================
   Typography
   =========================== */

h1, h2, h3, h4, h5, h6 {
  font-weight: 600;
  line-height: 1.2;
  margin-bottom: 0.5rem;
}

h1 { font-size: 2.25rem; }
h2 { font-size: 1.875rem; }
h3 { font-size: 1.5rem; }
h4 { font-size: 1.25rem; }
h5 { font-size: 1.125rem; }
h6 { font-size: 1rem; }

p {
  margin-bottom: 1rem;
}

/* ===========================
   Button Components
   =========================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.25rem;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  text-decoration: none;
  outline: none;
}

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

.btn-primary {
  background-color: rgb(var(--primary));
  color: rgb(var(--primary-foreground));
  box-shadow: 0 0 20px rgba(var(--primary), 0.3);
  font-weight: 600;
  letter-spacing: 0.3px;
}

.btn-primary:hover:not(:disabled) {
  box-shadow: 0 0 30px rgba(var(--primary), 0.5);
  transform: translateY(-2px);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: 0 0 20px rgba(var(--primary), 0.3);
}

.btn-secondary {
  background-color: rgb(var(--secondary));
  color: rgb(var(--secondary-foreground));
  border: 1px solid rgb(var(--border));
}

.btn-secondary:hover:not(:disabled) {
  background-color: rgb(var(--muted));
}

.btn-ghost {
  background-color: transparent;
  color: rgb(var(--foreground));
}

.btn-ghost:hover:not(:disabled) {
  background-color: rgb(var(--secondary));
}

.btn-destructive {
  background-color: rgb(var(--error));
  color: white;
}

.btn-destructive:hover:not(:disabled) {
  opacity: 0.9;
}

/* ===========================
   Card Component
   =========================== */

.card {
  background-color: rgb(var(--card));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  transition: var(--transition);
  backdrop-filter: blur(10px);
}

.card-hover:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-4px);
  border-color: rgb(var(--primary) / 0.5);
}

.card-header {
  margin-bottom: 1rem;
}

.card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.card-description {
  color: rgb(var(--muted-foreground));
  font-size: 0.875rem;
}

.card-content {
  margin-bottom: 1rem;
}

.card-footer {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

/* ===========================
   Input Components
   =========================== */

.input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  background-color: rgb(var(--background));
  color: rgb(var(--foreground));
  border: 1px solid rgb(var(--input));
  border-radius: var(--radius);
  outline: none;
  transition: var(--transition);
}

.input:focus {
  border-color: rgb(var(--ring));
  box-shadow: 0 0 0 3px rgba(var(--ring), 0.1);
}

.input::placeholder {
  color: rgb(var(--muted-foreground));
}

.label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  margin-bottom: 0.5rem;
  color: rgb(var(--foreground));
}

/* ===========================
   Badge Component
   =========================== */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  font-weight: 500;
  border-radius: 9999px;
  white-space: nowrap;
}

.badge-success {
  background-color: rgba(var(--success), 0.1);
  color: rgb(var(--success));
  border: 1px solid rgba(var(--success), 0.2);
}

.badge-warning {
  background-color: rgba(var(--warning), 0.1);
  color: rgb(var(--warning));
  border: 1px solid rgba(var(--warning), 0.2);
}

.badge-error {
  background-color: rgba(var(--error), 0.1);
  color: rgb(var(--error));
  border: 1px solid rgba(var(--error), 0.2);
}

.badge-info {
  background-color: rgba(var(--info), 0.1);
  color: rgb(var(--info));
  border: 1px solid rgba(var(--info), 0.2);
}

.badge-secondary {
  background-color: rgb(var(--secondary));
  color: rgb(var(--secondary-foreground));
  border: 1px solid rgb(var(--border));
}

/* ===========================
   Theme Switcher
   =========================== */

.theme-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem;
  background-color: rgb(var(--secondary));
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid rgb(var(--border));
}

.theme-switcher:hover {
  background-color: rgb(var(--muted));
}

.theme-icon {
  width: 1.25rem;
  height: 1.25rem;
  color: rgb(var(--foreground));
  transition: var(--transition);
}

/* ===========================
   Toast Notifications
   =========================== */

.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 24rem;
}

.toast {
  background-color: rgb(var(--card));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  animation: slideIn 0.3s ease-out;
}

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

.toast-icon {
  width: 1.25rem;
  height: 1.25rem;
  flex-shrink: 0;
}

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.25rem;
}

.toast-description {
  font-size: 0.875rem;
  color: rgb(var(--muted-foreground));
}

.toast-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgb(var(--muted-foreground));
  padding: 0;
  width: 1rem;
  height: 1rem;
  flex-shrink: 0;
}

.toast-close:hover {
  color: rgb(var(--foreground));
}

/* ===========================
   Modal Component
   =========================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: fadeIn 0.2s ease-out;
}

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

.modal {
  background-color: rgb(var(--card));
  border: 1px solid rgb(var(--border));
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  max-width: 32rem;
  width: 100%;
  animation: scaleIn 0.2s ease-out;
}

@keyframes scaleIn {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgb(var(--border));
}

.modal-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.modal-body {
  padding: 1.5rem;
}

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

/* ===========================
   Spinner/Loading
   =========================== */

.spinner {
  border: 2px solid rgb(var(--muted));
  border-top-color: rgb(var(--primary));
  border-radius: 50%;
  width: 1.25rem;
  height: 1.25rem;
  animation: spin 0.6s linear infinite;
}

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

.spinner-lg {
  width: 2rem;
  height: 2rem;
  border-width: 3px;
}

/* ===========================
   Drag and Drop Upload Zone
   =========================== */

.upload-zone {
  border: 2px dashed rgb(var(--border));
  border-radius: var(--radius-lg);
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  background-color: rgb(var(--secondary));
}

.upload-zone:hover,
.upload-zone.drag-over {
  border-color: rgb(var(--primary));
  background-color: rgba(var(--primary), 0.05);
}

.upload-zone-icon {
  width: 3rem;
  height: 3rem;
  margin: 0 auto 1rem;
  color: rgb(var(--muted-foreground));
}

.upload-zone-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: rgb(var(--foreground));
}

.upload-zone-description {
  font-size: 0.875rem;
  color: rgb(var(--muted-foreground));
}

/* ===========================
   Progress Bar
   =========================== */

.progress {
  width: 100%;
  height: 0.5rem;
  background-color: rgb(var(--secondary));
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background-color: rgb(var(--primary));
  border-radius: 9999px;
  transition: width 0.3s ease;
}

/* ===========================
   Layout Components
   =========================== */

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
}

.container-sm {
  max-width: 640px;
}

.container-lg {
  max-width: 1400px;
}

.header {
  background-color: rgb(var(--card));
  border-bottom: 1px solid rgb(var(--border));
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  background-color: rgba(var(--card), 0.95);
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: rgb(var(--foreground));
  margin: 0;
}

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

/* ===========================
   Grid System
   =========================== */

.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-1 { grid-template-columns: repeat(1, 1fr); }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }

@media (max-width: 768px) {
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr;
  }
}

/* ===========================
   Utility Classes
   =========================== */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-center { justify-content: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }

.p-4 { padding: 1rem; }
.p-6 { padding: 1.5rem; }
.p-8 { padding: 2rem; }

.text-sm { font-size: 0.875rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }

.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }

.text-muted { color: rgb(var(--muted-foreground)); }
.text-center { text-align: center; }

.rounded { border-radius: var(--radius); }
.rounded-lg { border-radius: var(--radius-lg); }
.rounded-full { border-radius: 9999px; }

.shadow { box-shadow: var(--shadow); }
.shadow-md { box-shadow: var(--shadow-md); }
.shadow-lg { box-shadow: var(--shadow-lg); }

.hidden { display: none; }
.block { display: block; }

.w-full { width: 100%; }
.h-full { height: 100%; }

.cursor-pointer { cursor: pointer; }

.transition { transition: var(--transition); }

/* ===========================
   Page-Specific Styles
   =========================== */

/* Login Page */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}

.login-background {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgb(5 5 10) 0%, rgb(15 15 30) 50%, rgb(25 15 40) 100%);
  z-index: -1;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

/* Dashboard */
.dashboard-container {
  min-height: 100vh;
  padding-bottom: 2rem;
}

.dashboard-main {
  padding: 2rem 0;
}

.search-bar {
  position: relative;
  margin-bottom: 1.5rem;
}

.search-icon {
  position: absolute;
  left: 0.875rem;
  top: 50%;
  transform: translateY(-50%);
  width: 1.125rem;
  height: 1.125rem;
  color: rgb(var(--muted-foreground));
  pointer-events: none;
}

.search-input {
  padding-left: 2.75rem;
}

.paper-card {
  position: relative;
  overflow: hidden;
}

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

.paper-info {
  flex: 1;
  min-width: 0;
}

.paper-filename {
  font-weight: 600;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  word-break: break-word;
}

.paper-meta {
  font-size: 0.8125rem;
  color: rgb(var(--muted-foreground));
}

.paper-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.icon-btn {
  padding: 0.5rem;
  background: none;
  border: none;
  cursor: pointer;
  color: rgb(var(--muted-foreground));
  border-radius: var(--radius);
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-btn:hover {
  background-color: rgb(var(--secondary));
  color: rgb(var(--foreground));
}

.icon-btn svg {
  width: 1.125rem;
  height: 1.125rem;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 4rem 2rem;
}

.empty-state-icon {
  width: 4rem;
  height: 4rem;
  margin: 0 auto 1rem;
  color: rgb(var(--muted-foreground));
  opacity: 0.5;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state-description {
  color: rgb(var(--muted-foreground));
  font-size: 0.9375rem;
}

/* Animations */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

.animate-pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* ===========================
   CTA Hover Button
   =========================== */

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.75rem;
  background: transparent;
  color: black;
  border: none;
  border-radius: 50px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  position: relative;
  overflow: visible;
  outline: none;
  transition: color 0.3s ease;
}

.cta::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50px;
  background: rgba(173, 216, 230, 0.3);
  transform: translate(-50%, -50%);
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), height 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  z-index: -1;
}

.cta:hover::before {
  width: 130%;
  height: 150%;
}

.cta:hover {
  color: #972121;
}

.cta svg {
  width: 15px;
  height: 10px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.cta:hover svg {
  transform: translateX(4px);
  stroke: #972121;
}

/* Responsive */
@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  .header-title {
    font-size: 1.125rem;
  }

  .upload-zone {
    padding: 2rem 1rem;
  }

  .toast-container {
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    max-width: none;
  }
}
