/* 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;
  box-shadow: 0 4px 16px rgba(46, 125, 111, 0.3);
}

.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 cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-link:hover {
  background: #f5f5f7;
  transform: translateX(-2px);
}

.sidebar-link.active {
  background: linear-gradient(135deg, #e6f5f1, #d4ebe6);
  color: #2e7d6f;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(46, 125, 111, 0.15);
}

.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;
  position: relative; /* برای loading overlay */
}

.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;
  transition: opacity 0.2s ease;
}

.admin-header h1.fade-in {
  animation: fadeInDown 0.3s ease;
}

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

.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;
  min-height: 400px; /* جلوگیری از CLS */
  transition: box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-content .card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}

.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;
  table-layout: fixed; /* جلوگیری از تغییر سایز ستون‌ها */
}

.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 td.truncate {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-content .table tbody tr {
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.admin-content .table tbody tr:hover {
  background: #f8f9fa;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
  transform: scale(1.002);
}

/* 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 input.error,
.admin-content textarea.error {
  border-color: #ff3b30;
  background: #fff5f5;
}

.admin-content input.error:focus,
.admin-content textarea.error:focus {
  border-color: #ff3b30;
  box-shadow: 0 0 0 3px rgba(255, 59, 48, 0.1);
}

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

/* Button Styles - Improved Color Scheme */
.admin-content button[type="submit"],
.admin-content .btn-primary, 
.modal-actions .btn-primary{
  background: linear-gradient(135deg, #2e7d6f, #1f4e4a);
  color: #fff;
  border: none;
  padding: 11px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 120px;
  height: 42px;
  white-space: nowrap;
  position: relative;
  box-shadow: 0 2px 8px rgba(46, 125, 111, 0.25);
}

.admin-content .btn-secondary {
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  padding: 11px 24px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 120px;
  height: 42px;
  white-space: nowrap;
}

.admin-content .btn-secondary:hover:not(:disabled) {
  background: #e8e8ed;
  border-color: #a1a1a6;
  transform: translateY(-1px);
}

.admin-content .btn-secondary:disabled {
  opacity: 0.8;
  cursor: wait;
}

.event-order-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}

.event-order-grid h4 {
  margin: 0 0 10px;
  font-size: 1rem;
  color: #1d1d1f;
}

.event-order-list {
  border: 1px solid #e5e5e7;
  border-radius: 10px;
  background: #fafafa;
  padding: 10px;
  min-height: 180px;
  display: grid;
  gap: 8px;
}

.event-order-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid #e5e5e7;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: grab;
}

.event-order-item.dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.event-order-title {
  font-size: 0.92rem;
  color: #1d1d1f;
  font-weight: 500;
}

.drag-handle {
  color: #86868b;
  font-size: 1rem;
}

.admin-content button[type="submit"]:hover:not(:disabled),
.admin-content .btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(46, 125, 111, 0.45);
  background: linear-gradient(135deg, #26665a, #173a37);
}

.admin-content button[type="submit"]:active:not(:disabled),
.admin-content .btn-primary:active:not(:disabled) {
  transform: translateY(0);
}

.admin-content button[type="submit"]:disabled,
.admin-content .btn-primary:disabled {
  opacity: 0.8;
  cursor: wait;
}

.admin-content button[type="submit"] .las,
.admin-content .btn-primary .las {
  transition: opacity 0.15s ease;
}

.admin-content button[type="submit"]:disabled .las:not(.la-spinner),
.admin-content .btn-primary:disabled .las:not(.la-spinner) {
  opacity: 0;
}

.admin-content .download {
  background: linear-gradient(135deg, #5fa89a, #4a8b7e);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 6px;
  box-shadow: 0 2px 6px rgba(95, 168, 154, 0.25);
}

.admin-content .download:hover:not(.btn-loading) {
  background: linear-gradient(135deg, #6bb8a9, #5fa89a);
  box-shadow: 0 4px 16px rgba(95, 168, 154, 0.4);
  transform: translateY(-1px);
}

.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);
}

/* Edit button style - مینیمال و مدرن */
.admin-content .btn-edit {
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 6px;
  cursor: pointer;
  font-family: Vazirmatn, sans-serif;
  min-width: 90px;
  height: 32px;
  white-space: nowrap;
  position: relative;
}

.admin-content .btn-edit:hover:not(:disabled) {
  background: #e8e8ed;
  border-color: #a1a1a6;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  transform: translateY(-1px);
}

.admin-content .btn-edit:active:not(:disabled) {
  transform: translateY(0);
}

.admin-content .btn-edit:disabled {
  cursor: wait;
}

.admin-content .btn-edit .las {
  transition: opacity 0.15s ease;
}

.admin-content .btn-edit:disabled .las:not(.la-spinner) {
  opacity: 0;
}

/* Delete button style - مینیمال و مدرن */
.admin-content .btn-delete {
  background: #fff;
  color: #d32f2f;
  border: 1px solid #e5e5e7;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: 6px;
  cursor: pointer;
  font-family: Vazirmatn, sans-serif;
  min-width: 90px;
  height: 32px;
  white-space: nowrap;
  position: relative;
}


.admin-content .btn-delete:hover:not(:disabled) {
  background: #ffebee;
  border-color: #ef5350;
  color: #c62828;
  box-shadow: 0 2px 8px rgba(211, 47, 47, 0.15);
  transform: translateY(-1px);
}

.admin-content .btn-delete:active:not(:disabled) {
  transform: translateY(0);
}

.admin-content .btn-delete:disabled {
  cursor: wait;
}

.admin-content .btn-delete .las {
  transition: opacity 0.15s ease;
}

.admin-content .btn-delete:disabled .las:not(.la-spinner) {
  opacity: 0;
}

/* 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;
  }
  
  /* Loading overlay در mobile تمام صفحه را بپوشاند */
  .content-loading-overlay,
  .table-loading-overlay {
    right: 0;
    width: 100vw;
  }
}

