/* Admin Portal Styles */

/* Layout */
.admin-container {
  display: flex;
  min-height: 100vh;
  padding-top: 80px; /* Account for fixed navbar */
}

.admin-sidebar {
  width: 280px;
  background: #1e293b;
  color: white;
  position: fixed;
  left: 0;
  top: 80px;
  height: calc(100vh - 80px);
  overflow-y: auto;
  z-index: 100;
  transition: width 0.25s ease;
}

.admin-main {
  flex: 1;
  margin-left: 280px;
  background: #f8fafc;
  min-height: calc(100vh - 80px);
  transition: margin-left 0.25s ease;
}

/* Sidebar Navigation */
.sidebar-nav {
  padding: 1rem 0;
}

.nav-item {
  display: flex;
  align-items: center;
  padding: 0.75rem 1.5rem;
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.3s ease;
  position: relative;
  gap: 0.75rem;
}

.nav-item:hover {
  background: #334155;
  color: white;
}

.nav-item.active {
  background: #2563eb;
  color: white;
}

.nav-item i {
  width: 20px;
  text-align: center;
}

.nav-item span {
  flex: 1;
}
.admin-sidebar.collapsed { width: 72px; }
.admin-main.collapsed { margin-left: 72px; }

.admin-sidebar.collapsed .nav-item span { display: none; }
.admin-sidebar.collapsed .badge { display: none; }
.admin-sidebar.collapsed .nav-item { justify-content: center; }
.admin-sidebar.collapsed .nav-item i { width: auto; }


.badge {
  background: #ef4444;
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  min-width: 20px;
  text-align: center;
}

.badge.pending-count {
  background: #f59e0b;
}

.badge.live-count {
  background: #10b981;
}

.badge.dispute-count {
  background: #ef4444;
}

/* Main Content Sections */
.admin-section {
  display: none;
  padding: 2rem;
}

.admin-section.active {
  display: block;
}

.section-header {
  margin-bottom: 2rem;
}

.section-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 0.5rem;
}

.section-header p {
  color: #64748b;
  font-size: 1.1rem;
}

/* KPI Cards */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.kpi-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.kpi-card.clickable {
  cursor: pointer;
}

.kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.kpi-icon {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: white;
}

