/* Base */
body{
  font-family:'Inter',sans-serif;
  background:linear-gradient(45deg,#22c55e,#60a5fa,#34d399,#1e40af);
  background-size:500%;
  animation:gradient 8s ease infinite;
  min-height:100vh; padding:2rem 0; display:flex; flex-direction:column; align-items:center;
  color:#1f2937; overflow-x:hidden; position:relative;
}
#particles-js{ position:fixed; inset:0; z-index:-1; opacity:.3; }
@keyframes gradient{0%{background-position:0% 50%}50%{background-position:100% 50%}100%{background-position:0% 50%}}
.container{ max-width:80rem; width:95%; position:relative; z-index:1; padding:1.5rem; }

/* Header */
.header{
  text-align:center; margin-bottom:2.5rem; padding:2rem 1.5rem; background:rgba(255,255,255,.9);
  border-radius:1.25rem; border:1px solid rgba(16,185,129,.18); box-shadow:0 10px 30px rgba(0,0,0,.08);
  position:relative; overflow:hidden; animation:fadeInUp .8s ease-out;
}
.logo{
  font-size:3rem; font-weight:800; color:transparent;
  background:linear-gradient(90deg,#1e40af,#10b981,#3b82f6); -webkit-background-clip:text; background-clip:text;
  animation:gradientShift 5s ease-in-out infinite; line-height:1.1;
}
@keyframes gradientShift{0%{background-position:0 50%}50%{background-position:100% 50%}100%{background-position:0 50%}}

/* Cards / Buttons */
.card{
  background:#fff; padding:1.5rem; border-radius:1rem; border:1px solid rgba(16,185,129,.15);
  box-shadow:0 8px 24px rgba(0,0,0,.1); transition:transform .3s, box-shadow .3s; position:relative;
}
.card:hover{ transform:translateY(-5px); box-shadow:0 12px 32px rgba(0,0,0,.12), 0 4px 12px rgba(16,185,129,.2); }

.upload-card{
  background:#fff; padding:2rem; border-radius:1.5rem; border:1px solid rgba(16,185,129,.2);
  box-shadow:0 10px 30px rgba(0,0,0,.1); display:grid; grid-template-columns:1fr; gap:1.25rem;
  position:relative; overflow:hidden;
}

.btn-primary{
  background:linear-gradient(90deg,#2563eb,#10b981); color:#fff; padding:.75rem 1.5rem; border-radius:.6rem; font-weight:600;
  display:inline-flex; align-items:center; gap:.5rem; transition:all .3s; position:relative; overflow:hidden;
}
.btn-primary::before{content:'';position:absolute;inset:0;transform:translateX(-100%);background:linear-gradient(90deg,transparent,rgba(255,255,255,.3),transparent);transition:transform .4s}
.btn-primary:hover::before{transform:translateX(100%)}
.btn-primary:hover{transform:translateY(-1px);box-shadow:0 6px 20px rgba(16,185,129,.3)}
.btn-primary:active{transform:scale(.98)}
.btn-muted{ background:linear-gradient(135deg,#9ca3af,#d1d5db); color:#fff; border:1px solid #9ca3af; }
.btn-primary:focus-visible,.btn-execute:focus-visible{ outline:3px solid rgba(37,99,235,.4); outline-offset:2px; }
.btn-primary[disabled],.btn-execute[disabled]{ opacity:.6; cursor:not-allowed; filter:grayscale(.2); }

/* Dropzone */
.dropzone{
  display:block; border:2px dashed #93c5fd; border-radius:1rem; padding:1.25rem; min-height:280px; cursor:pointer;
  background:linear-gradient(180deg,#fff 0%,#f8fafc 100%); transition:all .25s;
}
.dropzone:hover{ border-color:#10b981; box-shadow:0 6px 22px rgba(16,185,129,.12); transform:translateY(-2px); }
.dropzone.dragover{ border-color:#2563eb; background:linear-gradient(180deg,#eff6ff 0%, #fff 100%); }
.dropzone:focus-visible{ outline:3px dashed #2563eb; outline-offset:4px; }
.dz-inner{ width:100%; height:100%; display:grid; place-items:center; gap:.5rem; }
.dz-title{ font-weight:700; color:#111827; margin:.25rem 0 0; }
.dz-sub{ margin:0; color:#6b7280; font-size:.95rem; }

/* Preview */
.preview-placeholder{ display:flex; flex-direction:column; align-items:center; gap:.35rem; color:#6b7280; text-align:center; }
.preview-img{ display:none; width:100%; max-height:420px; object-fit:contain; background:#fff; border-radius:.75rem; }
.preview-meta{ display:flex; align-items:center; gap:.5rem; margin-top:.25rem; }
.chip{ display:inline-flex; align-items:center; gap:.35rem; padding:.25rem .5rem; border-radius:999px; background:#ecfdf5; color:#065f46; font-weight:600; font-size:.8rem; }

/* Bảng & dashboard */
.materials-section{ background:linear-gradient(135deg,#fff,#f9fafb); border:1px solid #e5e7eb; border-radius:.75rem; padding:1.25rem; margin-bottom:1.5rem; }
.dashboard-table{ width:100%; border-collapse:separate; border-spacing:0 .5rem; margin-top:.75rem; }
.dashboard-table th,.dashboard-table td{ padding:.75rem 1rem; background:#fff; font-size:1rem; font-weight:500; border-left:.5px solid #f1f5f9; border-right:.5px solid #f1f5f9; }
.dashboard-table th{ background:#f1f5f9; color:#1f2937; }
.dashboard-table tr{ transition:transform .2s ease, box-shadow .2s ease; }
.dashboard-table tr:hover td{ box-shadow:0 6px 18px rgba(0,0,0,.06); }
.dashboard-table tr td:first-child{ border-top-left-radius:.6rem; border-bottom-left-radius:.6rem; }
.dashboard-table tr td:last-child{ border-top-right-radius:.6rem; border-bottom-right-radius:.6rem; }
.delete-btn{ color:#ef4444; font-size:1.2rem; cursor:pointer; transition:all .3s; }
.delete-btn:hover{ color:#b91c1c; transform:scale(1.1); }
.quantity-input{ width:5rem; border:1px solid #d1d5db; border-radius:.5rem; padding:.5rem; text-align:center; transition:border-color .2s, box-shadow .2s; }
.quantity-input:focus{ outline:none; border-color:#10b981; box-shadow:0 0 0 3px rgba(16,185,129,.15); }
.quantity-input::-webkit-outer-spin-button,.quantity-input::-webkit-inner-spin-button{ -webkit-appearance: none; margin: 0; }
.filter-group{ display:flex; flex-wrap:wrap; gap:1rem; margin-top:1rem; align-items:center; }
.filter-item{ flex:1; min-width:200px; max-width:260px; }
.filter-select{
  width:100%; padding:.75rem; border-radius:.5rem; border:2px solid #d1d5db; background:linear-gradient(90deg,#f9fafb,#fff);
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%232563eb' stroke-width='2'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right .75rem center; background-size:1.2em;
}
.filter-select:focus{ border-color:#10b981; outline:none; }
.filter-select:hover{ border-color:#93c5fd; }

/* Lưới sản phẩm linh hoạt */
.projects-grid{
  display:grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap:1.25rem;
  margin-top:1.25rem;
}
.projects-grid.single{
  grid-template-columns: minmax(320px, 700px);
  justify-content:center;
}
.project-card{ background:#fff; border-radius:1.2rem; box-shadow:0 10px 30px rgba(0,0,0,.06), 0 4px 8px rgba(0,0,0,.03); overflow:hidden; border:1px solid rgba(16,185,129,.08); }
.project-image{ width:100%; height:200px; object-fit:cover; }
.project-card:hover{ transform: translateY(-4px); box-shadow:0 14px 38px rgba(0,0,0,.08), 0 6px 16px rgba(16,185,129,.12); }
.project-image{ transition: transform .35s ease; }
.project-card:hover .project-image{ transform: scale(1.03); }
.project-details{ padding:1rem; background:linear-gradient(180deg,#fff 0%,#f9fafb 100%); }
.project-title{ font-size:1.2rem; font-weight:800; color:#1e293b; margin-bottom:.5rem; text-transform:uppercase; letter-spacing:.3px; }
.meta-item{ background:#f1f5f9; padding:.35rem .6rem; border-radius:.6rem; font-size:.8rem; color:#64748b; }
.project-buttons{ display:flex; gap:.75rem; margin-top:.9rem; }
.btn-execute{ background:linear-gradient(90deg,#3b82f6,#10b981); color:#fff; padding:.6rem 1rem; border-radius:.6rem; font-weight:700; display:flex; gap:.5rem; justify-content:center; flex:1; transition: transform .2s ease, box-shadow .2s ease; }
.btn-execute:hover{ transform: translateY(-1px); box-shadow:0 8px 22px rgba(59,130,246,.25); }
.btn-execute:active{ transform: translateY(0); }
.score-badge{ display:inline-flex; align-items:center; gap:.35rem; padding:.25rem .5rem; border-radius:999px; background:#ecfeff; color:#0e7490; font-size:.8rem; border:1px solid #a5f3fc; }

.suggestion-message{ background:#fef3c7; color:#92400e; padding:1rem; border-radius:.6rem; margin-top:1rem; border-left:3px solid #f59e0b; display:flex; align-items:center; gap:.5rem; }
.upload-success{ background:#d1fae5; color:#065f46; padding:.75rem; border-radius:.5rem; margin-top:.5rem; display:flex; gap:.5rem; }
.error-message{ color:#b91c1c; padding:.75rem; border-radius:.5rem; background:#fee2e2; margin-top:.75rem; }

/* Smooth expand/collapse for add materials section */
#addMaterialsSection{ will-change: max-height; transition:max-height .4s ease, opacity .3s ease; opacity:0; }
#addMaterialsSection.sliding{ opacity:1; }

/* Enhanced loading states */
.loading-overlay{ 
  position:absolute; inset:0; background:rgba(0,0,0,.2); backdrop-filter:blur(4px); 
  border-radius:1rem; display:flex; align-items:center; justify-content:center; 
  z-index:1000; flex-direction:column; gap:1rem; color:#fff; 
  animation: fadeInOverlay 0.3s ease-out;
}
.loading-image{ 
  width:80px; height:80px; object-fit:cover; 
  animation:shake .5s ease-in-out infinite; 
  filter: drop-shadow(0 4px 8px rgba(0,0,0,.3));
}
.progress-bar{ 
  width:16rem; height:1.2rem; background:rgba(255,255,255,.2); 
  border-radius:.5rem; overflow:hidden; border:1px solid rgba(255,255,255,.3);
  box-shadow: inset 0 2px 4px rgba(0,0,0,.1);
}
.progress{ 
  width:0; height:100%; 
  background:linear-gradient(90deg,#10b981,#2563eb,#22c55e); 
  background-size: 200% 100%;
  transition:width .3s ease; 
  animation: progressShimmer 2s ease-in-out infinite;
  border-radius: .5rem;
}
.loading-text {
  font-size: 1.1rem;
  font-weight: 600;
  text-shadow: 0 2px 4px rgba(0,0,0,.3);
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes fadeInOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes progressShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}

/* Headings */
h1{ font-size:2.8rem; color:#1e40af; font-weight:800; margin-bottom:.5rem; }
h2{ font-size:1.8rem; color:#1f2937; font-weight:800; margin:0; }

/* Responsive tweaks */
@media (max-width:768px){
  .container{ width:98%; padding:.75rem; }
  .dashboard-table{ display:block; overflow-x:auto; white-space:nowrap; }
  .project-image{ height:180px; }
}
@media (max-width:480px){
  .container{ width:100%; padding:.5rem; }
  .project-image{ height:150px; }
}
@media (prefers-reduced-motion:reduce){
  *{animation-duration:.01ms !important; animation-iteration-count:1 !important; transition-duration:.01ms !important;}
}
/* Icon Greenie dùng chung */
.greenie-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  display: inline-block;
  vertical-align: middle;
}

/* Căn icon và chữ trong tips + gợi ý */
.tips, .suggestion-message {
  align-items: center;
  gap: .5rem;
}
