:root {
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --secondary: #8b5cf6;
  --bg-color: #f1f5f9;
  --card-bg: rgba(255, 255, 255, 0.7);
  --card-border: rgba(255, 255, 255, 0.5);
  --text-main: #1e293b;
  --text-muted: #64748b;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body {
  background-color: var(--bg-color);
  background-image: 
    radial-gradient(at 0% 0%, rgba(59, 130, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 0%, rgba(139, 92, 246, 0.15) 0px, transparent 50%),
    radial-gradient(at 100% 100%, rgba(16, 185, 129, 0.1) 0px, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
}

.glass-panel {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  box-shadow: var(--shadow-sm);
  border-radius: 16px;
}

.app-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

/* Header */
.app-header {
  padding: 1.5rem 2rem;
  margin-bottom: 2rem;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.header-content h1 {
  font-size: 1.8rem;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.header-content h1 i {
  color: var(--primary);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.update-time {
  font-size: 0.9rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.5);
  padding: 0.5rem 1rem;
  border-radius: 20px;
}

.btn-import {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-import:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}

/* Search Section */
.search-section {
  margin-bottom: 2rem;
}

.search-box {
  display: flex;
  align-items: center;
  padding: 0.5rem 1.5rem;
  position: relative;
  transition: all 0.3s ease;
}

.search-box:focus-within {
  box-shadow: var(--shadow-md), 0 0 0 2px rgba(59, 130, 246, 0.3);
}

.search-icon {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin-right: 1rem;
}

#search-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 1rem 0;
  font-size: 1.1rem;
  color: var(--text-main);
  outline: none;
}

#search-input::placeholder {
  color: #94a3b8;
}

.search-count {
  font-size: 0.9rem;
  color: var(--primary);
  background: rgba(59, 130, 246, 0.1);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-weight: 600;
}

/* Inventory Grid */
.inventory-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 3rem;
  margin-bottom: 1rem;
  opacity: 0.5;
}

/* Cards */
.inventory-card {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  height: 100%;
}

.inventory-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: rgba(59, 130, 246, 0.3);
}

.card-header {
  margin-bottom: 1rem;
  flex: 1;
}

.product-name {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  border-top: 1px solid rgba(0,0,0,0.05);
  padding-top: 1rem;
  margin-top: auto;
}

.qty-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.qty-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
}

.qty-value.low { color: var(--warning); }
.qty-value.out { color: var(--danger); }

.detail-btn {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.inventory-card:hover .detail-btn {
  background: var(--primary);
  color: white;
}

/* Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  padding: 1rem;
}

.modal-content {
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
}

.modal-header h2 {
  font-size: 1.4rem;
  color: var(--text-main);
  line-height: 1.4;
}

.btn-close {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  line-height: 1;
  transition: color 0.2s;
}

.btn-close:hover {
  color: var(--danger);
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
}

.detail-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.summary-item {
  background: rgba(59, 130, 246, 0.05);
  padding: 1rem;
  border-radius: 12px;
  flex: 1;
  border: 1px solid rgba(59, 130, 246, 0.1);
}

.summary-item .label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.3rem;
}

.summary-item .value {
  display: block;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-main);
}

.summary-item .value.highlight {
  color: var(--primary);
}

.table-container {
  background: white;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(0,0,0,0.05);
}

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

.detail-table th {
  background: #f8fafc;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid #e2e8f0;
}

.detail-table td {
  padding: 1rem;
  border-bottom: 1px solid #f1f5f9;
  color: var(--text-main);
  font-size: 0.95rem;
}

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

.detail-table tbody tr:hover {
  background: #f8fafc;
}

/* Responsive */
@media (max-width: 768px) {
  .app-container { padding: 1rem; }
  .app-header { padding: 1rem; }
  .header-content { flex-direction: column; align-items: stretch; gap: 1rem; }
  .header-actions { flex-direction: column; width: 100%; gap: 0.8rem; }
  .btn-import, .btn-clear { width: 100%; justify-content: center; }
  .update-time { text-align: center; }
  
  .search-box { flex-direction: column; gap: 0.8rem; padding: 1rem; align-items: stretch; }
  #search-input { padding: 0.5rem 0; font-size: 1rem; text-align: center; }
  .search-icon { margin: 0 auto; display: block; text-align: center; }
  .search-count { align-self: center; }
  
  .inventory-grid { grid-template-columns: 1fr; }
  
  .modal-content { max-width: 95%; max-height: 95vh; }
  .modal-header { padding: 1rem; }
  .modal-body { padding: 1rem; }
  .detail-summary { flex-direction: column; gap: 0.5rem; }
  
  /* Make table responsive on mobile */
  .table-container { overflow-x: auto; }
  .detail-table th, .detail-table td { padding: 0.5rem; font-size: 0.85rem; }
}