.kpi-icon.pending {
  background: linear-gradient(135deg, #f59e0b, #d97706);
}

.kpi-icon.live {
  background: linear-gradient(135deg, #10b981, #059669);
}

.kpi-icon.pipeline {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.kpi-icon.dispute {
  background: linear-gradient(135deg, #ef4444, #dc2626);
}

.kpi-content {
  flex: 1;
}

.kpi-number {
  font-size: 2rem;
  font-weight: 700;
  color: #1e293b;
  margin: 0;
  line-height: 1;
}

.kpi-label {
  color: #64748b;
  margin: 0.25rem 0 0 0;
  font-size: 0.9rem;
}

/* Quick Actions */
.quick-actions {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.quick-actions h2 {
  margin: 0 0 1rem 0;
  color: #1e293b;
  font-size: 1.25rem;
}

.action-buttons {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Button variants used in tables */
.btn-success {
  background: #10b981;
  color: #fff;
}
.btn-success:hover { background: #059669; }

.btn-danger {
  background: #ef4444;
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-warning {
  background: #f59e0b;
  color: #fff;
}
.btn-warning:hover { background: #d97706; }

/* Filters Bar */
.filters-bar {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: end;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.filter-group label {
  font-weight: 500;
  color: #374151;
  font-size: 0.9rem;
}

.filter-select,
.filter-input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  min-width: 150px;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Bulk Actions */
.bulk-actions {
  background: white;
  padding: 1rem 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 1.5rem;
}

.bulk-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.checkbox-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 500;
}

.checkbox-wrapper input[type="checkbox"] {
  display: none;
}

.checkmark {
  width: 18px;
  height: 18px;
  border: 2px solid #d1d5db;
  border-radius: 4px;
  position: relative;
  transition: all 0.2s ease;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark {
  background: #2563eb;
  border-color: #2563eb;
}

.checkbox-wrapper input[type="checkbox"]:checked + .checkmark::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 12px;
  font-weight: bold;
}

/* Table Styles */
.table-container {
  background: white;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  overflow-x: auto;
  margin-bottom: 1.5rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
}

.admin-table th {
  background: #f8fafc;
  padding: 1rem;
  text-align: left;
  font-weight: 600;
  color: #374151;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}

.admin-table td {
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: #374151;
  font-size: 0.9rem;
}

.admin-table tbody tr:hover {
  background: #f8fafc;
}

.admin-table tbody tr:last-child td {
  border-bottom: none;
}

/* Status Pills */
.status-pill {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.status-pill.pending {
  background: #fef3c7;
  color: #92400e;
}

.status-pill.approved {
  background: #d1fae5;
  color: #065f46;
}

.status-pill.active {
  background: #dbeafe;
  color: #1e40af;
}

.status-pill.rejected {
  background: #fee2e2;
  color: #991b1b;
}

.status-pill.withdrawn {
  background: #f3f4f6;
  color: #374151;
}

/* Pipeline Tabs */
.pipeline-tabs {
  display: flex;
  background: white;
  border-radius: 12px 12px 0 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  margin-bottom: 0;
  overflow-x: auto;
}

.tab-btn {
  flex: 1;
  padding: 1rem;
  border: none;
  background: transparent;
  color: #64748b;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  min-width: 120px;
  white-space: nowrap;
}

.tab-btn:hover {
  background: #f8fafc;
  color: #374151;
}

.tab-btn.active {
  background: #2563eb;
  color: white;
}

.tab-btn i {
  font-size: 1.25rem;
}

.tab-count {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 0.25rem 0.5rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.tab-btn:not(.active) .tab-count {
  background: #e2e8f0;
  color: #64748b;
}

/* Settings Grid */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.5rem;
}

.settings-card {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-card h3 {
  margin: 0 0 0.5rem 0;
  color: #1e293b;
  font-size: 1.25rem;
}

.settings-card p {
  color: #64748b;
  margin: 0 0 1rem 0;
  line-height: 1.5;
}

/* Email toggle switch */
.switch { position: relative; display: inline-block; width: 46px; height: 26px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #e5e7eb; transition: .2s; border-radius: 9999px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 3px; bottom: 3px; background-color: white; transition: .2s; border-radius: 50%; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background-color: #2563eb; }
.switch input:checked + .slider:before { transform: translateX(20px); }

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
}

.modal-content {
  background-color: white;
  margin: 5% auto;
  padding: 0;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

/* Photo lightbox */
.photo-lightbox .photo-lightbox-content {
  position: relative;
  margin: 2% auto;
  width: 90vw;
  max-width: 1000px;
  background: #111827;
  border-radius: 12px;
  padding: 1rem 3rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.photo-lightbox img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
}

.photo-lightbox .nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: none;
  border-radius: 9999px;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.photo-lightbox .nav.prev { left: 12px; }
.photo-lightbox .nav.next { right: 12px; }

.photo-lightbox .close {
  position: absolute;
  top: 8px;
  right: 14px;
  color: #e5e7eb;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}

.photo-thumbnail {
  width: 100%;
  height: 96px;
  object-fit: cover;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.photo-thumbnail:hover { transform: scale(1.02); }

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: #1e293b;
  font-size: 1.5rem;
}

.close {
  color: #9ca3af;
  font-size: 1.5rem;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
}

.close:hover {
  color: #374151;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1.5rem;
  border-top: 1px solid #e5e7eb;
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

/* Form Elements */
.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #374151;
}

.form-select,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin-top: 1rem;
}

.pagination button {
  padding: 0.5rem 0.75rem;
  border: 1px solid #d1d5db;
  background: white;
  color: #374151;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pagination button:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #9ca3af;
}

.pagination button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pagination button.active {
  background: #2563eb;
  color: white;
  border-color: #2563eb;
}

/* Responsive Design */
@media (max-width: 1024px) {
  .admin-sidebar {
    width: 240px;
  }
  
  .admin-main {
    margin-left: 240px;
  }
  
  .kpi-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
}

@media (max-width: 768px) {
  .admin-sidebar {
    transform: translateX(-100%);
    transition: transform 0.3s ease;
  }
  
  .admin-sidebar.open {
    transform: translateX(0);
  }
  
  .admin-main {
    margin-left: 0;
  }
  
  .admin-section {
    padding: 1rem;
  }
  
  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .filter-select,
  .filter-input {
    min-width: auto;
  }
  
  .bulk-controls {
    flex-direction: column;
    align-items: stretch;
  }
  
  .action-buttons {
    flex-direction: column;
  }
  
  .pipeline-tabs {
    flex-wrap: wrap;
  }
  
  .tab-btn {
    min-width: 100px;
  }
  
  .modal-content {
    width: 95%;
    margin: 10% auto;
  }
  
  .modal-footer {
    flex-direction: column;
  }
}

@media (max-width: 480px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  
  .kpi-card {
    flex-direction: column;
    text-align: center;
  }
  
  .admin-table {
    font-size: 0.8rem;
  }
  
  .admin-table th,
  .admin-table td {
    padding: 0.75rem 0.5rem;
  }
}

/* Book Management Styles */
.modal-wide .modal-content {
  max-width: 900px;
  width: 90%;
}

.form-grid {
  display: grid;
  gap: 2rem;
}

.form-section {
  background: #f8fafc;
  padding: 1.5rem;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.form-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  color: #1e293b;
  border-bottom: 2px solid #2563eb;
  padding-bottom: 0.5rem;
}

.form-section h4 {
  margin: 1.5rem 0 0.75rem 0;
  font-size: 1rem;
  color: #475569;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #334155;
  font-size: 0.9rem;
}

.form-input,
.form-textarea {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s, box-shadow 0.2s;
  background: white;
}

.form-input:focus,
.form-textarea:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-textarea {
  resize: vertical;
  font-family: inherit;
}

.detail-section {
  margin-bottom: 1.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid #e2e8f0;
}

.detail-section:last-child {
  border-bottom: none;
}

.detail-section h3 {
  margin: 0 0 1rem 0;
  font-size: 1.125rem;
  color: #1e293b;
  border-bottom: 2px solid #2563eb;
  padding-bottom: 0.5rem;
}

.detail-section p {
  margin: 0.5rem 0;
  line-height: 1.6;
}

.detail-section strong {
  color: #475569;
  font-weight: 600;
  min-width: 150px;
  display: inline-block;
}

@media (max-width: 768px) {
  .modal-wide .modal-content {
    width: 95%;
    max-width: none;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-section {
    padding: 1rem;
  }
}

