:root {
  --bg: ##0f172a;
  --text: #1f2937;
  --card: #ffffff;
  --border: #e5e7eb;
  --primary: #3b82f6;
  --accent: #8b5cf6;
  --success: #10b981;
  --radius: 12px;
  --shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

body.dark {
  --bg: #0f172a;
  --text: #f1f5f9;
  --card: #1e2937;
  --border: #334155;
  --primary: #60a5fa;
}

* {
  box-sizing: border-box;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  transition: background 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

h1 {
  font-size: 2.25rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 2rem;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.library-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

input[type="file"] {
  padding: 10px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--card);
  cursor: pointer;
  transition: all 0.3s;
}

input[type="file"]:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
}

input[type="text"] {
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  width: 320px;
  transition: all 0.3s;
}

input[type="text"]:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

th, td {
  padding: 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  background: #f8fafc;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}

body.dark th {
  background: #334155;
}

th:nth-child(4), td:nth-child(4) {
  text-align: right;
}

th:nth-child(3), td:nth-child(3) {
  text-align: right;
}

th:hover {
  background: #e2e8f0;
}

body.dark th:hover {
  background: #475569;
}

a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

a:hover {
  color: #2563eb;
}

.btn {
  padding: 5px 10px;
  border: none;
  border-radius: 9999px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
}

.btn-danger {
  background: #ef4444;
  color: white;
  display: none;
}

.logged-in .btn-danger {
  display: inline-block;
}

.pagination button {
  padding: 8px 16px;
  margin: 0 4px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 9999px;
}

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

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  backdrop-filter: blur(12px);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  max-width: 720px;
  width: 90%;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.4);
  border: 1px solid rgba(255,255,255,0.3);
}

body.dark .modal-content {
  background: rgba(30, 41, 59, 0.95);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

@keyframes popIn {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.close {
  font-size: 32px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.2s;
}

.close:hover {
  background: rgba(0,0,0,0.1);
}


textarea {
  width: 100%;
  min-height: 180px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  resize: vertical;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.5;
}

.modal-body {
  padding: 24px;
}

.modal-body {
  padding: 24px;
  max-height: 70vh;
  overflow-y: auto;
}




/* Stars */
.stars {
  font-size: 36px;
  letter-spacing: 4px;
}

.star {
  transition: transform 0.2s;
}

.star:hover {
  transform: scale(1.2);
}

/* Other improvements */
input, textarea, button {
  font-family: inherit;
}

th.sort-asc::after { 
  content: " ↑"; 
  color: #3b82f6; 
  font-weight: bold; 
}

th.sort-desc::after { 
  content: " ↓"; 
  color: #3b82f6; 
  font-weight: bold; 
}
