:root {
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-light: #eef2ff;
  --success: #10b981;
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-900: #111827;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  background-color: #f8fafc;
  color: var(--gray-900);
  line-height: 1.5;
  padding: 2rem 1rem;
}

.container {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: white;
  padding: 1.5rem 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  flex-wrap: wrap;
  gap: 1rem;
}

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

.brand-icon {
  width: 42px;
  height: 42px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 9px;
  border-radius: 12px;
}

.brand h1 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--gray-900);
}

.brand p {
  font-size: 0.875rem;
  color: var(--gray-600);
}

.user-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: #ecfdf5;
  color: #047857;
  padding: 0.45rem 0.9rem;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid #a7f3d0;
}

/* Card */
.card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  padding: 1.75rem;
}

/* Auth Banner */
.auth-required-banner {
  text-align: center;
  padding: 4rem 2rem;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
}

.banner-icon {
  width: 56px;
  height: 56px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 12px;
  border-radius: 50%;
  margin-bottom: 1rem;
}

.auth-required-banner h2 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.auth-required-banner p {
  color: var(--gray-600);
  max-width: 500px;
  margin: 0 auto 1.5rem auto;
}

.banner-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Drop Zone */
.drop-zone {
  border: 2px dashed var(--gray-300);
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
  background: var(--gray-50);
  transition: all 0.2s ease-in-out;
  cursor: pointer;
}

.drop-zone.dragover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.upload-icon {
  width: 52px;
  height: 52px;
  color: var(--primary);
  margin-bottom: 1rem;
}

.drop-zone h3 {
  font-size: 1.15rem;
  margin-bottom: 0.4rem;
  color: var(--gray-900);
}

.drop-zone p {
  color: var(--gray-600);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.1s;
  text-decoration: none;
}

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

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-secondary {
  background: var(--gray-100);
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-200);
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.825rem;
}

.btn-block {
  width: 100%;
}

.btn-icon {
  padding: 0.45rem;
  border-radius: 6px;
}

.btn-danger-alt {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-danger-alt:hover {
  background: var(--danger);
  color: white;
}

/* Progress Bar & Stats Bar */
.progress-container {
  margin-top: 1.5rem;
  background: var(--gray-50);
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}

.progress-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--gray-700);
}

.progress-bar-bg {
  width: 100%;
  height: 10px;
  background: var(--gray-200);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.2s ease;
}

.upload-stats-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--gray-200);
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-600);
}

.stat-item svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.action-stat {
  margin-left: auto;
}

/* File List Card */
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.card-title h2 {
  font-size: 1.2rem;
  font-weight: 700;
}

.badge {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.65rem;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--gray-50);
  border: 1px solid var(--gray-300);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.875rem;
  width: 180px;
}

/* Table */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

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

.file-table th {
  background: var(--gray-50);
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gray-600);
  border-bottom: 1px solid var(--gray-200);
}

.file-table td {
  padding: 1rem;
  border-bottom: 1px solid var(--gray-200);
  font-size: 0.9rem;
  vertical-align: middle;
}

.file-table tr:last-child td {
  border-bottom: none;
}

.file-name-cell {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-weight: 600;
  color: var(--gray-900);
  max-width: 320px;
  word-break: break-all;
}

.file-icon {
  width: 20px;
  height: 20px;
  color: var(--primary);
  flex-shrink: 0;
}

.action-buttons {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
}

.text-center {
  text-align: center;
}

.empty-state {
  padding: 3rem 1rem !important;
  color: var(--gray-600);
}

.empty-icon {
  width: 48px;
  height: 48px;
  color: var(--gray-300);
  margin-bottom: 0.5rem;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(17, 24, 39, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 1rem;
}

.modal-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 2.25rem;
  width: 100%;
  max-width: 420px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1.25rem;
  background: transparent;
  border: none;
  font-size: 1.5rem;
  color: var(--gray-600);
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  background: var(--gray-100);
  padding: 4px;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

.tab-btn {
  flex: 1;
  padding: 0.5rem;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--gray-600);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active {
  background: white;
  color: var(--gray-900);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.auth-form h2 {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.form-desc {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 1.25rem;
}

.form-group {
  margin-bottom: 1.25rem;
  text-align: left;
}

.form-group label {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 0.4rem;
}

.form-group input {
  width: 100%;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--gray-300);
  border-radius: 8px;
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.15);
}

.field-hint {
  font-size: 0.75rem;
  color: var(--gray-600);
  margin-top: 0.25rem;
  display: block;
}

.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 0.65rem 0.9rem;
  border-radius: 8px;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--gray-900);
  color: white;
  padding: 0.85rem 1.4rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
  pointer-events: none;
  z-index: 3000;
}

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

@media (max-width: 640px) {
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .search-box input {
    width: 100%;
  }
  .upload-stats-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .action-stat {
    margin-left: 0;
    width: 100%;
  }
  .action-stat button {
    width: 100%;
  }
}
