/* Admin Panel Modern Styles */

.admin-panel {
  margin: 0;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  background: #f5f5f7;
  color: #1d1d1f;
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Sidebar Styles */
.admin-sidebar {
  width: 280px;
  background: #fff;
  border-left: 1px solid #e5e5e7;
  display: flex;
  flex-direction: column;
  position: fixed;
  right: 0;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 100;
  box-shadow: -2px 0 8px rgba(0, 0, 0, 0.04);
}

.sidebar-header {
  padding: 32px 24px;
  border-bottom: 1px solid #e5e5e7;
  text-align: center;
}

.sidebar-logo {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2e7d6f, #1f4e4a);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 2rem;
}

.sidebar-header h3 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  color: #1d1d1f;
  font-weight: 700;
}

.sidebar-user {
  margin: 0;
  font-size: 0.88rem;
  color: #86868b;
  font-weight: 500;
}

.sidebar-nav {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  color: #1d1d1f;
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.sidebar-link:hover {
  background: #f5f5f7;
}

.sidebar-link.active {
  background: linear-gradient(135deg, #e6f5f1, #fff2d9);
  color: #2e7d6f;
  font-weight: 600;
}

.sidebar-link i {
  font-size: 1.3rem;
  width: 24px;
  text-align: center;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid #e5e5e7;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-link.logout {
  color: #d32f2f;
}

.sidebar-link.logout:hover {
  background: #ffebee;
}

/* Main Content Area */
.admin-main {
  flex: 1;
  margin-right: 280px;
  display: flex;
  flex-direction: column;
}

.admin-header {
  background: #fff;
  padding: 24px 32px;
  border-bottom: 1px solid #e5e5e7;
  position: sticky;
  top: 0;
  z-index: 50;
}

.admin-header h1 {
  margin: 0;
  font-size: 1.8rem;
  color: #1d1d1f;
  font-weight: 700;
}

.admin-content {
  padding: 32px;
  flex: 1;
  position: relative;
}

/* Card Styles for Admin */
.admin-content .card {
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 12px;
  padding: 24px;
  position: relative;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  margin-bottom: 24px;
}

.admin-content .card h2 {
  margin: 0 0 20px;
  font-size: 1.3rem;
  color: #1d1d1f;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Table Styles */
.admin-content .table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 0;
  font-size: 0.92rem;
}

.admin-content .table th {
  background: #f5f5f7;
  color: #1d1d1f;
  font-weight: 600;
  text-align: right;
  padding: 12px 16px;
  border-bottom: 2px solid #e5e5e7;
  font-size: 0.88rem;
}

.admin-content .table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e5e7;
  text-align: right;
}

.admin-content .table tbody tr {
  transition: background 0.15s ease;
}

.admin-content .table tbody tr:hover {
  background: #fafafa;
}

/* Form Styles */
.admin-content label {
  display: block;
  margin-bottom: 16px;
  font-weight: 600;
  font-size: 0.92rem;
  color: #1d1d1f;
}

.admin-content input[type="text"],
.admin-content input[type="email"],
.admin-content input[type="password"],
.admin-content input[type="date"],
.admin-content input[type="file"],
.admin-content textarea,
.admin-content select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #d2d2d7;
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  background: #fff;
  margin-top: 6px;
  transition: border 0.2s ease;
}

.admin-content input:focus,
.admin-content textarea:focus,
.admin-content select:focus {
  outline: none;
  border-color: #2e7d6f;
  box-shadow: 0 0 0 3px rgba(46, 125, 111, 0.1);
}

.admin-content textarea {
  min-height: 100px;
  resize: vertical;
}

