/* CSS Variables & Global Styles */
:root {
  --bg-primary: #0a0e17;
  --bg-secondary: #121824;
  --bg-card: #192030;
  --bg-input: #1e273a;
  --border-color: rgba(255, 255, 255, 0.06);
  --border-active: #6366f1;
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dim: #4b5563;
  
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --primary-glow: rgba(99, 102, 241, 0.15);
  
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.08);
  --success-border: rgba(16, 185, 129, 0.25);
  
  --warning: #f59e0b;
  --warning-glow: rgba(245, 158, 11, 0.08);
  --warning-border: rgba(245, 158, 11, 0.25);
  
  --danger: #ef4444;
  --danger-glow: rgba(239, 68, 68, 0.08);
  --danger-border: rgba(239, 68, 68, 0.25);
  
  --neutral-glow: rgba(255, 255, 255, 0.02);
  
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg: 0 12px 24px rgba(0, 0, 0, 0.25);
  
  --font-family: 'Outfit', sans-serif;
  --transition: all 0.2s ease-in-out;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-primary);
  color: var(--text-main);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbars */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--bg-primary);
}
::-webkit-scrollbar-thumb {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-dim);
}

/* App Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar Styling */
.sidebar {
  width: 250px;
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  padding: 24px;
}

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.25rem;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.logo-text {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

.logo-text span {
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-grow: 1;
}

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

.nav-item:hover {
  background-color: rgba(255, 255, 255, 0.02);
  color: var(--text-main);
}

.nav-item.active {
  background-color: var(--primary-glow);
  color: #a5b4fc;
  border: 1px solid rgba(99, 102, 241, 0.15);
}

/* Sidebar Logout Footer */
.sidebar-footer-actions {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
}

.btn-logout {
  width: 100%;
  background-color: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.88rem;
}

.btn-logout:hover {
  background-color: var(--danger-glow);
  border-color: var(--danger-border);
  color: var(--danger);
}

.sidebar-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--border-color);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.status-indicator.online {
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 40px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-width: 1400px;
  margin: 0 auto;
  width: calc(100vw - 250px);
}

/* Header */
.main-header .subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 4px;
}

.main-header h1 {
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: -0.5px;
}

/* Search Portal Card */
.search-portal-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
}

.section-title {
  font-size: 0.95rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 8px;
}

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

.input-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-field-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.input-field-group label i {
  margin-right: 4px;
  color: var(--primary);
}

.input-wrapper {
  position: relative;
  width: 100%;
}

.input-wrapper input {
  width: 100%;
  height: 48px;
  background-color: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: white;
  padding: 0 16px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  outline: none;
  transition: var(--transition);
}

.input-wrapper input:focus {
  border-color: var(--border-active);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-wrapper input::placeholder {
  color: var(--text-dim);
}

.search-action-row {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  border-top: 1px solid var(--border-color);
  padding-top: 20px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  padding: 0 20px;
  font-size: 0.9rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary);
  color: white;
}

.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-secondary {
  background-color: transparent;
  border-color: var(--border-color);
  color: var(--text-muted);
}

.btn-secondary:hover {
  background-color: rgba(255, 255, 255, 0.04);
  color: white;
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.btn-icon:hover:not(:disabled) {
  background-color: var(--bg-card);
  color: white;
}

.btn-icon:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* Results Area */
.results-header {
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.results-header i {
  color: var(--primary);
  margin-right: 6px;
}

.results-header span {
  font-weight: 700;
  color: white;
}

.results-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-height: 250px;
}

/* States */
.search-default-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  gap: 12px;
}

