:root {
  /* Modern color palette */
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --secondary: #64748b;
  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --background: #f8fafc;
  --surface: #ffffff;
  --text: #0f172a;
  --text-light: #64748b;
  --border: #e2e8f0;

  /* Spacing */
  --spacing-xs: 0.25rem;
  --spacing-sm: 0.5rem;
  --spacing-md: 1rem;
  --spacing-lg: 1.5rem;
  --spacing-xl: 2rem;

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

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', system-ui, sans-serif;
}

body {
  background-color: var(--background);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
}

/* Modern Card Styling */
.card {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  transition: box-shadow 0.2s;
  overflow: hidden;
}

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

/* Modern Table Styling */
.table-container {
  background: var(--surface);
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  margin-bottom: var(--spacing-lg);
}

.table {
  width: 100%;
  max-width: 100%;
  margin-bottom: 0;
  background: var(--surface);
  table-layout: fixed;
}

.table th {
  background: var(--primary);
  color: white;
  font-weight: 500;
  text-transform: uppercase;
  font-size: 0.875rem;
  letter-spacing: 0.05em;
  padding: var(--spacing-md);
  border: none;
}

.table th.rounded-start {
  border-top-left-radius: 12px;
}

.table th.rounded-end {
  border-top-right-radius: 12px;
}

.table td {
  padding: 0;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tr:hover {
  background-color: rgba(37, 99, 235, 0.05);
}

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

/* Modern Button Styling */
.btn {
  padding: 0.5rem;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-weight: 500;
  transition: all 0.2s;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.btn i {
  font-size: 1.1rem;
}

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

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

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

/* Modern Form Styling */
.form-group {
  margin-bottom: var(--spacing-md);
}

.form-control {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
  font-size: 1rem;
  background-color: var(--background);
}

.form-control:focus {
  background-color: var(--surface);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Remove the invalid styling */
.form-control:not(:placeholder-shown):invalid,
.form-control:not(:placeholder-shown):invalid:focus {
  border-color: var(--border);
  box-shadow: none;
}

/* Update validation message styling */
.validation-message {
  display: none;
  color: var(--danger);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Only show validation when field has been touched and is invalid */
.form-control.was-touched:invalid + .validation-message {
  display: block;
}

/* Helper text styling */
.form-text {
  font-size: 0.875rem;
  color: var(--text-light);
  margin-top: 0.25rem;
}

/* Navigation */
.navbar {
  background: var(--surface);
  padding: var(--spacing-md);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Responsive Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--spacing-md);
}

/* Like Button Animation */
.like-btn {
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
  transition: background-color 0.2s;
  padding: 0.5rem;
  border-radius: 50%;
  margin: var(--spacing-sm) 0;
}

.like-btn:hover {
  background: rgba(239, 68, 68, 0.1);
}

/* Mobile Optimizations */
@media (max-width: 768px) {
  .container {
    padding: 0 var(--spacing-sm);
  }

  .table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }

  .btn {
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
  }

  .card {
    margin: var(--spacing-sm);
  }

  .row > [class*='col-'] {
    margin-bottom: var(--spacing-lg);
  }

  .table-responsive {
    overflow-x: auto;
  }
}

/* Modern Grid Layout */
.grid {
  display: grid;
  gap: var(--spacing-md);
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
}

/* Fancy Animations */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.animate-in {
  animation: fadeIn 0.3s ease-out;
}

/* Modern Toast Notifications */
.toast {
  position: fixed;
  bottom: var(--spacing-lg);
  right: var(--spacing-lg);
  padding: var(--spacing-md);
  background: var(--surface);
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.3s ease-out;
}

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

/* Add hover tooltips for icon buttons */
[title] {
  position: relative;
}

[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -25px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
}

/* Login/Register specific styles */
.form-control {
  background-color: var(--background);
  border: 1px solid var(--border);
}

.form-control:focus {
  background-color: var(--surface);
}

/* Hide navigation elements on login page */
body.auth-page .navbar {
  display: none;
}

/* Password field with toggle visibility */
.password-field {
  position: relative;
}

.password-toggle {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--secondary);
  cursor: pointer;
}

/* Alert styling */
.alert {
  border: none;
  border-radius: 8px;
  font-size: 0.875rem;
  margin-bottom: 1rem;
}

.alert-danger {
  background-color: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

/* Add these button group styles */
.btn-group {
  display: inline-flex;
  border-radius: 8px;
  overflow: hidden;
  margin: var(--spacing-sm) 0;
}

.btn-group .btn:first-child {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.btn-group .btn:last-child {
  border-top-left-radius: 0;
  border-bottom-left-radius: 0;
}

.btn-group .btn:not(:first-child) {
  margin-left: 1px;
}

/* Update table styles to prevent scrollbar flash */
.table-responsive {
  overflow-x: hidden;
}

/* Update title cell and link styling */
.table td.title-cell {
  padding: 0;
  width: 100%;
  max-width: 0;
}

.title-link {
  display: block;
  padding: var(--spacing-md) var(--spacing-lg);
  color: var(--text);
  text-decoration: none;
  height: 100%;
  white-space: normal;
}

.title-link:hover {
  color: var(--text);
}

/* Update the text span inside the link */
.title-link .text-break {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

/* Define specific column widths */
.table th:first-child {
  width: auto;
}

.table th.like-column {
  width: 100px;
}

.table th.creator-column {
  width: 150px;
}

/* Center columns */
.table td.text-center {
  padding: 0 var(--spacing-md);
}