/* Button Styles */
.admin-content button[type="submit"],
.admin-content .btn-primary {
  background: linear-gradient(135deg, #2e7d6f, #1f4e4a);
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.admin-content button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(46, 125, 111, 0.3);
}

.admin-content .download {
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-left: 6px;
}

.admin-content .download:hover:not(.btn-loading) {
  background: #e8e8ed;
  border-color: #a1a1a6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.admin-content .download.btn-loading {
  opacity: 0.7;
  cursor: wait;
}

.admin-content a[data-confirm] {
  background: #ffebee;
  color: #d32f2f;
  border-color: #ffcdd2;
}

.admin-content a[data-confirm]:hover {
  background: #ffcdd2;
  border-color: #ef9a9a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

/* Delete button style for form buttons */
.admin-content .btn-delete {
  background: #ffebee;
  color: #d32f2f;
  border: 1px solid #ffcdd2;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
  margin-left: 6px;
  cursor: pointer;
  font-family: Vazirmatn, sans-serif;
}

.admin-content .btn-delete:hover:not(.btn-loading) {
  background: #ffcdd2;
  border-color: #ef9a9a;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.admin-content .btn-delete.btn-loading {
  opacity: 0.7;
  cursor: wait;
}

/* Grid Layout for Forms */
.admin-content .grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

/* Empty State */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #86868b;
}

.empty-state i {
  font-size: 4rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state p {
  font-size: 1rem;
  margin: 0;
}

/* Action Buttons Group */
.action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
  .admin-sidebar {
    width: 100%;
    height: auto;
    position: relative;
    border-left: none;
    border-bottom: 1px solid #e5e5e7;
  }

  .admin-main {
    margin-right: 0;
  }

  .admin-header {
    padding: 20px 16px;
  }

  .admin-header h1 {
    font-size: 1.4rem;
  }

  .admin-content {
    padding: 20px 16px;
  }

  .admin-content .card {
    padding: 16px;
  }

  .admin-content .grid {
    grid-template-columns: 1fr;
  }
}

/* Status Badge */
.status-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-badge.active {
  background: #e6f5f1;
  color: #2e7d6f;
}

.status-badge.inactive {
  background: #f5f5f7;
  color: #86868b;
}

/* Card Header with Action */
.card-header-with-action {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.card-header-with-action h2 {
  margin: 0;
}

.card-header-with-action .btn-primary {
  margin: 0;
  padding: 10px 20px;
  font-size: 0.95rem;
}

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.modal-overlay.active {
  display: flex;
}

.modal-container {
  background: #fff;
  border-radius: 16px;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid #e5e5e7;
  background: linear-gradient(to bottom, #fafafa, #fff);
}

.modal-header h3 {
  margin: 0;
  font-size: 1.3rem;
  color: #1d1d1f;
}

.modal-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  color: #86868b;
  cursor: pointer;
  padding: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: #f5f5f7;
  color: #1d1d1f;
}

.modal-body {
  padding: 28px;
  overflow-y: auto;
  max-height: calc(90vh - 140px);
}

.modal-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid #e5e5e7;
  justify-content: center;
}

.modal-actions button {
  flex: 0 0 auto;
  min-width: 140px;
  margin: 0;
}

.btn-secondary {
  background: #f5f5f7;
  color: #1d1d1f;
  border: none;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 1rem;
  font-weight: 600;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-secondary:hover {
  background: #e5e5e7;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 24px;
  padding: 20px 0;
}

.pagination-btn,
.pagination-number {
  padding: 8px 14px;
  border: 1px solid #e5e5e7;
  background: #fff;
  color: #1d1d1f;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s;
  font-weight: 500;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pagination-btn:hover,
.pagination-number:hover {
  background: #f5f5f7;
  border-color: #d2d2d7;
}

.pagination-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.pagination-number.active {
  background: linear-gradient(135deg, #2e7d6f, #1f4e4a);
  color: #fff;
  border-color: #2e7d6f;
}

.pagination-dots {
  color: #86868b;
  padding: 0 8px;
  user-select: none;
}

/* Loading Overlays */
.content-loading-overlay,
.table-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}

.content-loading-overlay.active,
.table-loading-overlay.active {
  display: flex;
}

.loading-spinner {
  width: 48px;
  height: 48px;
  border: 3px solid #e5e5e7;
  border-top-color: #2e7d6f;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.table-loading-overlay .loading-spinner {
  width: 40px;
  height: 40px;
  border-width: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  margin-top: 12px;
  color: #1d1d1f;
  font-size: 0.9rem;
  font-weight: 600;
}

/* Button Loading State */
.btn-loading {
  position: relative;
  pointer-events: none;
  opacity: 0.8;
  color: transparent !important;
}

.btn-loading::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  top: 50%;
  left: 50%;
  margin-left: -8px;
  margin-top: -8px;
  border: 2px solid transparent;
  border-radius: 50%;
  border-top-color: #1d1d1f;
  animation: spin 0.6s linear infinite;
}

/* Specific loading styles for primary buttons */
.btn-primary.btn-loading::after,
button[type="submit"].btn-loading::after {
  border-top-color: #fff;
}

/* Loading state hides icon and text */
.btn-loading i {
  opacity: 0;
}
