/* ═══ SolaRay Vendor Web Portal Stylesheet (Senior Engineer Redesign) ═══ */

@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg-primary: #070a12;
  --bg-secondary: #0d1322;
  --bg-tertiary: #141c30;
  --bg-card: rgba(13, 19, 34, 0.75);
  --bg-glass: rgba(13, 19, 34, 0.6);
  
  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  
  --accent: #10b981; /* Vendor Emerald */
  --accent-hover: #059669;
  --accent-gradient: linear-gradient(135deg, #10b981, #059669);
  --accent-glow: rgba(16, 185, 129, 0.25);
  
  --solar-amber: #f59e0b;
  --solar-amber-gradient: linear-gradient(135deg, #f59e0b, #d97706);
  
  --success: #10b981;
  --danger: #ef4444;
  --warning: #f59e0b;
  --info: #3b82f6;
  
  --border: rgba(255, 255, 255, 0.08);
  --border-focus: rgba(16, 185, 129, 0.45);
  
  --font-family: 'Cairo', 'Inter', system-ui, -apple-system, sans-serif;
  
  --sidebar-width: 270px;
  --header-height: 68px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  --shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.6);
}

/* Base Styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
*::-webkit-scrollbar-track {
  background: transparent;
}
*::-webkit-scrollbar-thumb {
  background-color: var(--border);
  border-radius: 20px;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  overflow-x: hidden;
  min-height: 100vh;
  line-height: 1.6;
  direction: rtl;
  text-align: right;
}

[dir="ltr"] body {
  direction: ltr;
  text-align: left;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ═══ BUTTON SYSTEM (Compact & Professional) ═══ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  font-family: var(--font-family);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  width: auto;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, #059669, #047857);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text-primary);
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.3);
  color: #ef4444;
}

.btn-danger:hover:not(:disabled) {
  background: #ef4444;
  color: #ffffff;
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
  border-radius: var(--radius-sm);
}

.btn-block {
  width: 100% !important;
}

/* ═══ LOGIN PAGE ═══ */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  background: radial-gradient(circle at top right, rgba(16, 185, 129, 0.1), transparent 45%),
              radial-gradient(circle at bottom left, rgba(245, 158, 11, 0.06), transparent 45%),
              var(--bg-primary);
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  box-shadow: var(--shadow);
  text-align: center;
  animation: fadeIn 0.4s ease-out;
}

.login-logo {
  width: 72px;
  height: 72px;
  margin-bottom: 20px;
  border-radius: 16px;
  filter: drop-shadow(0 0 16px rgba(16, 185, 129, 0.4));
}

.login-title {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.login-title span {
  color: #10b981;
}

.login-subtitle {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-bottom: 28px;
  line-height: 1.5;
}

/* Form Controls */
.form-group {
  margin-bottom: 18px;
  text-align: right;
}

[dir="ltr"] .form-group {
  text-align: left;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.form-input-container {
  position: relative;
}

.form-input-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 18px;
  height: 18px;
  pointer-events: none;
}

[dir="ltr"] .form-input-icon {
  right: auto;
  left: 14px;
}

.form-input,
select.form-input,
textarea.form-input {
  width: 100%;
  padding: 11px 16px;
  padding-right: 42px;
  background: rgba(11, 15, 25, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-family);
  transition: var(--transition);
  outline: none;
}

[dir="ltr"] .form-input {
  padding-right: 16px;
  padding-left: 42px;
}

.form-input-container-plain .form-input {
  padding-right: 16px;
}

.form-input:focus,
select.form-input:focus,
textarea.form-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
  background: rgba(11, 15, 25, 0.95);
}

.form-input::placeholder,
textarea.form-input::placeholder {
  color: var(--text-muted);
}

.auth-error-msg,
.error-message {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-top: 14px;
  text-align: center;
  display: none;
  animation: shake 0.3s ease;
}

/* ═══ DASHBOARD LAYOUT ═══ */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  opacity: 1;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100vh;
  position: fixed;
  top: 0;
  right: 0;
  z-index: 100;
  transition: var(--transition);
}

[dir="ltr"] .sidebar {
  right: auto;
  left: 0;
  border-left: none;
  border-right: 1px solid var(--border);
}

.sidebar-header {
  height: var(--header-height);
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  background: rgba(7, 10, 18, 0.5);
}

.sidebar-logo {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.sidebar-brand-text {
  display: flex;
  flex-direction: column;
}

.sidebar-brand-name {
  font-size: 17px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: -0.3px;
}

.sidebar-brand-name span {
  color: #10b981;
}

.sidebar-badge {
  font-size: 11px;
  font-weight: 700;
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.25);
  padding: 1px 8px;
  border-radius: 12px;
  width: fit-content;
  margin-top: 1px;
}

