/* dashboard.css - Styles for user and admin dashboards */

/* User info in sidebar */
.user-info {
  display: flex;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #34495e;
  margin-bottom: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  background-color: #3498db;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 10px;
  color: white;
}

.avatar.admin {
  background-color: #e74c3c;
}

.avatar i {
  font-size: 18px;
}

.user-details h3 {
  font-size: 16px;
  font-weight: 600;
  color: #ecf0f1;
  margin: 0;
}

.user-details p {
  font-size: 12px;
  color: #bdc3c7;
  margin: 0;
}

/* Dashboard header */
.dashboard-header {
  margin-bottom: 25px;
}

.dashboard-header h1 {
  font-size: 28px;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 5px;
}

.dashboard-header p {
  color: #7f8c8d;
  font-size: 16px;
}

/* Stats cards */
.stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 25px;
}

.stat-card {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  align-items: center;
}

.stat-icon {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background-color: #f0f7ff;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-right: 15px;
}

.stat-icon i {
  font-size: 24px;
  color: #3498db;
}

.stat-info h3 {
  font-size: 16px;
  font-weight: 600;
  color: #7f8c8d;
  margin: 0 0 5px 0;
}

.stat-info p {
  font-size: 24px;
  font-weight: 700;
  color: #2c3e50;
  margin: 0;
}

/* Dashboard grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 20px;
}

.dashboard-card {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.dashboard-card.full-width {
  grid-column: 1 / -1;
}

.card-header {
  padding: 15px 20px;
  background-color: #f8f9fa;
  border-bottom: 1px solid #eee;
}

.card-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0;
}

.card-body {
  padding: 20px;
}

/* Profile info */
.profile-info p {
  margin-bottom: 10px;
  color: #2c3e50;
}

.profile-info strong {
  font-weight: 600;
  margin-right: 5px;
}

/* Recent books */
.recent-books-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.recent-books-list li {
  margin-bottom: 15px;
}

.recent-books-list li:last-child {
  margin-bottom: 0;
}

.recent-book {
  display: flex;
  align-items: center;
}

.recent-book-cover {
  width: 50px;
  height: 70px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 15px;
}

.recent-book-info h4 {
  font-size: 16px;
  font-weight: 600;
  color: #2c3e50;
  margin: 0 0 5px 0;
}

.recent-book-info p {
  font-size: 14px;
  color: #7f8c8d;
  margin: 0 0 5px 0;
}

.recent-book-info small {
  font-size: 12px;
  color: #95a5a6;
}

/* Charts */
.chart-container {
  width: 100%;
  height: 100%;
  min-height: 250px;
}

/* Bar chart */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.bar-container {
  display: flex;
  align-items: center;
}

.bar-label {
  width: 100px;
  font-size: 14px;
  font-weight: 500;
  color: #2c3e50;
  margin-right: 10px;
}

.bar-wrapper {
  flex: 1;
  height: 25px;
  background-color: #f1f1f1;
  border-radius: 4px;
  position: relative;
}

.bar {
  height: 100%;
  background-color: #3498db;
  border-radius: 4px;
  transition: width 0.5s ease-out;
}

.bar-value {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  font-weight: 600;
  color: #2c3e50;
}

/* Pie chart */
.pie-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.pie-container {
  width: 200px;
  height: 200px;
  position: relative;
  border-radius: 50%;
  overflow: hidden;
  background-color: #f1f1f1;
}

.pie-element {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  transform-origin: 50% 50%;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  font-size: 14px;
  color: #2c3e50;
}

.color-box {
  width: 15px;
  height: 15px;
  margin-right: 5px;
  border-radius: 3px;
}

/* Tabs */
.admin-tabs {
  display: flex;
  margin-bottom: 20px;
  border-bottom: 1px solid #ddd;
}

/* Dashboard recommendations */
.dashboard-rec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.dashboard-rec-card {
  background-color: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  transition: transform 0.2s, box-shadow 0.2s;
}

.dashboard-rec-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.rec-book-cover {
  height: 180px;
  overflow: hidden;
}

.rec-book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.rec-book-info {
  padding: 15px;
}

.rec-book-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #2c3e50;
}

.rec-book-author {
  font-size: 14px;
  color: #7f8c8d;
  margin-bottom: 10px;
}

.rec-book-link {
  display: inline-block;
  padding: 5px 10px;
  background-color: #3498db;
  color: white;
  border-radius: 4px;
  text-decoration: none;
  font-size: 12px;
  transition: background-color 0.2s;
}

.rec-book-link:hover {
  background-color: #2980b9;
}

/* Profile actions */
.profile-actions {
  display: flex;
  gap: 10px;
}

/* Toggle switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 50px;
  height: 24px;
}

.toggle-input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-label {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.4s;
  border-radius: 24px;
}

.toggle-label:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}

.toggle-input:checked + .toggle-label {
  background-color: #3498db;
}

.toggle-input:checked + .toggle-label:before {
  transform: translateX(26px);
}

/* Settings sections */
.settings-section {
  margin-bottom: 25px;
  padding-bottom: 20px;
  border-bottom: 1px solid #eee;
}

.settings-section h3 {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 15px;
  color: #2c3e50;
}

.settings-section:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

/* System status */
.status-item {
  display: flex;
  align-items: center;
  margin-bottom: 15px;
}

.status-label {
  width: 150px;
  font-weight: 500;
  color: #2c3e50;
}

.status-value {
  color: #7f8c8d;
}

.status-value.online {
  color: #2ecc71;
  font-weight: 500;
}

.progress-bar {
  flex: 1;
  height: 8px;
  background-color: #f1f1f1;
  border-radius: 4px;
  margin: 0 10px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background-color: #3498db;
  border-radius: 4px;
}

/* Admin actions */
.admin-actions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 20px;
}

.action-card {
  background-color: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.action-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.action-icon {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background-color: #f0f7ff;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 15px;
}

.action-icon i {
  font-size: 20px;
  color: #3498db;
}

.action-info {
  flex: 1;
}

.action-info h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 5px;
  color: #2c3e50;
}

.action-info p {
  font-size: 14px;
  color: #7f8c8d;
  margin-bottom: 15px;
}

.action-btn,
.tab-btn {
  padding: 8px 12px; /* Larger tap area */
  touch-action: manipulation; /* Prevent double-tap zoom */
}

.action-btn:active,
.tab-btn:active {
  background-color: #e8f4fd; /* Visual feedback for touch */
}

.action-btn {
  display: inline-block;
  padding: 8px 12px;
  background-color: #3498db;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  font-size: 14px;
  transition: background-color 0.2s;
}

.action-btn:hover {
  background-color: #2980b9;
}

@media (max-width: 1024px) and (min-width: 769px) {
  .stats-cards {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .dashboard-grid {
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  }
}

/* Responsive design */
@media (max-width: 768px) {
  .admin-tabs {
    flex-direction: column;
    border-bottom: none;
  }

  .tab-btn {
    width: 100%;
    text-align: left;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin-bottom: 5px;
  }

  .stats-cards {
    gap: 10px;
  }

  .stat-card {
    padding: 10px;
  }

  .stat-icon {
    width: 40px;
    height: 40px;
  }

  .stat-icon i {
    font-size: 16px;
  }

  .stat-info p {
    font-size: 18px;
  }
}