.portal-graphic {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background-color: var(--neutral-glow);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.search-default-state h3 {
  color: white;
  font-size: 1.15rem;
}

.search-default-state p {
  font-size: 0.88rem;
  max-width: 320px;
  line-height: 1.6;
}

/* Loading State */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 0;
  gap: 16px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.spinner-circle {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(99, 102, 241, 0.1);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Grid for Customer Cards */
.cards-grid {
  display: grid;
  grid-template-columns: 1fr; /* Single column, making each customer profile a large list card */
  gap: 20px;
}

.hidden {
  display: none !important;
}

/* Custom Customer Card Design */
.customer-card {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.customer-card:hover {
  border-color: rgba(99, 102, 241, 0.2);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Header profile info inside Card */
.customer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 16px;
}

.profile-identity {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.avatar-circle {
  width: 52px;
  height: 52px;
  background: linear-gradient(135deg, var(--primary), #06b6d4);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
  flex-shrink: 0;
}

.profile-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.profile-details h2 {
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  margin-bottom: 3px;
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

.profile-contacts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
}

.contact-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
}

.contact-pill:hover {
  color: white;
}

.contact-pill i {
  color: var(--primary);
}

.contact-pill .copy-icon {
  font-size: 0.72rem;
  opacity: 0.4;
  margin-left: 2px;
}

.contact-pill:hover .copy-icon {
  opacity: 1;
}

.hubla-tag {
  font-size: 0.75rem;
  background-color: var(--neutral-glow);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: monospace;
}

/* Product grid inside Card */
.purchased-products-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}

.product-item-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: var(--transition);
}

.product-item-card.purchased {
  background-color: var(--success-glow);
  border-color: var(--success-border);
}

.product-item-card.refunded {
  background-color: var(--danger-glow);
  border-color: var(--danger-border);
}

.product-item-card.abandoned {
  background-color: var(--warning-glow);
  border-color: var(--warning-border);
}

.product-info-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.product-title-area {
  display: flex;
  align-items: center;
  gap: 8px;
}

.product-title-area i {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.product-item-card.purchased .product-title-area i {
  color: var(--success);
}
.product-item-card.refunded .product-title-area i {
  color: var(--danger);
}
.product-item-card.abandoned .product-title-area i {
  color: var(--warning);
}

.product-title-area h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: white;
}

/* Badges */
.buy-badge {
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  background-color: var(--bg-input);
  color: var(--text-dim);
  text-transform: uppercase;
}

.product-item-card.purchased .buy-badge {
  background-color: rgba(16, 185, 129, 0.15);
  color: #34d399;
}

.product-item-card.refunded .buy-badge {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
}

.product-item-card.abandoned .buy-badge {
  background-color: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.product-tx-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  border-top: 1px solid rgba(255, 255, 255, 0.02);
  padding-top: 8px;
  color: var(--text-muted);
}

.product-tx-row span.tx-label {
  font-size: 0.75rem;
}

.product-tx-row span.tx-status-pill {
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.3px;
}

.tx-status-pill.approved {
  color: var(--success);
}
.tx-status-pill.refunded {
  color: var(--danger);
}
.tx-status-pill.abandoned {
  color: var(--warning);
}
.tx-status-pill.none {
  color: var(--text-dim);
}

/* Card footer details */
.customer-footer {
  border-top: 1px solid var(--border-color);
  padding-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-muted);
}

.footer-meta-item strong {
  color: white;
}

/* Pagination */
.pagination-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-muted);
  box-shadow: var(--shadow-sm);
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 12px;
}

.page-num {
  font-weight: 700;
  color: white;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background-color: #1e1b4b;
  border: 1px solid var(--primary);
  color: #c7d2fe;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  z-index: 999;
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.25s ease;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Authentication Login Screen Styling */
.login-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(6, 10, 18, 0.85);
  backdrop-filter: blur(15px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.3s ease;
}

.login-card {
  width: 380px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  padding: 36px 28px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 18px;
  text-align: center;
  animation: scaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleUp {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.login-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.login-card h3 {
  font-size: 1.25rem;
  color: white;
  font-weight: 700;
}

.login-card p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 10px;
}

.login-error {
  background-color: var(--danger-glow);
  border: 1px solid var(--danger-border);
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-block {
  width: 100%;
}

/* Responsive */
@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100%;
    height: auto;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-right: none;
    border-bottom: 1px solid var(--border-color);
  }
  
  .logo-area {
    margin-bottom: 0;
  }
  
  .nav-menu {
    flex-direction: row;
    flex-grow: 0;
    gap: 10px;
  }
  
  .sidebar-footer-actions {
    padding-top: 0;
    border-top: none;
  }
  
  .btn-logout {
    width: auto;
    height: 38px;
    padding: 0 16px;
  }
  
  .main-content {
    width: 100vw;
    padding: 24px;
    height: calc(100vh - 76px);
  }
}

@media (max-width: 768px) {
  .customer-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  
  .hubla-tag {
    align-self: flex-start;
  }
  
  .customer-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