/* 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);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(0);
  transition: background-color 0.25s ease, backdrop-filter 0.25s ease;
}

.modal-overlay.active {
  display: flex;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  animation: overlayFadeIn 0.25s ease;
}

@keyframes overlayFadeIn {
  from {
    background-color: rgba(0, 0, 0, 0);
    backdrop-filter: blur(0);
  }
  to {
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
  }
}

.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.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, opacity;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(-10px);
  }
  to {
    opacity: 1;
    transform: scale(1) 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;
}

.modal-actions .btn-delete {
  background-color: #a33333;
  color: #fff;
}
.modal-actions .btn-delete:hover {
  background-color: #bd4444 !important;
  color: #fff !important;
}

.btn-secondary {
  background: #f5f5f7;
  color: #1d1d1f;
  border: 1px solid #d2d2d7;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 110px;
  height: 42px;
  white-space: nowrap;
  position: relative;
}

.btn-secondary:hover:not(:disabled) {
  background: #e5e5e7;
  border-color: #b4b4b8;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: translateY(-1px);
}

.btn-secondary:active:not(:disabled) {
  transform: translateY(0);
}

/* 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 ease;
  font-weight: 500;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 42px;
  height: 38px;
  white-space: nowrap;
  position: relative;
  font-family: "Vazirmatn", "Tahoma", sans-serif;
}

.pagination-btn:hover:not(:disabled):not(.active),
.pagination-number:hover:not(.active) {
  background: #f5f5f7;
  border-color: #d2d2d7;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.pagination-btn:active:not(:disabled),
.pagination-number:active {
  transform: translateY(0);
}

.pagination-btn:disabled {
  cursor: wait;
  opacity: 0.6;
}

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

.pagination-btn .las,
.pagination-number .las {
  transition: opacity 0.15s ease;
}

.pagination-btn:disabled .las:not(.la-spinner) {
  opacity: 0;
}

.pagination-number.active,
.pagination-btn.active {
  background: linear-gradient(135deg, #2e7d6f, #1f4e4a);
  color: #fff;
  border-color: #2e7d6f;
  box-shadow: 0 2px 8px rgba(46, 125, 111, 0.3);
  pointer-events: none;
}

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

/* Loading Overlays - Enhanced with better UX */
.content-loading-overlay,
.table-loading-overlay {
  position: fixed;
  top: 0;
  right: 280px; /* فاصله از سمت راست برای sidebar */
  width: calc(100vw - 280px);
  height: 100vh;
  background: rgba(255, 255, 255, 0.97);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(4px);
  flex-direction: column;
  gap: 16px;
}

.content-loading-overlay.active,
.table-loading-overlay.active {
  display: flex !important; /* اطمینان از نمایش */
}

@keyframes smoothFadeIn {
  from { 
    opacity: 0;
    backdrop-filter: blur(0);
  }
  to { 
    opacity: 1;
    backdrop-filter: blur(4px);
  }
}

.loading-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid #e5e5e7;
  border-top-color: #2e7d6f;
  border-bottom-color: #2e7d6f;
  border-radius: 50%;
  animation: smoothSpin 0.8s cubic-bezier(0.645, 0.045, 0.355, 1) infinite;
  box-shadow: 0 2px 12px rgba(46, 125, 111, 0.15);
}

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

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

.loading-text {
  color: #1d1d1f;
  font-size: 0.95rem;
  font-weight: 600;
  animation: smoothPulse 1.8s ease-in-out infinite;
  letter-spacing: 0.3px;
}

@keyframes smoothPulse {
  0%, 100% { opacity: 0.5; }
  50% { opacity: 1; }
}

/* 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;
}

/* Notification Toast Animations */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes slideUp {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -20px);
  }
}
