/* Local Inter font */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Inter-Bold.woff2') format('woff2');
}

:root {
  /* Цветовая палитра из макета */
  --bg-color: #fdfaf6; /* Легкий бежевый фон */
  --white: #ffffff;
  --text-main: #333333;
  --text-muted: #888888;
  --primary: #9b51e0; /* Фиолетовый акцентный (кнопки, активные вкладки) */
  --primary-hover: #803fc2;
  --border-color: #eeeeee;

  /* Статусы */
  --status-available-bg: #e6e0f8;
  --status-available-text: #6140b9;
  --status-issued-bg: #e8f5e9;
  --status-issued-text: #2e7d32;
  --status-overdue-bg: #ffebee;
  --status-overdue-text: #c62828;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --radius-pill: 50px;

  --font-family:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
    Arial, sans-serif;
}

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

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

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

/* Header Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 0;
  margin-bottom: 20px;
}

.navbar .logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar .logo img {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--primary);
  padding: 6px;
}

.navbar .logo-text {
  display: flex;
  flex-direction: column;
}

.navbar .logo-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.1;
}

.navbar .logo-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Кнопки и бейджи */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-pill);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  text-decoration: none;
}

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

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

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-outline:hover {
  background-color: #f5f5f5;
}

.btn-text {
  background-color: transparent;
  color: var(--text-muted);
  padding: 8px 12px;
}

.btn-text:hover {
  color: var(--text-main);
}

.badge {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.75rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}

.badge-overdue {
  background-color: var(--status-overdue-bg);
  color: var(--status-overdue-text);
}
.badge-role {
  background-color: #f3f3f3;
  color: var(--text-main);
}
.badge-role .avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #e0e0e0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  color: #666;
}

.badge-available {
  background-color: var(--status-available-bg);
  color: var(--status-available-text);
}

.badge-issued {
  background-color: var(--status-issued-bg);
  color: var(--status-issued-text);
}

/* Tabs / Menu */
.tabs-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tab {
  padding: 10px 16px;
  border-radius: var(--radius-pill);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
}

.tab:hover {
  background-color: rgba(0, 0, 0, 0.03);
}

.tab.active {
  background-color: #f3ebfa;
  color: var(--primary);
}

/* Search Bar */
.search-bar {
  width: 100%;
  position: relative;
  margin-bottom: 30px;
}

.search-input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background-color: var(--white);
  font-size: 1rem;
  color: var(--text-main);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: box-shadow 0.2s;
}

.search-input:focus {
  box-shadow: var(--shadow-md);
  border-color: #d0b3f0;
}

.search-icon {
  position: absolute;
  left: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

/* Grid layout for Cards */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 24px;
  padding-bottom: 40px;
}

/* Book Card */
.book-card {
  background-color: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 16px;
  cursor: pointer;
  transition:
    transform 0.2s,
    box-shadow 0.2s;
  border: 1px solid transparent;
}

.book-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.book-icon {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  object-fit: cover;
  background-color: #f5f5f5;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.book-author {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.genre-tag {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 4px;
  background-color: #f5f5f5;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}

/* Модальные окна */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--white);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  padding: 32px;
  box-shadow: var(--shadow-lg);
  position: relative;
  transform: translateY(20px);
  transition: transform 0.3s;
}

.modal-overlay.active .modal-content {
  transform: translateY(0);
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: var(--text-muted);
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--text-main);
}

.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-main);
}

.form-control {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  font-size: 1rem;
  transition: border-color 0.2s;
  font-family: inherit;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
}

.modal-content .btn-primary {
  width: 100%;
  padding: 14px;
  margin-top: 10px;
}

.modal-footer {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 24px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.modal-footer a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
}

/* Helper Classes */
.hidden {
  display: none !important;
}
.d-flex {
  display: flex;
}
.align-center {
  align-items: center;
}
.justify-between {
  justify-content: space-between;
}
.gap-2 {
  gap: 8px;
}
.gap-3 {
  gap: 12px;
}
.mt-4 {
  margin-top: 24px;
}
.mb-2 {
  margin-bottom: 8px;
}

/* Dashboard Cards (для администратора / управления) */
.stat-cards {
  display: flex;
  gap: 24px;
  margin-bottom: 32px;
}
.stat-card {
  flex: 1;
  background: var(--white);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.stat-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
}
.stat-value.purple {
  color: var(--primary);
}
.stat-value.blue {
  color: #2196f3;
}
.stat-value.red {
  color: #f44336;
}

/* List items for readers */
.list-container {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--border-color);
}
.list-item:last-child {
  border-bottom: none;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 16px;
}
.user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #f0e6fa;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: var(--primary);
}
.user-name {
  font-weight: 600;
}
.user-ticket {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.book-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: #fdfdfd;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-top: 12px;
}
.book-row-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.book-row-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.action-buttons {
  display: flex;
  gap: 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .tabs-container {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  .stat-cards {
    flex-direction: column;
  }
  .navbar {
    flex-wrap: wrap;
    gap: 12px;
  }
  .nav-right {
    width: 100%;
    justify-content: space-between;
  }
}