.sidebar-menu {
  padding: 18px 14px;
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-menu-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  padding: 0 12px;
  margin-bottom: 8px;
}

.menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  border: 1px solid transparent;
}

.menu-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

.menu-item.active {
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  font-weight: 700;
  border-color: rgba(16, 185, 129, 0.3);
}

.menu-item-icon {
  width: 19px;
  height: 19px;
  flex-shrink: 0;
}

.menu-badge {
  margin-right: auto;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 10px;
}

[dir="ltr"] .menu-badge {
  margin-right: 0;
  margin-left: auto;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(7, 10, 18, 0.5);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.user-profile-summary {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.user-info {
  flex: 1;
  overflow: hidden;
}

.user-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11.5px;
  color: #10b981;
}

/* ═══ MAIN CONTENT AREA ═══ */
.main-content {
  flex: 1;
  margin-right: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

[dir="ltr"] .main-content {
  margin-right: 0;
  margin-left: var(--sidebar-width);
}

/* Topbar Header */
.top-header {
  height: var(--header-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 90;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.top-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-header-title h2 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-primary);
}

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

/* Content Container */
.content-body {
  flex: 1;
  padding: 28px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Panels */
.panel,
.panel-view {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.panel.active,
.panel-view.active {
  display: block;
}

/* ═══ STATS GRID ═══ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

.stat-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px rgba(0, 0, 0, 0.4);
}

.stat-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.stat-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-secondary);
}

.stat-icon-wrapper {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stat-value {
  font-size: 30px;
  font-weight: 800;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 6px;
}

.stat-footer {
  font-size: 12px;
  color: var(--text-muted);
}

/* ═══ CONTENT CARD (Dark Theme Container) ═══ */
.content-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.content-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  gap: 16px;
  flex-wrap: wrap;
}

.content-card-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text-primary);
}

.content-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 3px;
}

/* ═══ TABLES ═══ */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(7, 10, 18, 0.4);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 13.5px;
}

[dir="ltr"] .data-table {
  text-align: left;
}

.data-table th {
  background: rgba(13, 19, 34, 0.85);
  padding: 13px 16px;
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 12.5px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Status Select Dropdown */
.status-select {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-family);
  cursor: pointer;
  outline: none;
  border: 1px solid var(--border);
  transition: var(--transition);
  background: rgba(11, 15, 25, 0.8);
  color: var(--text-primary);
  text-align: right;
  direction: rtl;
}

.status-select:hover {
  border-color: rgba(255, 255, 255, 0.25);
}

.status-select.pending {
  background: rgba(245, 158, 11, 0.15) !important;
  color: #f59e0b !important;
  border-color: rgba(245, 158, 11, 0.4) !important;
}

.status-select.processing,
.status-select.confirmed {
  background: rgba(59, 130, 246, 0.15) !important;
  color: #3b82f6 !important;
  border-color: rgba(59, 130, 246, 0.4) !important;
}

.status-select.delivered {
  background: rgba(16, 185, 129, 0.15) !important;
  color: #10b981 !important;
  border-color: rgba(16, 185, 129, 0.4) !important;
}

.status-select.cancelled {
  background: rgba(239, 68, 68, 0.15) !important;
  color: #ef4444 !important;
  border-color: rgba(239, 68, 68, 0.4) !important;
}

.status-select option {
  background: #0d1322;
  color: #f8fafc;
  padding: 8px;
}

/* Realtime Live Indicator */
.realtime-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(16, 185, 129, 0.1);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
  animation: pulseLive 1.5s infinite;
}

@keyframes pulseLive {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.85); }
}

/* Realtime Toast Notification */
.realtime-toast {
  position: fixed;
  bottom: 24px;
  left: 24px;
  background: rgba(13, 19, 34, 0.95);
  border: 1px solid #10b981;
  color: #f8fafc;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  z-index: 99999;
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.realtime-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ═══ MODALS (Fixed, Centered & High Z-Index) ═══ */
.modal,
.modal-overlay,
.modal-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(5, 8, 15, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 9999;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

.modal.active,
.modal-overlay.active,
.modal-backdrop.active {
  display: flex !important;
}

.modal-content,
.modal-card {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 600px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.8);
  overflow: hidden;
  animation: modalPop 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(7, 10, 18, 0.4);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close,
.modal-close-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: var(--transition);
}

.modal-close:hover,
.modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
}

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

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  background: rgba(7, 10, 18, 0.4);
}

/* ═══ ANIMATIONS ═══ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* Responsive */
@media (max-width: 992px) {
  .sidebar {
    transform: translateX(100%);
  }
  [dir="ltr"] .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
  }
  .main-content {
    margin-right: 0 !important;
    margin-left: 0 !important;
  }
}
