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

:root {
  --bg-dark: #090d16;
  --bg-card: rgba(20, 28, 47, 0.65);
  --bg-card-hover: rgba(28, 38, 62, 0.8);
  --border-color: rgba(255, 255, 255, 0.08);
  
  --color-text-main: #f8fafc;
  --color-text-muted: #94a3b8;
  
  --buyer-primary: #06b6d4; /* Neon Cyan */
  --buyer-glow: rgba(6, 182, 212, 0.25);
  
  --supplier-primary: #a855f7; /* Neon Violet */
  --supplier-glow: rgba(168, 85, 247, 0.25);
  
  --color-success: #10b981;
  --color-success-glow: rgba(16, 185, 129, 0.2);
  --color-warning: #f59e0b;
  --color-warning-glow: rgba(245, 158, 11, 0.2);
  --color-danger: #f43f5e;
  --color-danger-glow: rgba(244, 63, 94, 0.2);
  
  --font-family: 'Outfit', sans-serif;
  --transition-smooth: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--color-text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* Background Gradients */
body::before {
  content: '';
  position: absolute;
  top: -10%;
  left: -10%;
  width: 50%;
  height: 60%;
  background: radial-gradient(circle, rgba(6, 182, 212, 0.1) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

body::after {
  content: '';
  position: absolute;
  bottom: -10%;
  right: -10%;
  width: 50%;
  height: 60%;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.08) 0%, transparent 70%);
  z-index: -1;
  pointer-events: none;
}

/* Header & Container */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--buyer-primary), var(--supplier-primary));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: white;
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.3);
}

.brand h1 {
  font-size: 1.5rem;
  font-weight: 700;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.user-status {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.role-badge {
  padding: 0.5rem 1rem;
  border-radius: 20px;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.role-buyer {
  background: rgba(6, 182, 212, 0.15);
  color: var(--buyer-primary);
  border: 1px solid rgba(6, 182, 212, 0.3);
}

.role-supplier {
  background: rgba(168, 85, 247, 0.15);
  color: var(--supplier-primary);
  border: 1px solid rgba(168, 85, 247, 0.3);
}

/* Glassmorphism Card Style */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  transition: var(--transition-smooth);
}

.card:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.12);
}

/* Auth / Portal Page */
.portal-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.portal-card {
  max-width: 450px;
  width: 100%;
  text-align: center;
}

.portal-card h2 {
  font-size: 2rem;
  margin-bottom: 0.5rem;
}

.portal-card p {
  color: var(--color-text-muted);
  margin-bottom: 2rem;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  text-align: left;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

input, select, textarea {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  color: var(--color-text-main);
  font-family: var(--font-family);
  font-size: 1rem;
  outline: none;
  transition: var(--transition-smooth);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--buyer-primary);
  box-shadow: 0 0 10px var(--buyer-glow);
}

.supplier-theme input:focus, 
.supplier-theme select:focus, 
.supplier-theme textarea:focus {
  border-color: var(--supplier-primary);
  box-shadow: 0 0 10px var(--supplier-glow);
}

button {
  cursor: pointer;
  border: none;
  font-family: var(--font-family);
  font-weight: 600;
  border-radius: 8px;
  padding: 0.75rem 1.5rem;
  transition: var(--transition-smooth);
}

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

.btn-primary:hover {
  background: #22d3ee;
  transform: translateY(-2px);
}

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

.btn-supplier:hover {
  background: #c084fc;
  transform: translateY(-2px);
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--color-text-main);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: var(--color-danger);
  color: white;
  box-shadow: 0 4px 14px var(--color-danger-glow);
}

.btn-danger:hover {
  background: #f43f5e;
  transform: translateY(-2px);
}

.btn-success {
  background: var(--color-success);
  color: #000;
  box-shadow: 0 4px 14px var(--color-success-glow);
}

.btn-success:hover {
  background: #34d399;
  transform: translateY(-2px);
}

/* Dashboard Grid Layouts */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
}

@media (min-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr 2fr;
  }
  
  .full-width {
    grid-column: span 2;
  }
}

/* Stats Cards */
.stats-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.25rem;
}

.stat-title {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
}

