/* ============================================================
   Diplosoft Admin — admin.css
   Premium Dark Glassmorphism Admin Panel Styles
   ============================================================ */

:root {
  --admin-bg-dark: #0a0b0e;
  --admin-glass-bg: rgba(20, 22, 31, 0.6);
  --admin-glass-border: rgba(255, 255, 255, 0.08);
  --admin-glass-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
  --admin-accent: #3b82f6;
  --admin-accent-hover: #60a5fa;
  --admin-text: #e2e8f0;
  --admin-text-muted: #94a3b8;
  --admin-border: rgba(255, 255, 255, 0.1);
  --admin-sidebar-width: 260px;
  --admin-header-height: 70px;
  --transition-speed: 0.3s;
}

body.admin-body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--admin-bg-dark);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(59, 130, 246, 0.15), transparent 25%),
    radial-gradient(circle at 85% 30%, rgba(147, 51, 234, 0.15), transparent 25%);
  background-attachment: fixed;
  color: var(--admin-text);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* =========================================
   Layout Structure
   ========================================= */
.admin-layout {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: var(--admin-sidebar-width);
  background: var(--admin-glass-bg);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-right: 1px solid var(--admin-glass-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform var(--transition-speed) ease;
}

.admin-sidebar-header {
  height: var(--admin-header-height);
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid var(--admin-glass-border);
}

.admin-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  font-size: 1.1rem;
}

.admin-brand img {
  border-radius: 8px;
}

.admin-nav {
  padding: 24px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.admin-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  color: var(--admin-text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: all 0.2s ease;
}

.admin-nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
}

.admin-nav-item.active {
  background: rgba(59, 130, 246, 0.15);
  color: var(--admin-accent-hover);
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.admin-sidebar-footer {
  padding: 24px 16px;
  border-top: 1px solid var(--admin-glass-border);
}

.admin-main {
  flex: 1;
  margin-left: var(--admin-sidebar-width);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.admin-header {
  height: var(--admin-header-height);
  background: var(--admin-glass-bg);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--admin-glass-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.admin-header-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
  color: #fff;
}

.admin-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.admin-content {
  padding: 32px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* =========================================
   UI Components (Premium Glass)
   ========================================= */
.admin-card {
  background: var(--admin-glass-bg);
  backdrop-filter: blur(16px) saturate(150%);
  -webkit-backdrop-filter: blur(16px) saturate(150%);
  border: 1px solid var(--admin-glass-border);
  border-radius: 16px;
  padding: 24px;
  box-shadow: var(--admin-glass-shadow);
  display: flex;
  flex-direction: column;
}

.admin-stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 24px;
  background: linear-gradient(145deg, rgba(30,41,59,0.7) 0%, rgba(15,23,42,0.7) 100%);
}

.admin-stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: rgba(59, 130, 246, 0.1);
  color: var(--admin-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
}

.admin-stat-details h3 {
  margin: 0 0 4px;
  color: var(--admin-text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.admin-stat-details p {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  color: #fff;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
}

.admin-btn {
  background: var(--admin-accent);
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
}

.admin-btn:hover {
  background: var(--admin-accent-hover);
  box-shadow: 0 0 15px rgba(59, 130, 246, 0.4);
  transform: translateY(-1px);
}

.admin-btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--admin-border);
}

.admin-btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.admin-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 0.95rem;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.admin-input:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* =========================================
   Data Tables
   ========================================= */
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.admin-table th {
  padding: 16px;
  color: var(--admin-text-muted);
  font-weight: 500;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--admin-glass-border);
}

.admin-table td {
  padding: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-size: 0.95rem;
}

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

.admin-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.admin-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.admin-badge.success {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.admin-badge.pending {
  background: rgba(245, 158, 11, 0.1);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.2);
}

/* =========================================
   Modals
   ========================================= */
.admin-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.admin-modal {
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid var(--admin-glass-border);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  border-radius: 20px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalFadeIn 0.3s ease-out;
}

.admin-modal.large {
  max-width: 900px;
}

.admin-modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--admin-glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.admin-modal-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: #fff;
}

.admin-modal-close {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color 0.2s;
}

.admin-modal-close:hover {
  color: #fff;
}

.admin-modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.admin-modal-footer {
  padding: 24px;
  border-top: 1px solid var(--admin-glass-border);
  display: flex;
  justify-content: flex-end;
  gap: 16px;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(20px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Auth Pages */
.auth-page {
  align-items: center;
  justify-content: center;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--admin-glass-bg);
  border: 1px solid var(--admin-glass-border);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--admin-glass-shadow);
  backdrop-filter: blur(24px) saturate(150%);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  margin: 16px 0 8px;
  font-size: 1.5rem;
  color: #fff;
}