.buyer-theme .stat-value {
  color: var(--buyer-primary);
}

.supplier-theme .stat-value {
  color: var(--supplier-primary);
}

/* Order Cards and Lists */
.order-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-right: 0.5rem;
}

/* Scrollbar styling */
.order-list::-webkit-scrollbar, .closures-list::-webkit-scrollbar {
  width: 6px;
}
.order-list::-webkit-scrollbar-track, .closures-list::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
.order-list::-webkit-scrollbar-thumb, .closures-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.order-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  transition: var(--transition-smooth);
}

.order-item:hover {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.15);
}

.order-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.order-header-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.order-id {
  font-family: monospace;
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

.order-title {
  font-weight: 600;
  font-size: 1.05rem;
}

.order-notes {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  font-style: italic;
  max-width: 350px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.order-creds {
  font-family: monospace;
  font-size: 0.875rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  margin-top: 0.5rem;
}

.order-price {
  font-size: 1.25rem;
  font-weight: 700;
}

.badge {
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

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

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

.badge-unpaid {
  background: rgba(244, 63, 94, 0.15);
  color: var(--color-danger);
  border: 1px solid rgba(244, 63, 94, 0.3);
}

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

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

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  z-index: 100;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 16px;
  max-width: 500px;
  width: 90%;
  padding: 2rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 1.5rem;
}

/* History / Archive Styles */
.closures-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.closure-item {
  padding: 1.25rem;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  transition: var(--transition-smooth);
}

.closure-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.closure-id {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.closure-date {
  font-weight: 600;
}

.closure-body {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.closure-counts {
  color: var(--color-text-muted);
}

.closure-amount {
  font-weight: 700;
  color: #fff;
}

.closure-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 0.75rem;
  border-top: 1px dashed var(--border-color);
}

.error-message {
  color: var(--color-danger);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

/* Grouped Card Styles */
.group-wrapper {
  display: flex;
  flex-direction: column;
  background: rgba(15, 23, 42, 0.4);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  overflow: hidden;
  transition: var(--transition-smooth);
}

.group-wrapper:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(15, 23, 42, 0.5);
}

.group-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  padding: 1.25rem;
  user-select: none;
}

.group-title-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.group-toggle-icon {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  transition: var(--transition-smooth);
}

.group-toggle-icon.expanded {
  transform: rotate(180deg);
  color: var(--buyer-primary);
}

.supplier-theme .group-toggle-icon.expanded {
  color: var(--supplier-primary);
}

.group-body {
  display: none; /* Toggleable */
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 1.25rem 1.25rem 1.25rem;
  background: rgba(0, 0, 0, 0.15);
  border-top: 1px solid rgba(255, 255, 255, 0.03);
}

.group-sub-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: rgba(15, 23, 42, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  font-size: 0.9rem;
  transition: var(--transition-smooth);
}

.group-sub-item:hover {
  background: rgba(15, 23, 42, 0.5);
}

/* Sidebar Drawer Styles */
.sidebar-drawer {
  position: fixed;
  top: 0;
  left: -280px; /* Start hidden */
  width: 280px;
  height: 100vh;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(20px);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 10px 0 30px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
}

.sidebar-drawer.open {
  left: 0;
}

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.drawer-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  margin: 0;
}

#closeDrawerBtn {
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-size: 1.75rem;
  cursor: pointer;
  transition: var(--transition-smooth);
}

#closeDrawerBtn:hover {
  color: #fff;
}

.drawer-menu {
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.5rem;
}

.drawer-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: var(--transition-smooth);
  text-align: left;
  font-family: inherit;
  font-size: 0.95rem;
}

.drawer-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.15);
}

.drawer-item.active {
  background: rgba(6, 182, 212, 0.1);
  border-color: var(--buyer-primary);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 0 15px rgba(6, 182, 212, 0.15);
}

.drawer-item.active .indicator {
  background: var(--buyer-primary);
  box-shadow: 0 0 8px var(--buyer-primary);
}

.drawer-item .indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: var(--transition-smooth);
}

/* Overlay */
.drawer-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.drawer-overlay.show {
  opacity: 1;
  pointer-events: auto;
}