.auth-header p {
  color: var(--admin-text-muted);
  margin: 0;
}

.al-form-group {
  margin-bottom: 20px;
}

.al-form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.9rem;
  color: var(--admin-text-muted);
}

.al-input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 12px 16px;
  color: #fff;
  width: 100%;
  box-sizing: border-box;
  font-size: 1rem;
  transition: all 0.2s;
}

.al-input:focus {
  outline: none;
  border-color: var(--admin-accent);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.al-btn {
  width: 100%;
  background: var(--admin-accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.al-btn:hover {
  background: var(--admin-accent-hover);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
}

.al-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 12px;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 0.9rem;
}

/* ============================================================
   Legacy Modals (Restyled for Premium Glassmorphism)
   ============================================================ */

.ds-modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(12px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 1;
  transition: opacity var(--transition-speed);
}

.ds-modal-overlay[hidden] {
  display: none;
  opacity: 0;
}

.ds-modal {
  background: var(--admin-glass-bg);
  border: 1px solid var(--admin-glass-border);
  border-radius: 20px;
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--admin-glass-shadow);
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  overflow: hidden;
}

.ds-modal-lg { max-width: 800px; }
.ds-modal-xl { max-width: 1000px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.ds-modal-header {
  padding: 24px;
  border-bottom: 1px solid var(--admin-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
}

.ds-modal-title {
  margin: 0;
  font-size: 1.2rem;
  color: #fff;
  font-weight: 600;
}

.ds-modal-close {
  background: transparent;
  border: none;
  color: var(--admin-text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  transition: color var(--transition-speed);
}

.ds-modal-close:hover {
  color: #ef4444;
}

.ds-modal-body {
  padding: 24px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--admin-border) transparent;
}

.ds-modal-footer {
  padding: 24px;
  border-top: 1px solid var(--admin-border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(0, 0, 0, 0.2);
}

.ds-form-row {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}
.ds-form-row > * { flex: 1; }

.ds-form-group {
  margin-bottom: 20px;
}
.ds-form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--admin-text-muted);
  margin-bottom: 8px;
}

.ds-items-header {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 40px;
  gap: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--admin-border);
  margin-bottom: 16px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--admin-text-muted);
}

.ds-item-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr 40px;
  gap: 16px;
  margin-bottom: 12px;
  align-items: center;
}

.ds-add-item-btn {
  background: transparent;
  border: 1px dashed var(--admin-border);
  color: var(--admin-accent);
  padding: 12px;
  border-radius: 12px;
  cursor: pointer;
  width: 100%;
  font-weight: 500;
  transition: all var(--transition-speed);
  margin-top: 12px;
}
.ds-add-item-btn:hover {
  border-color: var(--admin-accent);
  background: rgba(59, 130, 246, 0.05);
}

.ds-totals-block {
  margin-top: 32px;
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--admin-border);
  border-radius: 16px;
}

.ds-total-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  color: var(--admin-text-muted);
}

.ds-grand-total {
  border-top: 1px solid var(--admin-border);
  margin-top: 12px;
  padding-top: 16px;
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
}

.ds-tax-input {
  width: 80px;
  text-align: right;
  padding: 4px 8px;
}

.ds-btn-ghost {
  background: transparent;
  border: 1px solid var(--admin-border);
  color: var(--admin-text);
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  transition: all var(--transition-speed);
}
.ds-btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ds-btn-primary {
  background: linear-gradient(135deg, var(--admin-accent), #2563eb);
  border: none;
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
  transition: all var(--transition-speed);
}
.ds-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}

/* =========================================
   Mobile Responsiveness
   ========================================= */
@media (max-width: 980px) {
  .admin-layout {
    flex-direction: column;
  }
  .admin-sidebar {
    position: static;
    width: 100%;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--admin-glass-border);
  }
  .admin-main {
    margin-left: 0;
  }
  .admin-header {
    padding: 0 16px;
  }
  .admin-content {
    padding: 16px;
  }
  .ds-form-row {
    flex-direction: column;
    gap: 12px;
  }
  .ds-modal {
    max-width: 95vw;
    max-height: 95vh;
    margin: 0 auto;
  }
  .ds-modal-header,
  .ds-modal-body,
  .ds-modal-footer {
    padding: 16px;
  }
  .admin-table-container {
    overflow-x: auto;
  }
}
