body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

code {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
    monospace;
}

.navigation-container {
  position: fixed;
  top: 20px;
  left: 0;
  right: 0;
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  transition: all 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

.navigation-container.transitioning {
  opacity: 0.8;
  transform: scale(0.98);
}

.navigation-container.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-100%);
}

.navigation-container.hidden .nav-arrow {
  transform: translateY(-100px);
  opacity: 0;
}

/* Arrow Navigation */
.nav-arrow {
  position: fixed;
  top: 20px;
  transform: translateY(0);
  width: 60px;
  height: 60px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  z-index: 1000;
  -webkit-user-select: none;
          user-select: none;
}

.nav-arrow:hover {
  transform: translateY(0) scale(1.1);
  box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
}

.nav-arrow:active {
  transform: translateY(0) scale(0.95);
}

.nav-arrow[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  transform: translateY(0) scale(0.9);
}

.nav-arrow-left {
  left: 20px;
}

.nav-arrow-right {
  right: 20px;
}

.arrow-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
}

.nav-arrow:hover .arrow-inner {
  transform: scale(1.2);
}

.arrow-icon {
  font-size: 20px;
  color: white;
  font-weight: bold;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

/* Tooltip styles */
.nav-arrow[title]:hover::after {
  content: attr(title);
  position: absolute;
  bottom: -45px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  white-space: nowrap;
  z-index: 1001;
  animation: tooltipFadeIn 0.3s ease;
}

.nav-arrow[title]:hover::before {
  content: '';
  position: absolute;
  bottom: -35px;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-bottom-color: rgba(0, 0, 0, 0.8);
  z-index: 1001;
}

@keyframes tooltipFadeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(5px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}



/* Enhanced transition effects for arrows */
.navigation-container.transitioning .nav-arrow {
  animation: transitionPulse 1s ease-in-out;
  pointer-events: none;
}

.navigation-container.transitioning .nav-arrow-left {
  animation: transitionSlideLeft 1s cubic-bezier(0.23, 1, 0.32, 1);
}

.navigation-container.transitioning .nav-arrow-right {
  animation: transitionSlideRight 1s cubic-bezier(0.23, 1, 0.32, 1);
}

@keyframes transitionPulse {
  0%, 100% {
    transform: translateY(-50%) scale(1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
  }
  25% {
    transform: translateY(-50%) scale(1.1);
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.7);
  }
  50% {
    transform: translateY(-50%) scale(0.95);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.2);
  }
  75% {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.5);
  }
}

@keyframes transitionSlideLeft {
  0% {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
  }
  25% {
    transform: translateY(-50%) translateX(-10px) scale(1.1);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-50%) translateX(-5px) scale(0.95);
    opacity: 0.6;
  }
  75% {
    transform: translateY(-50%) translateX(5px) scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
  }
}

@keyframes transitionSlideRight {
  0% {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
  }
  25% {
    transform: translateY(-50%) translateX(10px) scale(1.1);
    opacity: 0.8;
  }
  50% {
    transform: translateY(-50%) translateX(5px) scale(0.95);
    opacity: 0.6;
  }
  75% {
    transform: translateY(-50%) translateX(-5px) scale(1.05);
    opacity: 0.8;
  }
  100% {
    transform: translateY(-50%) translateX(0);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 768px) {
  .nav-arrow {
    width: 50px;
    height: 50px;
  }

  .nav-arrow-left {
    left: 15px;
  }

  .nav-arrow-right {
    right: 15px;
  }

  .arrow-icon {
    font-size: 16px;
  }
}

@media (max-width: 480px) {
  .nav-arrow {
    width: 45px;
    height: 45px;
  }

  .nav-arrow-left {
    left: 10px;
  }

  .nav-arrow-right {
    right: 10px;
  }

  .arrow-icon {
    font-size: 14px;
  }
}

.about-me-container {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 40px 20px;
  margin-top: 60px;
  position: relative;
  overflow: hidden;
}

.about-me-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: url("data:image/svg+xml,<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 100\"><defs><pattern id=\"grain\" width=\"100\" height=\"100\" patternUnits=\"userSpaceOnUse\"><circle cx=\"25\" cy=\"25\" r=\"1\" fill=\"rgba%28255,255,255,0.1%29\"/><circle cx=\"75\" cy=\"75\" r=\"1\" fill=\"rgba%28255,255,255,0.1%29\"/><circle cx=\"50\" cy=\"10\" r=\"0.5\" fill=\"rgba%28255,255,255,0.05%29\"/><circle cx=\"10\" cy=\"60\" r=\"0.5\" fill=\"rgba%28255,255,255,0.05%29\"/><circle cx=\"90\" cy=\"40\" r=\"0.5\" fill=\"rgba%28255,255,255,0.05%29\"/></pattern></defs><rect width=\"100\" height=\"100\" fill=\"url%28%23grain%29\"/></svg>");
  pointer-events: none;
}

.about-me-content {
  max-width: 600px;
  margin: 0 auto;
  text-align: center;
  position: relative;
  z-index: 1;
}

/* Avatar Section */
.avatar-section {
  margin-bottom: 40px;
}

.avatar-circle {
  width: 120px;
  height: 120px;
  margin: 0 auto 20px;
  position: relative;
  border-radius: 50%;
  background: linear-gradient(45deg, #ff6b6b, #4ecdc4, #45b7d1, #96ceb4);
  background-size: 400% 400%;
  animation: gradientShift 3s ease infinite;
  padding: 4px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

@keyframes gradientShift {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

.avatar-image {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
  background: #f0f0f0;
  border: 3px solid white;
  transition: transform 0.3s ease;
}

.avatar-circle:hover .avatar-image {
  transform: scale(1.05);
}

.developer-name {
  color: white;
  font-size: 28px;
  font-weight: bold;
  margin: 0 0 8px 0;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.developer-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 16px;
  margin: 0;
  font-weight: 300;
}

/* Portfolio Section */
.portfolio-section {
  margin-bottom: 40px;
}

.portfolio-title {
  color: white;
  font-size: 22px;
  font-weight: bold;
  margin: 0 0 25px 0;
  text-align: center;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-gap: 20px;
  gap: 20px;
  margin-bottom: 30px;
}

.portfolio-item {
  position: relative;
  border-radius: 15px;
  overflow: hidden;
  background: white;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
  cursor: pointer;
}

.portfolio-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.3);
}

.portfolio-image {
  width: 100%;
  height: 150px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-image {
  transform: scale(1.05);
}

.portfolio-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  color: white;
  padding: 20px 15px 15px;
  transform: translateY(100%);
  transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-overlay {
  transform: translateY(0);
}

.portfolio-overlay h5 {
  margin: 0 0 5px 0;
  font-size: 16px;
  font-weight: bold;
}

.portfolio-overlay p {
  margin: 0;
  font-size: 12px;
  opacity: 0.9;
}

/* Contact Section */
.contact-section {
  margin-bottom: 40px;
}

.contact-message {
  color: white;
  font-size: 18px;
  margin-bottom: 25px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.contact-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.zalo-button, .email-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border: none;
  border-radius: 25px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.zalo-button {
  background: linear-gradient(45deg, #0068ff, #0084ff);
  color: white;
}

.zalo-button:hover {
  background: linear-gradient(45deg, #0056d6, #006dd6);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.email-button {
  background: linear-gradient(45deg, #ff6b6b, #ee5a52);
  color: white;
}

.email-button:hover {
  background: linear-gradient(45deg, #ee5a52, #dc4c41);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.zalo-icon, .email-icon {
  font-size: 18px;
}

/* QR Section */
.qr-section {
  margin-top: 25px;
  animation: slideDown 0.3s ease;
}

/* Email Section */
.email-section {
  margin-top: 25px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.qr-container, .email-container {
  background: white;
  border-radius: 15px;
  padding: 20px;
  margin: 0 auto 15px;
  max-width: 300px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.qr-image {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.qr-placeholder {
  text-align: center;
}

.qr-mock {
  width: 160px;
  height: 160px;
  background: #f0f0f0;
  border: 2px solid #ddd;
  border-radius: 8px;
  margin: 0 auto 10px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-pattern {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  bottom: 10px;
  background: repeating-linear-gradient(
    0deg,
    #333 0px,
    #333 2px,
    transparent 2px,
    transparent 4px
  ),
  repeating-linear-gradient(
    90deg,
    #333 0px,
    #333 2px,
    transparent 2px,
    transparent 4px
  );
  opacity: 0.3;
}

.qr-center {
  background: white;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  z-index: 1;
}

.qr-instruction, .email-instruction {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  margin: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

/* Email Display */
.email-display {
  display: flex;
  align-items: center;
  gap: 15px;
  text-align: left;
}

.email-icon-large {
  font-size: 32px;
  flex-shrink: 0;
}

.email-info {
  flex: 1 1;
}

.email-info h5 {
  margin: 0 0 8px 0;
  font-size: 16px;
  font-weight: bold;
  color: #333;
}

.email-address {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: #666;
  font-family: monospace;
  background: #f8f9fa;
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #e9ecef;
}

.copy-email-btn {
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
}

.copy-email-btn:hover {
  background: linear-gradient(45deg, #218838, #1ea080);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

/* Copyright Section */
.copyright-section {
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  padding-top: 30px;
}

.copyright-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, transparent, white, transparent);
  margin: 0 auto 20px;
}

.copyright-text {
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  margin: 0 0 8px 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.copyright-subtitle {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  margin: 0;
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .about-me-container {
    padding: 30px 15px;
    margin-top: 40px;
  }

  .avatar-circle {
    width: 100px;
    height: 100px;
  }

  .developer-name {
    font-size: 24px;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .portfolio-item {
    max-width: 300px;
    margin: 0 auto;
  }

  .portfolio-title {
    font-size: 20px;
  }

  .contact-buttons {
    flex-direction: column;
    align-items: center;
  }

  .zalo-button, .email-button {
    width: 200px;
    justify-content: center;
  }
}

.homepage {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 20px;
}

.homepage-container {
  max-width: 1200px;
  margin: 0 auto;
}

/* Header */
.homepage-header {
  text-align: center;
  margin-bottom: 60px;
  padding: 40px 0;
}

.homepage-title {
  font-size: 3.5rem;
  font-weight: 800;
  color: white;
  margin: 0 0 15px 0;
  text-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

.homepage-subtitle {
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 0 0 20px 0;
  font-weight: 400;
}

.homepage-domain {
  display: inline-block;
  background: rgba(255, 255, 255, 0.2);
  padding: 8px 20px;
  border-radius: 25px;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.homepage-domain span {
  color: white;
  font-weight: 600;
  font-size: 1.1rem;
}

/* Announcements */
.announcements-section {
  margin-bottom: 60px;
}

.announcements-section h2 {
  color: white;
  font-size: 2rem;
  margin-bottom: 30px;
  text-align: center;
  font-weight: 700;
}

.announcements-list {
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 800px;
  margin: 0 auto;
}

.announcement-item {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 15px;
  padding: 25px;
  display: flex;
  align-items: flex-start;
  gap: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

.announcement-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
}

.announcement-icon {
  font-size: 2.5rem;
  flex-shrink: 0;
}

.announcement-content h3 {
  color: #2c3e50;
  font-size: 1.3rem;
  margin: 0 0 10px 0;
  font-weight: 700;
}

.announcement-content p {
  color: #5a6c7d;
  line-height: 1.6;
  margin: 0 0 10px 0;
}

.announcement-date {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 4px 12px;
  border-radius: 15px;
  font-size: 0.85rem;
  font-weight: 600;
}

/* Tools Section */
.tools-section h2 {
  color: white;
  font-size: 2rem;
  margin-bottom: 40px;
  text-align: center;
  font-weight: 700;
}

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  grid-gap: 30px;
  gap: 30px;
  margin-bottom: 60px;
}

.tool-card {
  background: rgba(255, 255, 255, 0.95);
  border-radius: 20px;
  padding: 30px;
  display: flex;
  align-items: center;
  gap: 20px;
  text-decoration: none;
  color: inherit;
  transition: all 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}

.tool-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.2);
}

.tool-card.coming-soon {
  opacity: 0.7;
  cursor: not-allowed;
}

.tool-card.coming-soon:hover {
  transform: none;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.tool-icon {
  font-size: 3rem;
  flex-shrink: 0;
}

.tool-content {
  flex: 1 1;
}

.tool-content h3 {
  color: #2c3e50;
  font-size: 1.5rem;
  margin: 0 0 10px 0;
  font-weight: 700;
}

.tool-content p {
  color: #5a6c7d;
  line-height: 1.6;
  margin: 0 0 15px 0;
}

.tool-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.feature-tag {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.tool-arrow {
  font-size: 1.5rem;
  color: #667eea;
  font-weight: bold;
  flex-shrink: 0;
}

.tool-status {
  position: absolute;
  top: 15px;
  right: 15px;
  background: #f39c12;
  color: white;
  padding: 5px 12px;
  border-radius: 15px;
  font-size: 0.8rem;
  font-weight: 600;
}

/* Footer */
.homepage-footer {
  text-align: center;
  padding: 40px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.2);
}

.footer-content p {
  color: rgba(255, 255, 255, 0.8);
  margin: 0 0 10px 0;
}

.footer-links {
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
}

.footer-links span {
  margin: 0 8px;
}

/* Responsive */
@media (max-width: 768px) {
  .homepage-title {
    font-size: 2.5rem;
  }
  
  .homepage-subtitle {
    font-size: 1.1rem;
  }
  
  .tools-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .tool-card {
    padding: 20px;
    flex-direction: column;
    text-align: center;
  }
  
  .announcement-item {
    flex-direction: column;
    text-align: center;
  }
}

.part-slot-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: white;
  border-radius: 8px;
  padding: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  min-width: 0; /* Cho phép shrink */
  overflow: hidden; /* Tránh tràn */
}

.part-slot-container:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

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

.slot-label {
  font-weight: 600;
  color: #2d3748;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.slot-id {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
}

.slot-id.demo-id {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  animation: pulse-demo 2s infinite;
}

@keyframes pulse-demo {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.part-slot {
  border: 2px dashed #cbd5e0;
  border-radius: 6px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: #f7fafc;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.part-slot:hover {
  border-color: #667eea;
  background: #edf2f7;
}

.slot-active {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.1);
  transform: scale(1.02);
}

.slot-reject {
  border-color: #e53e3e;
  background: rgba(229, 62, 62, 0.1);
}

.slot-has-image {
  padding: 0;
  border: 2px solid #48bb78;
  background: transparent;
}

.slot-has-demo {
  border: 2px dashed #667eea;
  background: rgba(102, 126, 234, 0.05);
}

.slot-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.slot-icon {
  font-size: 24px;
  opacity: 0.6;
}

.slot-text {
  margin: 0;
  font-size: 11px;
  color: #718096;
  font-weight: 500;
  text-align: center;
  line-height: 1.3;
}

.slot-image-preview {
  position: relative;
  width: 100%;
  height: 100px;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.slot-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: white;
}

.slot-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.slot-image-preview:hover .slot-overlay {
  opacity: 1;
}

.slot-overlay p {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  text-align: center;
  padding: 8px;
}

.coordinate-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.coordinate-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1 1;
}

.coordinate-group label {
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  min-width: 12px;
}

.coordinate-input {
  flex: 1 1;
  padding: 4px 6px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 11px;
  text-align: center;
  background: white;
  transition: border-color 0.2s ease;
}

.coordinate-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

/* Responsive */
@media (max-width: 768px) {
  .part-slot-container {
    padding: 8px;
  }

  .part-slot {
    min-height: 80px;
    padding: 10px;
  }

  .slot-image-preview {
    height: 80px;
  }

  .coordinate-controls {
    flex-direction: column;
    gap: 4px;
  }

  .coordinate-group {
    justify-content: space-between;
  }

  .slot-label {
    font-size: 11px;
  }

  .slot-id {
    font-size: 9px;
    padding: 1px 4px;
  }
}

.bulk-dropzone-container {
  margin-bottom: 24px;
}

.bulk-dropzone {
  border: 3px dashed #e2e8f0;
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  position: relative;
  overflow: hidden;
}

.bulk-dropzone::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, transparent 30%, rgba(102, 126, 234, 0.05) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.6s ease;
}

.bulk-dropzone:hover::before {
  transform: translateX(100%);
}

.bulk-dropzone:hover {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%);
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.15);
}

.bulk-dropzone.bulk-active {
  border-color: #38a169;
  background: linear-gradient(135deg, #f0fff4 0%, #e6fffa 100%);
  transform: scale(1.02);
  box-shadow: 0 12px 30px rgba(56, 161, 105, 0.2);
}

.bulk-dropzone.bulk-reject {
  border-color: #e53e3e;
  background: linear-gradient(135deg, #fff5f5 0%, #fed7d7 100%);
  animation: shake 0.5s ease-in-out;
}

.bulk-dropzone.bulk-loading {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0f4ff 0%, #e6f0ff 100%);
  cursor: not-allowed;
  opacity: 0.8;
}

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

.bulk-dropzone-content {
  position: relative;
  z-index: 1;
}

.bulk-dropzone-icon {
  font-size: 48px;
  margin-bottom: 16px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0px); }
  50% { transform: translateY(-10px); }
}

.bulk-dropzone-title {
  margin: 0 0 12px 0;
  color: #2d3748;
  font-size: 1.4rem;
  font-weight: 700;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.bulk-dropzone-text {
  margin: 0 0 24px 0;
  color: #4a5568;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
}



.bulk-dropzone-hint {
  margin: 0;
  color: #718096;
  font-size: 0.875rem;
  font-style: italic;
}

/* Loading animation */
.bulk-loading .bulk-dropzone-icon {
  animation: spin 2s linear infinite;
}

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

/* Responsive */
@media (max-width: 768px) {
  .bulk-dropzone {
    padding: 24px 16px;
  }

  .bulk-dropzone-title {
    font-size: 1.2rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .bulk-dropzone {
    background: linear-gradient(135deg, #1a202c 0%, #2d3748 100%);
    border-color: #4a5568;
  }

  .bulk-dropzone-title {
    color: #e2e8f0;
  }

  .bulk-dropzone-text {
    color: #a0aec0;
  }
}

.animated-preview {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
  border: 1px solid #e2e8f0;
  margin-bottom: 20px;
}

.preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid #e2e8f0;
}

.preview-header h3 {
  margin: 0;
  color: #2d3748;
  font-size: 1.3rem;
  font-weight: 600;
}

.preview-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.frame-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.action-controls {
  display: flex;
  align-items: center;
}

.part-filters {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #f7fafc;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.filter-label {
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  margin-right: 4px;
}

.filter-option {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

.filter-option:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #667eea;
}

.filter-option input[type="checkbox"] {
  margin: 0;
  transform: scale(0.9);
}

.filter-separator {
  color: #cbd5e0;
  font-weight: 300;
  margin: 0 4px;
  font-size: 12px;
}

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

.btn-frame-nav {
  background: linear-gradient(135deg, #38a169 0%, #68d391 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 70px;
}

.btn-frame-nav:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 161, 105, 0.3);
}

.btn-frame-nav:active {
  transform: translateY(0);
}

.action-select {
  padding: 6px 12px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  background: white;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.2s ease;
  min-width: 200px;
}

.action-select:focus {
  outline: none;
  border-color: #667eea;
}

.btn-animate {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-animate:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-animate.active {
  background: linear-gradient(135deg, #e53e3e 0%, #ff6b6b 100%);
  animation: pulse-animate 1s infinite;
}

@keyframes pulse-animate {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.8; }
}

.frame-counter {
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
  background: #f7fafc;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #e2e8f0;
}

.action-name {
  font-size: 12px;
  font-weight: 600;
  color: #2d3748;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 4px 12px;
  border-radius: 4px;
  border: 1px solid #667eea;
}

/* Layout mới với banner fill hết space còn lại */
.preview-main-container {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}

.canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex: 0 0 auto; /* Không co giãn, giữ nguyên size */
  width: 420px; /* Fixed width cho canvas container */
  max-width: 100%; /* Responsive cho mobile */
}

.affected-canvas-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  flex: 1 1; /* Fill hết space còn lại */
  min-width: 400px; /* Minimum width để đảm bảo không quá nhỏ */
}

.preview-canvas {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  background: #f8f9fa;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  cursor: crosshair;
  transition: all 0.3s ease;

  /* ===== MOBILE TOUCH OPTIMIZATION ===== */
  touch-action: none; /* Disable browser touch gestures */
  user-select: none;  /* Disable text selection */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  -webkit-touch-callout: none; /* Disable iOS callout */
  -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
}

.preview-canvas:hover {
  border-color: #667eea;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05), 0 0 12px rgba(102, 126, 234, 0.2);
}

.canvas-info {
  display: flex;
  gap: 20px;
  padding: 12px 20px;
  background: #f7fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  text-align: center;
}

.canvas-info p {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  color: #4a5568;
}

/* Drag and drop states */
.preview-canvas.dragging {
  cursor: grabbing;
  border-color: #38a169;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05), 0 0 16px rgba(56, 161, 105, 0.3);
}

.preview-canvas.drag-over {
  border-color: #667eea;
  background: rgba(102, 126, 234, 0.05);
}

/* Animation effects */
.animated-preview.animating {
  border-color: #667eea;
}

.animated-preview.animating .preview-canvas {
  animation: canvas-glow 2s infinite;
}

@keyframes canvas-glow {
  0%, 100% {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05);
  }
  50% {
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05), 0 0 20px rgba(102, 126, 234, 0.4);
  }
}

/* Responsive cho layout mới */
@media (max-width: 1200px) {
  .preview-main-container {
    flex-direction: column;
    gap: 16px;
  }

  .canvas-container,
  .affected-canvas-container {
    width: 100%;
    min-width: auto;
  }
}

@media (max-width: 768px) {
  .canvas-container,
  .affected-canvas-container {
    width: 100%;
    min-width: auto;
  }

  .affected-canvas-container {
    min-width: 300px; /* Minimum cho mobile */
  }
}

/* ===== MOBILE TOUCH STATES ===== */
.preview-canvas.touch-active {
  border-color: #38a169 !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05), 0 0 16px rgba(56, 161, 105, 0.4) !important;
  transform: scale(1.005);
  transition: all 0.1s ease;
}

.preview-canvas.touch-dragging {
  cursor: grabbing !important;
  border-color: #667eea !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.05), 0 0 20px rgba(102, 126, 234, 0.5) !important;
  transform: scale(1.01);
  transition: all 0.1s ease;
}

/* ===== MOBILE SPECIFIC IMPROVEMENTS ===== */
@media (max-width: 768px) {
  .preview-canvas.touch-active {
    transform: scale(1.02);
    border-width: 3px;
  }

  .preview-canvas.touch-dragging {
    transform: scale(1.03);
    border-width: 3px;
  }
}

/* ===== MOBILE NOTIFICATION SYSTEM ===== */
.mobile-notification {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  font-size: 14px;
  font-weight: 500;
  max-width: 90vw;
  animation: slideInDown 0.3s ease-out;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.mobile-notification.success {
  background: linear-gradient(135deg, #10b981, #059669);
  color: white;
}

.mobile-notification.error {
  background: linear-gradient(135deg, #ef4444, #dc2626);
  color: white;
}

.mobile-notification.info {
  background: linear-gradient(135deg, #3b82f6, #2563eb);
  color: white;
}

.notification-message {
  flex: 1 1;
  line-height: 1.4;
}

.notification-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

.notification-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.notification-close:active {
  transform: scale(0.95);
}

@keyframes slideInDown {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* ===== MOBILE RESPONSIVE IMPROVEMENTS ===== */
/* Note: Disabled when REACT_APP_FORCE_DESKTOP_VIEW=true via CSS custom property */
@media (max-width: 768px) {
  .animated-preview:not([style*="--force-desktop"]) {
    padding: 12px;
    margin-bottom: 16px;
    /* ===== MOBILE LAYOUT: FLEX CONTAINER ===== */
    display: flex;
    flex-direction: column;
  }

  .animated-preview:not([style*="--force-desktop"]) .preview-header {
    flex-direction: column;
    gap: 12px;
    text-align: center;
    margin-bottom: 16px;
    /* ===== MOBILE: HEADER FIRST ===== */
    order: 1;
  }

  .preview-controls {
    flex-direction: column;
    gap: 12px;
    align-items: center;
  }

  .frame-controls {
    order: 2;
  }

  .action-controls {
    order: 1;
  }

  .info-display {
    order: 3;
    flex-direction: column;
    gap: 8px;
  }

  .action-select {
    min-width: 280px;
    font-size: 12px;
    padding: 8px 12px;
  }

  .btn-frame-nav {
    min-width: 70px;
    font-size: 11px;
    padding: 8px 12px;
    /* ===== MOBILE TOUCH TARGETS ===== */
    min-height: 44px; /* iOS recommended touch target */
  }

  .btn-animate {
    min-height: 44px; /* iOS recommended touch target */
    padding: 10px 16px;
    font-size: 13px;
  }

  /* ===== MOBILE: MAIN CONTAINER ORDER ===== */
  .preview-main-container {
    order: 4;
  }

  /* ===== CANVAS MOBILE OPTIMIZATION ===== */
  .preview-canvas {
    /* ===== REMOVE FORCED SIZING - LET JS HANDLE IT ===== */
    max-width: 100% !important;
    /* ===== MOBILE CURSOR ===== */
    cursor: pointer;
    /* ===== ENSURE NO CROPPING ===== */
    object-fit: contain;
    display: block;
    margin: 0 auto;
  }

  .canvas-info {
    flex-direction: column;
    gap: 6px;
    padding: 10px 16px;
  }

  .canvas-info p {
    font-size: 11px;
  }

  /* ===== ARROW CONTROLS MOBILE ===== */
  .arrow-controls-container {
    /* ===== MOBILE: ARROW CONTROLS SECOND (AFTER HEADER) ===== */
    order: 2;
    margin-top: 0;
    margin-bottom: 16px;
  }

  .arrow-controls {
    min-width: 200px;
    padding: 16px;
  }

  .arrow-btn {
    width: 44px;  /* iOS recommended touch target */
    height: 44px; /* iOS recommended touch target */
    font-size: 16px;
    /* ===== MOBILE TOUCH FEEDBACK ===== */
    transition: all 0.1s ease;
  }

  .arrow-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
  }

  /* ===== PART FILTERS MOBILE ===== */
  .part-filters {
    flex-wrap: wrap;
    justify-content: center;
    padding: 8px 12px;
  }

  .filter-option {
    padding: 6px 10px;
    font-size: 12px;
    /* ===== MOBILE TOUCH TARGETS ===== */
    min-height: 36px;
    display: flex;
    align-items: center;
  }

  .filter-option input[type="checkbox"] {
    transform: scale(1.2); /* Larger checkboxes for mobile */
  }
}

/* ===== EXTRA SMALL MOBILE (iPhone SE, etc.) ===== */
@media (max-width: 480px) {
  .animated-preview {
    padding: 8px;
  }

  .preview-canvas {
    width: 100%;
    max-width: 350px;
    height: auto;
    min-height: 350px;
  }

  .canvas-container {
    width: 100%;
    padding: 0 8px; /* Add padding cho mobile */
    /* ===== ENSURE NO OVERFLOW ===== */
    overflow: visible;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  .action-select {
    min-width: 100%;
    font-size: 11px;
  }

  .btn-frame-nav {
    min-width: 60px;
    font-size: 10px;
    padding: 6px 8px;
  }

  .arrow-controls {
    min-width: 180px;
    padding: 12px;
  }

  .arrow-btn {
    width: 40px;
    height: 40px;
    font-size: 14px;
  }
}

/* Part highlighting */
.part-highlight {
  position: absolute;
  border: 2px solid #ffd700;
  background: rgba(255, 215, 0, 0.2);
  pointer-events: none;
  border-radius: 4px;
  animation: highlight-pulse 1s infinite;
}

@keyframes highlight-pulse {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 0.4; }
}

/* Image Editor Modal */
.image-editor-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 99999; /* Tăng z-index để đảm bảo hiển thị trên cùng */
  pointer-events: auto; /* Đảm bảo có thể click */
}

/* Context Menu */
.context-menu {
  position: fixed !important;
  z-index: 999999 !important;
  background: white;
  border: 1px solid #ccc;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  padding: 8px 0;
  min-width: 160px;
  max-width: 200px;
}

.context-menu-item {
  padding: 8px 16px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 0.2s;
}

.context-menu-item:hover {
  background-color: #f5f5f5;
}

.image-editor-content {
  background: white;
  border-radius: 12px;
  padding: 20px;
  max-width: 90%;
  max-height: 90%;
  overflow: auto;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.image-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
  padding-bottom: 10px;
}

.image-editor-header h3 {
  margin: 0;
  color: #2d3748;
}

.close-btn {
  background: #e53e3e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 30px;
  height: 30px;
  cursor: pointer;
  font-size: 16px;
}

.close-btn:hover {
  background: #c53030;
}

.image-editor-body {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.image-preview-section {
  flex: 1 1;
  min-width: 300px;
  text-align: center;
}

.editing-image {
  max-width: 100%;
  max-height: 400px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
}

.image-tools-section {
  flex: 1 1;
  min-width: 300px;
}

.tool-group {
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f7fafc;
}

.tool-group h4 {
  margin: 0 0 10px 0;
  color: #2d3748;
}

.resize-controls, .crop-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.resize-controls label, .crop-controls label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: #4a5568;
}

.resize-controls input, .crop-controls input {
  width: 80px;
  padding: 5px;
  border: 1px solid #cbd5e0;
  border-radius: 4px;
  font-size: 14px;
}

.btn-tool, .btn-upload {
  background: #667eea;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  margin-top: 10px;
}

.btn-tool:hover, .btn-upload:hover {
  background: #5a67d8;
}

.btn-upload {
  background: #48bb78;
  width: 100%;
  padding: 12px;
  font-size: 16px;
}

.btn-upload:hover {
  background: #38a169;
}

@media (max-width: 768px) {
  .image-editor-content {
    max-width: 95%;
    max-height: 95%;
    padding: 15px;
  }

  .image-editor-body {
    flex-direction: column;
  }

  .image-preview-section, .image-tools-section {
    min-width: auto;
  }

  .resize-controls, .crop-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .resize-controls label, .crop-controls label {
    flex-direction: row;
    justify-content: space-between;
  }
}

/* Arrow Controls Container */
.arrow-controls-container {
  display: flex;
  justify-content: center;
  margin-top: 20px;
  margin-bottom: 20px;
}

.arrow-controls {
  padding: 16px;
  background: white;
  border-radius: 12px;
  border: 2px solid #667eea;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.15);
  min-width: 200px;
  text-align: center;
}

.selected-part-info {
  margin-bottom: 8px;
}

.selected-part-info span {
  font-weight: 600;
  color: #667eea;
  font-size: 12px;
}

.arrow-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 8px 0;
}

.arrow-row {
  display: flex;
  gap: 4px;
  align-items: center;
}

.arrow-btn {
  width: 32px;
  height: 32px;
  border: 2px solid #e2e8f0;
  border-radius: 6px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-user-select: none;
          user-select: none;
}

.arrow-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  border-color: #667eea;
}

.arrow-btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.coordinate-display {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
  padding: 6px 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
}

.coordinate-display span {
  font-size: 11px;
  font-weight: 600;
  color: #4a5568;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
}

/* Controls Bottom Section */
.preview-controls-bottom {
  margin-top: 20px;
  padding: 16px;
  background: #f8f9fa;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.preview-controls-bottom .preview-controls {
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
}

/* Responsive cho controls bottom */
@media (max-width: 768px) {
  .preview-controls-bottom {
    /* ===== MOBILE: FRAME CONTROLS THIRD ===== */
    order: 3;
    margin-top: 0;
    margin-bottom: 16px;
    padding: 12px;
  }

  .preview-controls-bottom .preview-controls {
    flex-direction: column;
    align-items: center;
    gap: 12px;
  }

  .preview-controls-bottom .frame-controls {
    order: 1;
  }

  .preview-controls-bottom .action-controls {
    order: 2;
  }

  .preview-controls-bottom .part-filters {
    order: 3;
    flex-wrap: wrap;
    justify-content: center;
  }

  .preview-controls-bottom .info-display {
    order: 4;
    flex-direction: column;
    gap: 8px;
  }

  /* ===== MOBILE NOTIFICATION ADJUSTMENTS ===== */
  .mobile-notification {
    top: 10px;
    padding: 10px 14px;
    font-size: 13px;
    max-width: 95vw;
    border-radius: 6px;
  }

  .notification-close {
    width: 22px;
    height: 22px;
    font-size: 11px;
  }
}

.guide-full-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  animation: slideInFromRight 0.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  overflow: hidden;
}

.guide-panel-header {
  background: rgba(255, 255, 255, 0.1);
  padding: 30px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.guide-panel-header h2 {
  color: white;
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.guide-panel-close {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 32px;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.guide-panel-close:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg) scale(1.1);
}

.guide-panel-body {
  flex: 1 1;
  padding: 40px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.95);
  color: #333;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.guide-panel-body::-webkit-scrollbar {
  width: 12px;
}

.guide-panel-body::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 6px;
}

.guide-panel-body::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #667eea, #764ba2);
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.guide-panel-body::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #5a6fd8, #6a42a0);
}

.guide-section {
  margin-bottom: 35px;
}

.guide-section h3 {
  color: #4a5568;
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 20px;
  padding-bottom: 10px;
  border-bottom: 2px solid #e2e8f0;
}

.guide-steps {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.guide-step {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 20px;
  background: linear-gradient(135deg, #f7fafc, #edf2f7);
  border-radius: 15px;
  border-left: 5px solid #667eea;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.guide-step:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.step-number {
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 18px;
  flex-shrink: 0;
}

.step-content h4 {
  color: #2d3748;
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 8px 0;
}

.step-content p {
  color: #4a5568;
  margin: 0;
  line-height: 1.6;
}

.guide-controls, .guide-tips, .guide-warnings {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.control-item, .tip-item, .warning-item {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 15px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease;
}

.control-item:hover, .tip-item:hover, .warning-item:hover {
  transform: translateX(5px);
}

.control-key {
  background: linear-gradient(135deg, #4299e1, #3182ce);
  color: white;
  padding: 8px 12px;
  border-radius: 8px;
  font-weight: 600;
  min-width: 80px;
  text-align: center;
}

.tip-icon, .warning-icon {
  font-size: 24px;
  width: 40px;
  text-align: center;
}

.control-desc {
  color: #4a5568;
  font-weight: 500;
}

.warning-item {
  border-left: 4px solid #f56565;
}

.tip-item {
  border-left: 4px solid #48bb78;
}

.guide-panel-footer {
  padding: 30px 40px;
  background: rgba(255, 255, 255, 0.1);
  border-top: 1px solid rgba(255, 255, 255, 0.2);
  display: flex;
  justify-content: center;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  flex-shrink: 0;
}

.guide-btn-primary {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
  border: none;
  padding: 15px 40px;
  border-radius: 25px;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.guide-btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

@keyframes slideInFromRight {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 768px) {
  .guide-panel-header {
    padding: 25px 30px;
  }

  .guide-panel-header h2 {
    font-size: 28px;
  }

  .guide-panel-close {
    width: 45px;
    height: 45px;
    font-size: 28px;
  }

  .guide-panel-body {
    padding: 30px 25px;
  }

  .guide-panel-footer {
    padding: 25px 30px;
  }

  .guide-step {
    flex-direction: column;
    text-align: center;
  }

  .control-item, .tip-item, .warning-item {
    flex-direction: column;
    text-align: center;
  }
}

@media (max-width: 480px) {
  .guide-panel-header {
    padding: 20px 25px;
  }

  .guide-panel-header h2 {
    font-size: 24px;
  }

  .guide-panel-close {
    width: 40px;
    height: 40px;
    font-size: 24px;
  }

  .guide-panel-body {
    padding: 25px 20px;
  }

  .guide-panel-footer {
    padding: 20px 25px;
  }

  .guide-section h3 {
    font-size: 20px;
  }

  .step-content h4 {
    font-size: 16px;
  }
}

.part-editor {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
}

.part-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #e2e8f0;
}

.part-editor-header h2 {
  margin: 0;
  color: #2d3748;
  font-size: 2rem;
  font-weight: 700;
}

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

.btn-preview {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-demo {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-demo:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.btn-generate {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-generate:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

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

.btn-edit {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
}

.btn-edit:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.btn-guide {
  background: linear-gradient(135deg, #4299e1 0%, #3182ce 100%);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-guide::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.btn-guide:hover::before {
  left: 100%;
}

.btn-guide:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(66, 153, 225, 0.4);
}

.btn-preview.active {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
}

.btn-preview:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.generated-data-section {
  margin-bottom: 24px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

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

.generated-data-label {
  font-weight: 600;
  color: #2d3748;
  font-size: 14px;
}

.format-options {
  display: flex;
  gap: 16px;
}

.format-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
}

.format-option input[type="radio"] {
  margin: 0;
}

.part-data-group {
  margin-bottom: 16px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.part-data-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  color: #2d3748;
  font-size: 13px;
}

.head-input {
  border-left: 4px solid #e53e3e;
}

.body-input {
  border-left: 4px solid #38a169;
}

.leg-input {
  border-left: 4px solid #3182ce;
}

.part-data-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.btn-copy-small {
  background: linear-gradient(135deg, #38a169 0%, #68d391 100%);
  color: white;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy-small:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(56, 161, 105, 0.3);
}

.generated-data-input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  background: #f8f9fa;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.3s ease;
}

.generated-data-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.generated-data-input::placeholder {
  color: #a0aec0;
  font-style: italic;
}

.generated-data-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  justify-content: flex-end;
}

.btn-copy {
  background: linear-gradient(135deg, #38a169 0%, #68d391 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-copy:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(56, 161, 105, 0.3);
}

.btn-clear-data {
  background: linear-gradient(135deg, #e53e3e 0%, #fc8181 100%);
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-clear-data:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(229, 62, 62, 0.3);
}

.preview-top-section {
  margin-bottom: 30px;
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.preview-options {
  margin-bottom: 16px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
}

.preview-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: #4a5568;
  cursor: pointer;
}

.preview-option input[type="checkbox"] {
  margin: 0;
  transform: scale(1.1);
}

.part-editor-layout {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 30px;
}

.editor-main-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.part-editor-content {
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.editor-section {
  background: white;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
  overflow: hidden;
}

.editor-section h3 {
  margin: 0 0 20px 0;
  color: #2d3748;
  font-size: 1.4rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 20px;
  gap: 20px;
}

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

.form-group label {
  font-weight: 600;
  color: #4a5568;
  font-size: 14px;
}

.form-input {
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: all 0.3s ease;
  background: white;
}

.form-input:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* JSON Input Section */
.json-input-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.json-input-group label {
  font-weight: 600;
  color: #4a5568;
  font-size: 14px;
}

.json-textarea {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  font-size: 12px;
  line-height: 1.5;
  background: white;
  resize: vertical;
  transition: border-color 0.3s ease;
}

.json-textarea:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.json-textarea::placeholder {
  color: #a0aec0;
  font-style: italic;
}

.part-slots-grid {
  display: grid;
  grid-gap: 16px;
  gap: 16px;
  margin-top: 16px;
}

.head-slots {
  grid-template-columns: repeat(3, 1fr);
}

.body-slots {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  max-width: 100%;
  max-height: 600px;
  overflow-y: auto;
}

.leg-slots {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  max-width: 100%;
  max-height: 500px;
  overflow-y: auto;
}

.images-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  grid-gap: 20px;
  gap: 20px;
}

.arrays-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.editor-actions {
  display: flex;
  justify-content: center;
  padding: 20px 0;
}

.btn-save {
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  min-width: 200px;
}

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

.saved-parts-section {
  margin-top: 40px;
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.saved-parts-section h3 {
  margin: 0 0 20px 0;
  color: #2d3748;
  font-size: 1.3rem;
  font-weight: 600;
}

.saved-parts-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  grid-gap: 16px;
  gap: 16px;
  max-height: 400px;
  overflow-y: auto;
}

.saved-part-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  background: #f7fafc;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
}

.saved-part-item:hover {
  background: #edf2f7;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.part-info h4 {
  margin: 0 0 4px 0;
  color: #2d3748;
  font-size: 14px;
  font-weight: 600;
}

.part-info p {
  margin: 0;
  color: #718096;
  font-size: 12px;
}

.btn-load {
  padding: 8px 16px;
  font-size: 12px;
  white-space: nowrap;
}

.preview-section {
  background: white;
  padding: 24px;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  border: 1px solid #e2e8f0;
}

.preview-section h3 {
  margin: 0 0 16px 0;
  color: #2d3748;
  font-size: 1.4rem;
  font-weight: 600;
}

.preview-data {
  margin-top: 20px;
}

.preview-data h4 {
  margin: 0 0 12px 0;
  color: #4a5568;
  font-size: 1.1rem;
}

.preview-data pre {
  background: #f7fafc;
  padding: 16px;
  border-radius: 8px;
  border: 1px solid #e2e8f0;
  overflow-x: auto;
  font-size: 12px;
  line-height: 1.5;
  max-height: 400px;
  overflow-y: auto;
}

/* Responsive */
@media (max-width: 1200px) {
  .preview-top-section {
    margin-bottom: 20px;
  }
}

@media (max-width: 768px) {
  .part-editor {
    padding: 16px;
    margin: 10px;
  }

  .part-editor-header {
    flex-direction: column;
    gap: 16px;
    text-align: center;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .head-slots {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .body-slots {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .leg-slots {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }

  .images-grid {
    grid-template-columns: 1fr;
  }

  .saved-parts-list {
    grid-template-columns: 1fr;
  }

  .saved-part-item {
    flex-direction: column;
    gap: 12px;
    text-align: center;
  }
}

.tool-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  padding: 120px 20px 40px;
  position: relative;
}

/* Coming Soon Overlay */
.tool-page.coming-soon {
  overflow: hidden;
}

.tool-page.coming-soon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.95) 0%,
    rgba(240, 248, 255, 0.9) 50%,
    rgba(255, 255, 255, 0.95) 100%);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
          backdrop-filter: blur(12px) saturate(1.2);
  z-index: 100;
  animation: overlayShimmer 3s ease-in-out infinite;
}

@keyframes overlayShimmer {
  0%, 100% {
    background: linear-gradient(135deg,
      rgba(255, 255, 255, 0.95) 0%,
      rgba(240, 248, 255, 0.9) 50%,
      rgba(255, 255, 255, 0.95) 100%);
  }
  50% {
    background: linear-gradient(135deg,
      rgba(240, 248, 255, 0.9) 0%,
      rgba(255, 255, 255, 0.95) 50%,
      rgba(240, 248, 255, 0.9) 100%);
  }
}

.tool-page.coming-soon::after {
  content: attr(data-tool-name) '\A🚧 Đang phát triển...\ASắp ra rồi! 🚀';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 101;
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(45deg, #667eea, #764ba2, #667eea);
  background-size: 200% 200%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-align: center;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  white-space: pre-line;
  animation: comingSoonPulse 2s ease-in-out infinite, gradientShift 3s ease-in-out infinite;
  padding: 30px;
  border-radius: 20px;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 3px solid rgba(102, 126, 234, 0.3);
  background-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  line-height: 1.4;
}

@keyframes comingSoonPulse {
  0%, 100% {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0.9;
  }
  50% {
    transform: translate(-50%, -50%) scale(1.02);
    opacity: 1;
  }
}

@keyframes gradientShift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.tool-header {
  text-align: center;
  margin-bottom: 40px;
  color: white;
}

.tool-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin-bottom: 15px;
}

.tool-icon {
  font-size: 48px;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.tool-title h1 {
  font-size: 36px;
  font-weight: 700;
  margin: 0;
  text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.tool-description {
  font-size: 18px;
  opacity: 0.9;
  margin: 0;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.tool-content {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
}

.tool-section {
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.tool-section:hover {
  transform: translateY(-5px);
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
}

.tool-section h3 {
  color: #2d3748;
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 25px 0;
  padding-bottom: 15px;
  border-bottom: 3px solid #e2e8f0;
}

/* Upload Zone */
.upload-zone {
  border: 3px dashed #cbd5e0;
  border-radius: 15px;
  padding: 40px;
  text-align: center;
  transition: all 0.3s ease;
  background: #f7fafc;
}

.upload-zone:hover {
  border-color: #667eea;
  background: #edf2f7;
}

.file-input {
  display: none;
}

.upload-label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #4a5568;
  font-weight: 500;
}

.upload-icon {
  font-size: 48px;
  color: #667eea;
}

/* Grids */
.effects-grid, .mob-types-grid, .tools-grid, .elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  grid-gap: 15px;
  gap: 15px;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  grid-gap: 15px;
  gap: 15px;
}

.settings-grid, .stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-gap: 20px;
  gap: 20px;
}

/* Cards */
.effect-card, .mob-card, .skill-card {
  background: white;
  border: 3px solid #e2e8f0;
  border-radius: 15px;
  padding: 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.effect-card:hover, .mob-card:hover, .skill-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.effect-card.selected, .mob-card.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, #f0f4ff, #e6f0ff);
}

.effect-icon, .mob-icon, .skill-icon {
  font-size: 32px;
  margin-bottom: 10px;
  display: block;
}

.effect-name, .mob-name, .skill-name {
  font-weight: 600;
  color: #2d3748;
}

.mob-difficulty {
  font-size: 12px;
  color: #718096;
  margin-top: 5px;
}

/* Controls */
.effect-controls, .control-group {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.control-group {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 15px;
}

.control-group label {
  min-width: 120px;
  font-weight: 600;
  color: #4a5568;
}

.control-group input[type="range"] {
  flex: 1 1;
  height: 8px;
  border-radius: 4px;
  background: #e2e8f0;
  outline: none;
  -webkit-appearance: none;
}

.control-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Setting Items */
.setting-item, .stat-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.setting-item label, .stat-item label {
  font-weight: 600;
  color: #4a5568;
}

.setting-item input, .setting-item select,
.stat-item input, .stat-item select {
  padding: 12px;
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  font-size: 14px;
  transition: border-color 0.3s ease;
}

.setting-item input:focus, .setting-item select:focus,
.stat-item input:focus, .stat-item select:focus {
  outline: none;
  border-color: #667eea;
}

/* Buttons */
.btn-primary, .btn-secondary {
  padding: 15px 30px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, #48bb78, #38a169);
  color: white;
  box-shadow: 0 4px 15px rgba(72, 187, 120, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(72, 187, 120, 0.4);
}

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

.btn-secondary {
  background: linear-gradient(135deg, #e2e8f0, #cbd5e0);
  color: #4a5568;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.btn-secondary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.tool-actions {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-top: 30px;
}

/* Preview */
.effect-preview, .merge-preview, .mob-preview {
  background: #f7fafc;
  border-radius: 15px;
  padding: 30px;
  text-align: center;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.preview-container {
  position: relative;
  width: 200px;
  height: 200px;
  background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 70%);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.effect-sample {
  font-size: 64px;
  transition: all 0.3s ease;
}

.effect-animation {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 0.3; }
}

/* Map Editor */
.map-editor {
  display: grid;
  grid-template-columns: 300px 1fr;
  grid-gap: 30px;
  gap: 30px;
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.map-toolbar {
  display: flex;
  flex-direction: column;
  gap: 25px;
}

.toolbar-section h4 {
  color: #2d3748;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 15px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.tool-btn {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}

.tool-btn:hover, .tool-btn.active {
  border-color: #667eea;
  background: #f0f4ff;
}

.map-canvas-container {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.map-canvas {
  border: 3px solid #e2e8f0;
  border-radius: 15px;
  cursor: crosshair;
  background: white;
}

.canvas-info {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: #718096;
  padding: 10px;
  background: #f7fafc;
  border-radius: 8px;
}

/* Image Preview Grid */
.image-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-gap: 15px;
  gap: 15px;
  margin-top: 20px;
}

.image-preview-item {
  position: relative;
  background: white;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.image-preview-item:hover {
  transform: scale(1.05);
}

.image-preview-item img {
  width: 100%;
  height: 120px;
  object-fit: cover;
}

.image-info {
  padding: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.image-name {
  font-size: 12px;
  color: #4a5568;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1 1;
}

.remove-btn {
  background: #e53e3e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s ease;
}

.remove-btn:hover {
  background: #c53030;
}

/* Preview Layouts */
.preview-layout {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.preview-layout.horizontal {
  flex-direction: row;
}

.preview-layout.vertical {
  flex-direction: column;
}

.preview-layout.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  grid-gap: 10px;
  gap: 10px;
}

.preview-image {
  width: 80px;
  height: 80px;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.preview-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.empty-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  color: #718096;
  font-size: 48px;
}

.empty-preview p {
  font-size: 16px;
  margin: 0;
}

/* Skills Section */
.skills-section {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 30px;
  gap: 30px;
}

.available-skills h4,
.selected-skills h4 {
  color: #2d3748;
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 15px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid #e2e8f0;
}

.selected-skills-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 200px;
  padding: 15px;
  background: #f7fafc;
  border-radius: 10px;
  border: 2px dashed #cbd5e0;
}

.selected-skill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.selected-skill .skill-name {
  flex: 1 1;
  font-weight: 500;
  color: #2d3748;
}

.remove-skill {
  background: #e53e3e;
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.no-skills {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #a0aec0;
  font-style: italic;
}

/* Mob Preview */
.preview-card {
  background: white;
  border-radius: 15px;
  padding: 20px;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  max-width: 400px;
  margin: 0 auto;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 20px;
}

.preview-icon {
  font-size: 48px;
}

.preview-info h4 {
  margin: 0;
  color: #2d3748;
  font-size: 20px;
  font-weight: 600;
}

.preview-info span {
  color: #718096;
  font-size: 14px;
}

.preview-stats {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.stat-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stat-bar span {
  min-width: 80px;
  font-weight: 500;
  color: #4a5568;
}

.bar {
  flex: 1 1;
  height: 8px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.hp-bar {
  background: linear-gradient(90deg, #e53e3e, #fc8181);
}

.mp-bar {
  background: linear-gradient(90deg, #3182ce, #63b3ed);
}

.preview-details {
  display: flex;
  gap: 15px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.preview-details span {
  background: #f7fafc;
  padding: 5px 10px;
  border-radius: 15px;
  font-size: 12px;
  font-weight: 500;
  color: #4a5568;
}

.preview-skills {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.preview-skills span:first-child {
  font-weight: 600;
  color: #4a5568;
}

.preview-skill {
  font-size: 20px;
  padding: 5px;
  background: #f7fafc;
  border-radius: 8px;
}

/* Layers Panel */
.layers-panel {
  background: #f7fafc;
  border-radius: 10px;
  padding: 15px;
  border: 1px solid #e2e8f0;
}

.layer-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: white;
  border-radius: 8px;
  margin-bottom: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.layer-item.active {
  border: 2px solid #667eea;
}

.layer-icon {
  font-size: 16px;
  cursor: pointer;
}

.layer-name {
  flex: 1 1;
  font-weight: 500;
  color: #2d3748;
}

.layer-controls {
  display: flex;
  gap: 5px;
}

.layer-btn {
  background: none;
  border: none;
  font-size: 14px;
  cursor: pointer;
  padding: 5px;
  border-radius: 4px;
  transition: background 0.3s ease;
}

.layer-btn:hover {
  background: #e2e8f0;
}

.add-layer-btn {
  width: 100%;
  padding: 10px;
  background: linear-gradient(135deg, #667eea, #764ba2);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.add-layer-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
}

/* Color Picker */
.color-picker {
  width: 60px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.size-slider {
  width: 100%;
  margin: 10px 0;
}

.elements-grid .element-btn {
  width: 40px;
  height: 40px;
  border: 2px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  transition: all 0.3s ease;
}

.elements-grid .element-btn:hover {
  border-color: #667eea;
  transform: scale(1.1);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Responsive */
@media (max-width: 768px) {
  .tool-page {
    padding: 100px 10px 20px;
  }

  .tool-title h1 {
    font-size: 28px;
  }

  .tool-section {
    padding: 20px;
  }

  .effects-grid, .mob-types-grid, .tools-grid {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  }

  .settings-grid, .stats-grid {
    grid-template-columns: 1fr;
  }

  .map-editor {
    grid-template-columns: 1fr;
  }

  .tool-actions {
    flex-direction: column;
  }

  .skills-section {
    grid-template-columns: 1fr;
  }

  .image-preview-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }

  /* Coming Soon Mobile */
  .tool-page.coming-soon::after {
    font-size: 22px;
    padding: 25px 20px;
    max-width: 90%;
  }
}

@media (max-width: 480px) {
  .tool-page.coming-soon::after {
    font-size: 18px;
    padding: 20px 15px;
    max-width: 95%;
    line-height: 1.3;
  }
}

/* File Drop Zone Styles */
.file-drop-zone {
  border: 2px dashed #3498db;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
  transition: all 0.3s ease;
  cursor: pointer;
}

.file-drop-zone:hover {
  border-color: #2980b9;
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.15) 0%, rgba(155, 89, 182, 0.15) 100%);
  transform: translateY(-2px);
}

.file-drop-zone.drag-over {
  border-color: #27ae60;
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.2) 0%, rgba(46, 213, 115, 0.2) 100%);
}

.drop-zone-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
}

.drop-icon {
  font-size: 48px;
  opacity: 0.7;
}

.drop-hint {
  color: #7f8c8d;
  font-size: 14px;
  margin: 0;
}

.file-inputs {
  display: flex;
  gap: 15px;
  margin-top: 10px;
}

/* Effect Canvas Styles */
.effect-preview-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  background: #2c3e50;
  border-radius: 12px;
  padding: 20px;
}

.effect-canvas {
  border: 2px solid #34495e;
  border-radius: 8px;
  background: #2c3e50;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  max-width: 100%;
  height: auto;
  /* Canvas thực tế: 1800x1200, hiển thị scaled down */
  width: 900px; /* Hiển thị ở 50% kích thước thực */
  max-height: 600px;
  -webkit-user-select: none;
          user-select: none;
  transition: cursor 0.2s ease;
  /* Pixel art rendering - sắc nét như paint */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -webkit-crisp-edges;
  /* Disable smoothing */
  -ms-interpolation-mode: nearest-neighbor;
}

.effect-canvas:active {
  cursor: grabbing !important;
}

.effect-preview-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* All Parts Panel Overlay - Left */
.all-parts-panel-overlay {
  position: absolute;
  width: 280px;
  max-height: 250px;
  background: rgba(44, 62, 80, 0.95);
  border-radius: 8px;
  border: 1px solid rgba(52, 152, 219, 0.4);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  z-index: 10;
  -webkit-user-select: none;
          user-select: none;
}

/* Current Parts Panel Overlay - Right */
.current-parts-panel-overlay {
  position: absolute;
  width: 300px;
  max-height: 300px; /* Giảm xuống 1 nửa paint frame (300px) */
  height: 300px; /* Set chiều cao cố định 300px */
  background: rgba(44, 62, 80, 0.95);
  border-radius: 8px;
  border: 1px solid rgba(52, 152, 219, 0.4);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  z-index: 10;
  -webkit-user-select: none;
          user-select: none;
  display: flex;
  flex-direction: column; /* Để header cố định và content scroll */
}

.panel-header-mini {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(52, 73, 94, 0.9);
  border-bottom: 1px solid rgba(52, 152, 219, 0.2);
  border-radius: 8px 8px 0 0;
  flex-shrink: 0; /* Header không co lại */
  min-height: 50px; /* Đảm bảo header có chiều cao tối thiểu */
}

.draggable-header {
  cursor: move;
  cursor: grab;
}

.draggable-header:active {
  cursor: grabbing;
}

.draggable-header:hover {
  background: rgba(52, 73, 94, 1);
}

.panel-header-mini h4 {
  margin: 0;
  color: #ecf0f1;
  font-size: 12px;
  font-weight: 600;
}

.panel-info-mini {
  color: #95a5a6;
  font-size: 10px;
  font-weight: 500;
}

.all-parts-list-mini {
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
}

.current-parts-list-mini {
  flex: 1 1; /* Sử dụng hết không gian còn lại */
  overflow-y: auto; /* Cho phép scroll khi có nhiều parts */
  padding: 8px;
  border: 2px dashed rgba(52, 152, 219, 0.3);
  border-radius: 4px;
  margin: 4px;
  min-height: 100px; /* Chiều cao tối thiểu để hiển thị drop zone */
  max-height: none; /* Không giới hạn chiều cao tối đa */
}

.all-part-item-mini,
.current-part-item-mini {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  margin-bottom: 3px;
  background: rgba(52, 73, 94, 0.8);
  border-radius: 4px;
  border: 1px solid rgba(52, 152, 219, 0.4);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 10px;
  min-height: 40px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.all-part-item-mini:hover,
.current-part-item-mini:hover {
  background: rgba(52, 152, 219, 0.2);
  border-color: #3498db;
}

.all-part-item-mini.selected,
.current-part-item-mini.selected {
  background: rgba(231, 76, 60, 0.2);
  border-color: #e74c3c;
  box-shadow: 0 0 8px rgba(231, 76, 60, 0.3);
}

.all-part-item-mini.used {
  background: rgba(46, 213, 115, 0.2);
  border-color: rgba(46, 213, 115, 0.4);
}

.all-part-item-mini[draggable="true"] {
  cursor: grab;
}

.all-part-item-mini[draggable="true"]:active {
  cursor: grabbing;
}

.part-preview-mini {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    repeating-conic-gradient(
      #2a2a2a 0% 25%,
      #1f1f1f 25% 50%
    ) 50% / 3px 3px;
  border: 1px solid rgba(52, 152, 219, 0.4);
  border-radius: 4px;
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.1),
    0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
  cursor: pointer;
}

/* Hover effect đơn giản - chỉ scale preview hiện tại */
.part-preview-mini:hover {
  transform: scale(1.2);
  z-index: 1000;
  border-color: #3498db;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.2),
    0 0 12px rgba(52, 152, 219, 0.6),
    0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Photoshop-style preview images - fill container completely */
.part-preview-mini .part-preview-img,
.all-part-item-mini .part-preview-img,
.current-part-item-mini .part-preview-img,
img.part-preview-img {
  width: 30px !important;
  height: 30px !important;
  object-fit: cover !important;
  object-position: center !important;
  image-rendering: pixelated !important;
  image-rendering: -moz-crisp-edges !important;
  image-rendering: crisp-edges !important;
  image-rendering: -webkit-optimize-contrast !important;
  display: block !important;
  filter: contrast(1.05) brightness(1.02) !important;
  border-radius: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.part-preview-placeholder {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #7f8c8d;
  font-size: 8px;
  font-weight: bold;
  background: linear-gradient(45deg, #2c3e50, #34495e);
  border-radius: 3px;
  text-align: center;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.part-info-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1;
}

.part-id-mini {
  color: #3498db;
  font-weight: 700;
  font-size: 10px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.part-image-id-mini {
  color: #bdc3c7;
  font-size: 8px;
  font-weight: 500;
}

.part-position-mini {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.coord-mini {
  background: rgba(52, 152, 219, 0.3);
  padding: 1px 3px;
  border-radius: 2px;
  font-size: 8px;
  color: #ecf0f1;
  text-align: center;
  min-width: 28px;
  font-weight: 500;
  border: 1px solid rgba(52, 152, 219, 0.4);
}

.part-size-mini {
  display: flex;
  align-items: center;
}

.size-mini {
  background: rgba(155, 89, 182, 0.2);
  padding: 1px 4px;
  border-radius: 2px;
  font-size: 9px;
  color: #ecf0f1;
  text-align: center;
}

.part-input-mini {
  width: 35px;
  padding: 1px 2px;
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 2px;
  background: rgba(44, 62, 80, 0.8);
  color: #ecf0f1;
  font-size: 9px;
  text-align: center;
  margin-bottom: 2px;
}

.part-input-mini:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 3px rgba(52, 152, 219, 0.5);
}

.part-actions-mini {
  display: flex;
  align-items: center;
  gap: 4px;
}

.add-part-btn,
.remove-part-btn {
  background: none;
  border: none;
  font-size: 12px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 2px;
  transition: all 0.2s ease;
}

.add-part-btn {
  color: #27ae60;
}

.add-part-btn:hover {
  background: rgba(39, 174, 96, 0.2);
  transform: scale(1.1);
}

.remove-part-btn {
  color: #e74c3c;
}

.remove-part-btn:hover {
  background: rgba(231, 76, 60, 0.2);
  transform: scale(1.1);
}

/* ===== VISIBILITY BUTTON STYLES ===== */
.visibility-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: all 0.3s ease;
  min-width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.visibility-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: currentColor;
  opacity: 0;
  border-radius: 4px;
  transition: opacity 0.3s ease;
}

.visibility-btn:hover::before {
  opacity: 0.1;
}

.visibility-btn.visible {
  color: #27ae60;
}

.visibility-btn.visible:hover {
  color: #2ecc71;
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(39, 174, 96, 0.3);
}

.visibility-btn.visible:active {
  transform: scale(0.95);
}

.visibility-btn.hidden {
  color: #e74c3c;
  opacity: 0.8;
}

.visibility-btn.hidden:hover {
  color: #c0392b;
  transform: scale(1.15);
  opacity: 1;
  box-shadow: 0 2px 8px rgba(231, 76, 60, 0.3);
}

.visibility-btn.hidden:active {
  transform: scale(0.95);
}

.visibility-btn svg {
  transition: all 0.3s ease;
  z-index: 1;
  position: relative;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.1));
}

.visibility-btn:hover svg {
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

/* Thêm hiệu ứng ripple khi click */
.visibility-btn:active {
  transform: scale(0.9);
}

.visibility-btn:active::before {
  opacity: 0.2;
  transform: scale(1.2);
}

/* Hiệu ứng khi toggle */
.visibility-btn.visible svg {
  animation: fadeInScale 0.3s ease;
}

.visibility-btn.hidden svg {
  animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
  0% {
    opacity: 0;
    transform: scale(0.8);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

/* Hiệu ứng cho part bị ẩn */
.current-part-item-mini.part-hidden {
  opacity: 0.5;
  background: rgba(231, 76, 60, 0.1);
  border-left: 3px solid #e74c3c;
}

.current-part-item-mini.part-hidden .part-preview-mini {
  filter: grayscale(100%) opacity(0.6);
}

.current-part-item-mini.part-hidden .part-info-mini {
  text-decoration: line-through;
  color: #95a5a6;
}

.drop-zone-hint {
  text-align: center;
  color: #95a5a6;
  font-size: 10px;
  font-style: italic;
  padding: 20px;
  border: 2px dashed rgba(149, 165, 166, 0.3);
  border-radius: 4px;
  margin: 8px;
}

.current-parts-list-mini:hover {
  border-color: rgba(52, 152, 219, 0.5);
}

.current-parts-list-mini.drag-over {
  border-color: #27ae60;
  background: rgba(39, 174, 96, 0.1);
  animation: dragPulse 1s infinite;
}

@keyframes dragPulse {
  0% {
    border-color: #27ae60;
    box-shadow: 0 0 0 0 rgba(39, 174, 96, 0.4);
  }
  50% {
    border-color: #2ecc71;
    box-shadow: 0 0 0 8px rgba(39, 174, 96, 0);
  }
  100% {
    border-color: #27ae60;
    box-shadow: 0 0 0 0 rgba(39, 174, 96, 0);
  }
}

.all-part-item-mini:hover .part-preview-mini {
  border-color: #3498db;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.2),
    0 0 6px rgba(52, 152, 219, 0.4),
    0 2px 4px rgba(0, 0, 0, 0.2);
}

.all-part-item-mini.selected .part-preview-mini {
  border-color: #e74c3c;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.2),
    0 0 6px rgba(231, 76, 60, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.2);
}

.current-part-item-mini.selected .part-preview-mini {
  border-color: #e74c3c;
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.2),
    0 0 6px rgba(231, 76, 60, 0.5),
    0 2px 4px rgba(0, 0, 0, 0.2);
}

.current-part-item-mini[draggable="true"] {
  cursor: grab;
}

.current-part-item-mini[draggable="true"]:active {
  cursor: grabbing;
}

.current-part-item-mini.being-dragged {
  opacity: 0.3;
  transform: rotate(3deg) scale(0.95);
  border-color: #3498db;
  background: rgba(52, 152, 219, 0.1);
}

.current-part-item-mini.drag-over {
  border-color: #f39c12;
  background: rgba(243, 156, 18, 0.3);
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 6px 20px rgba(243, 156, 18, 0.5);
  animation: dragPulse 0.5s infinite alternate;
}

@keyframes dragPulse {
  0% {
    box-shadow: 0 6px 20px rgba(243, 156, 18, 0.5);
  }
  100% {
    box-shadow: 0 8px 25px rgba(243, 156, 18, 0.7);
  }
}

.paint-order-mini {
  color: #9b59b6;
  font-size: 8px;
  font-weight: 700;
  background: rgba(155, 89, 182, 0.3);
  padding: 2px 6px;
  border-radius: 3px;
  text-align: center;
  border: 1px solid rgba(155, 89, 182, 0.5);
  min-width: 45px;
  display: inline-block;
}

.current-part-item-mini:hover .paint-order-mini {
  background: rgba(155, 89, 182, 0.4);
  border-color: #9b59b6;
  color: #fff;
}

.current-part-item-mini.selected .paint-order-mini {
  background: rgba(231, 76, 60, 0.3);
  border-color: #e74c3c;
  color: #e74c3c;
}

.animation-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(52, 73, 94, 0.8);
  padding: 15px 25px;
  border-radius: 25px;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  flex-wrap: wrap;
  justify-content: center;
}



/* Active button state for debug/edit buttons */
.btn-secondary.active {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border-color: #e74c3c;
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.4);
}

.btn-secondary.active:hover {
  background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
  transform: translateY(-1px);
}

/* Checkbox Control */
.checkbox-control {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(44, 62, 80, 0.6);
  padding: 8px 15px;
  border-radius: 15px;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.checkbox-control input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #e74c3c;
  cursor: pointer;
}

.checkbox-control label {
  color: #ecf0f1;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  -webkit-user-select: none;
          user-select: none;
  margin: 0;
}

/* Active button state */
.btn-secondary.active {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  color: white;
  border-color: #e74c3c;
}

.btn-secondary.active:hover {
  background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
}

.btn-primary.playing {
  background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.7); }
  70% { box-shadow: 0 0 0 10px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

.frame-info {
  color: #ecf0f1;
  font-weight: 600;
  font-size: 14px;
}

.history-info {
  color: #bdc3c7;
  font-size: 12px;
  font-weight: 400;
  margin-top: 4px;
}

.undo-available {
  color: #3498db;
  font-weight: 500;
}

.redo-available {
  color: #2ecc71;
  font-weight: 500;
}

.history-controls {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
}

.btn-history {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 85px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-history.undo.enabled {
  background: rgba(52, 152, 219, 0.2);
  border: 1px solid rgba(52, 152, 219, 0.4);
  color: #3498db;
}

.btn-history.undo.enabled:hover {
  background: rgba(52, 152, 219, 0.3);
  border-color: #3498db;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
}

.btn-history.redo.enabled {
  background: rgba(46, 204, 113, 0.2);
  border: 1px solid rgba(46, 204, 113, 0.4);
  color: #2ecc71;
}

.btn-history.redo.enabled:hover {
  background: rgba(46, 204, 113, 0.3);
  border-color: #2ecc71;
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.btn-history.disabled {
  background: rgba(149, 165, 166, 0.1);
  border: 1px solid rgba(149, 165, 166, 0.2);
  color: #95a5a6;
  cursor: not-allowed;
  opacity: 0.5;
}

.btn-history.disabled:hover {
  transform: none;
  box-shadow: none;
}

.btn-history.enabled:active {
  transform: scale(0.95);
  transition: transform 0.1s ease;
}

/* Animation khi undo/redo thành công */
.btn-history.success {
  animation: historySuccess 0.3s ease;
}

@keyframes historySuccess {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.5);
  }
  100% {
    transform: scale(1);
  }
}

.camera-info {
  color: #ecf0f1;
  font-weight: 600;
  font-size: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.camera-hint {
  color: #95a5a6;
  font-size: 10px;
  font-weight: 400;
  font-style: italic;
}

.keyboard-hint {
  color: #3498db;
  font-size: 10px;
  font-weight: 500;
  background: rgba(52, 152, 219, 0.1);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid rgba(52, 152, 219, 0.3);
  margin-top: 2px;
}

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

.clear-all-parts-btn {
  background: rgba(231, 76, 60, 0.1);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #e74c3c;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s ease;
  font-size: 10px;
  font-weight: 600;
  margin-right: 6px;
}

.clear-all-parts-btn:hover {
  background: rgba(231, 76, 60, 0.2);
  border-color: #e74c3c;
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
}

.clear-all-parts-btn:active {
  transform: scale(0.95);
}

.toggle-all-visibility-btn {
  background: none;
  border: none;
  color: #95a5a6;
  cursor: pointer;
  padding: 4px;
  border-radius: 3px;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
}

.toggle-all-visibility-btn:hover {
  color: #3498db;
  background: rgba(52, 152, 219, 0.1);
  transform: scale(1.1);
}

.toggle-all-visibility-btn:active {
  transform: scale(0.95);
}

/* Pixel-perfect toggle */
.pixel-perfect-toggle {
  margin-top: 5px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 11px;
  color: #7f8c8d;
  transition: color 0.3s ease;
}

.toggle-label:hover {
  color: #3498db;
}

.toggle-checkbox {
  width: 14px;
  height: 14px;
  cursor: pointer;
  accent-color: #3498db;
}

.toggle-text {
  -webkit-user-select: none;
          user-select: none;
  font-weight: 500;
}

/* Hiệu ứng khi toggle all */
.toggle-all-visibility-btn.toggling {
  animation: togglePulse 0.6s ease;
}

@keyframes togglePulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7);
  }
  50% {
    transform: scale(1.2);
    box-shadow: 0 0 0 10px rgba(52, 152, 219, 0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(52, 152, 219, 0);
  }
}

/* Frame Timeline Styles */
.frame-timeline {
  width: 100%;
  max-width: 900px; /* Tăng để phù hợp với canvas lớn hơn */
  background: rgba(52, 73, 94, 0.6);
  border-radius: 10px;
  padding: 15px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  color: #ecf0f1;
  font-size: 14px;
  font-weight: 600;
}

.frame-count {
  color: #3498db;
}

.frame-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-frame-action {
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all 0.2s ease;
  border: none;
}

.btn-frame-action.add-frame {
  background: rgba(39, 174, 96, 0.2);
  border: 1px solid rgba(39, 174, 96, 0.4);
  color: #27ae60;
}

.btn-frame-action.add-frame:hover {
  background: rgba(39, 174, 96, 0.3);
  border-color: #27ae60;
  transform: scale(1.05);
}

.btn-frame-action.remove-frame {
  background: rgba(231, 76, 60, 0.2);
  border: 1px solid rgba(231, 76, 60, 0.4);
  color: #e74c3c;
}

.btn-frame-action.remove-frame:hover:not(:disabled) {
  background: rgba(231, 76, 60, 0.3);
  border-color: #e74c3c;
  transform: scale(1.05);
}

.btn-frame-action.remove-frame:disabled {
  background: rgba(149, 165, 166, 0.2);
  border: 1px solid rgba(149, 165, 166, 0.3);
  color: #95a5a6;
  cursor: not-allowed;
  opacity: 0.5;
}

/* Add Frame Dropdown */
.add-frame-dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background: rgba(44, 62, 80, 0.95);
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  min-width: 180px;
  margin-top: 4px;
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  /* Animation */
  animation: dropdownFadeIn 0.2s ease-out;
  transform-origin: top left;
}

@keyframes dropdownFadeIn {
  0% {
    opacity: 0;
    transform: translateY(-10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 10px 15px;
  background: none;
  border: none;
  color: #ecf0f1;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 0;
}

.dropdown-item:first-child {
  border-top-left-radius: 6px;
  border-top-right-radius: 6px;
}

.dropdown-item:last-child {
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
}

/* Keyframe Editor Styles */
.btn-frame-action.edit-keyframe {
  background: #6f42c1;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-frame-action.edit-keyframe:hover {
  background: #5a2d91;
  transform: translateY(-1px);
}

.keyframe-editor {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 8px;
  padding: 16px;
  margin-top: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.keyframe-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  color: #495057;
  font-size: 16px;
}

.keyframe-header button {
  background: #dc3545;
  color: white;
  border: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.keyframe-header button:hover {
  background: #c82333;
  transform: scale(1.1);
}

.keyframe-content p {
  margin: 0 0 12px 0;
  color: #6c757d;
  font-style: italic;
  font-size: 14px;
}

.keyframe-controls {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.keyframe-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.keyframe-counter > span {
  font-weight: 500;
  color: #495057;
  font-size: 14px;
}

.counter-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  background: white;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid #dee2e6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.btn-counter {
  background: #6f42c1;
  color: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-counter:hover:not(:disabled) {
  background: #5a2d91;
  transform: scale(1.1);
}

.btn-counter:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.5;
}

.counter-value {
  font-size: 18px;
  font-weight: 600;
  color: #495057;
  min-width: 30px;
  text-align: center;
}

.keyframe-info {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: #6c757d;
  padding-top: 8px;
  border-top: 1px solid #e9ecef;
}

.keyframe-info span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Timeline keyframe count display */
.keyframe-count-display {
  font-size: 10px;
  color: #6f42c1;
  background: rgba(111, 66, 193, 0.1);
  padding: 1px 4px;
  border-radius: 2px;
  margin-top: 2px;
  font-weight: 600;
}

.frame-marker:hover .keyframe-count-display {
  background: rgba(111, 66, 193, 0.2);
  color: #5a2d91;
}

/* Effect Info Compact Styles */
.effect-info-compact {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 8px 12px;
  margin-top: 8px;
  border-left: 3px solid #007bff;
}

.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 4px 0;
  font-size: 14px;
}

.info-row span {
  color: #495057;
}

.info-row input {
  border: 1px solid #ced4da;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 14px;
}

.dropdown-item:hover:not(:disabled) {
  background: rgba(52, 152, 219, 0.2);
  color: #3498db;
}

.dropdown-item:disabled {
  color: #95a5a6;
  cursor: not-allowed;
  opacity: 0.5;
}

.dropdown-item:disabled:hover {
  background: none;
  color: #95a5a6;
}

/* Onion Skin Toggle */
#showOnionSkin:checked + label {
  color: #9b59b6;
  text-shadow: 0 0 8px rgba(155, 89, 182, 0.5);
}

#showOnionSkin:checked + label::before {
  background: linear-gradient(135deg, #9b59b6, #8e44ad);
  box-shadow: 0 0 10px rgba(155, 89, 182, 0.4);
}

.timeline-track {
  display: flex;
  gap: 2px;
  background: #34495e;
  border-radius: 6px;
  padding: 8px;
  overflow-x: auto;
}

.frame-marker {
  min-width: 32px;
  height: 24px;
  background: #7f8c8d;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.frame-number {
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  -webkit-user-select: none;
          user-select: none;
}

.frame-marker:hover {
  background: #3498db;
  transform: scale(1.05);
}

.frame-marker:hover .frame-number {
  color: #fff;
  font-weight: 700;
}

.frame-marker.active {
  background: #e74c3c;
  transform: scale(1.15);
  box-shadow: 0 0 12px rgba(231, 76, 60, 0.6);
  border: 2px solid #fff;
}

.frame-marker.active .frame-number {
  color: #fff;
  font-weight: 700;
  font-size: 11px;
}

/* Effect Info Grid */
.effect-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  grid-gap: 20px;
  gap: 20px;
}

.info-card {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
}

.info-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 25px rgba(52, 152, 219, 0.2);
  border-color: #3498db;
}

.info-label {
  color: #7f8c8d;
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 500;
}

.info-value {
  color: #3498db;
  font-size: 24px;
  font-weight: 700;
}

/* Notification Styles */
.notification {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px;
  border-radius: 10px;
  font-weight: 600;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  z-index: 1000;
  animation: slideInRight 0.3s ease-out;
  max-width: 400px;
}

.notification.info {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.9) 0%, rgba(155, 89, 182, 0.9) 100%);
  border: 1px solid rgba(52, 152, 219, 0.5);
  color: #fff;
}

.notification.success {
  background: linear-gradient(135deg, rgba(39, 174, 96, 0.9) 0%, rgba(46, 213, 115, 0.9) 100%);
  border: 1px solid rgba(39, 174, 96, 0.5);
  color: #fff;
}

.notification.error {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.9) 0%, rgba(192, 57, 43, 0.9) 100%);
  border: 1px solid rgba(231, 76, 60, 0.5);
  color: #fff;
}

.notification button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 18px;
  padding: 0;
  margin-left: auto;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.notification button:hover {
  opacity: 1;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}



/* Status Messages */
.status-message {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-weight: 500;
}

.status-message.loading {
  background: linear-gradient(135deg, rgba(52, 152, 219, 0.1) 0%, rgba(155, 89, 182, 0.1) 100%);
  border: 1px solid rgba(52, 152, 219, 0.3);
  color: #3498db;
}

.status-message.error {
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, rgba(192, 57, 43, 0.1) 100%);
  border: 1px solid rgba(231, 76, 60, 0.3);
  color: #e74c3c;
}

.status-message button {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  font-size: 16px;
  padding: 0;
  margin-left: auto;
  opacity: 0.7;
  transition: opacity 0.3s ease;
}

.status-message button:hover {
  opacity: 1;
}

/* Timeline Controls */
.timeline-controls {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: 15px;
  padding: 15px;
  background: rgba(44, 62, 80, 0.6);
  border-radius: 15px;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.timeline-buttons {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.timeline-options {
  display: flex;
  gap: 20px;
  align-items: center;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid rgba(52, 152, 219, 0.2);
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.speed-control span {
  color: #ecf0f1;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.speed-control input[type="range"] {
  width: 120px;
}

/* Sprite Panel Solo */
.sprite-panel-solo {
  background: rgba(44, 62, 80, 0.6);
  border-radius: 12px;
  border: 1px solid rgba(52, 152, 219, 0.3);
  overflow: hidden;
  margin-bottom: 20px;
  max-width: 900px;
  width: 100%;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  background: rgba(52, 73, 94, 0.8);
  border-bottom: 1px solid rgba(52, 152, 219, 0.2);
  /* Đảm bảo header có chiều cao cố định */
  min-height: 60px;
  height: 60px;
  flex-shrink: 0;
}

.panel-header h3 {
  margin: 0;
  color: #ecf0f1;
  font-size: 16px;
  font-weight: 600;
}

.panel-info {
  color: #95a5a6;
  font-size: 12px;
  font-weight: 500;
}

.sprite-container {
  padding: 15px;
  /* Cho phép cuộn khi sprite sheet lớn hơn container */
  min-height: 600px; /* Chiều cao tối thiểu */
  max-height: 100vh; /* Không vượt quá chiều cao màn hình */
  max-width: 100%;
  overflow: auto;
  overflow-x: auto; /* Đảm bảo thanh scroll ngang */
  overflow-y: auto; /* Đảm bảo thanh scroll dọc */
  background: #2c3e50;
  border-radius: 4px;
  /* Đảm bảo scrollbar luôn hiển thị khi cần */
  scrollbar-width: thin;
  scrollbar-color: #3498db #2c3e50;
  /* Cho phép container mở rộng theo nội dung */
  height: -webkit-fit-content;
  height: fit-content;
  flex: 1 1;
}

.sprite-canvas {
  display: block;
  background: #2c3e50;
  /* Pixel art rendering - sắc nét như paint */
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: -webkit-crisp-edges;
  /* Disable smoothing */
  -ms-interpolation-mode: nearest-neighbor;
  /* Đảm bảo canvas không bị shrink và giữ kích thước thực */
  flex-shrink: 0;
  min-width: -webkit-max-content;
  min-width: max-content;
  max-width: none;
  width: auto !important; /* Override inline styles nếu cần */
  height: auto !important; /* Override inline styles nếu cần */
}

/* Custom scrollbar cho sprite container */
.sprite-container::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.sprite-container::-webkit-scrollbar-track {
  background: #34495e;
  border-radius: 6px;
}

.sprite-container::-webkit-scrollbar-thumb {
  background: #3498db;
  border-radius: 6px;
  border: 2px solid #34495e;
}

.sprite-container::-webkit-scrollbar-thumb:hover {
  background: #2980b9;
}

.sprite-container::-webkit-scrollbar-corner {
  background: #34495e;
}

/* Global scrollbar styling - áp dụng cho tất cả scrollbar */
* {
  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #3498db #34495e;
}

/* Webkit scrollbar cho tất cả elements */
*::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

*::-webkit-scrollbar-track {
  background: #34495e;
  border-radius: 6px;
}

*::-webkit-scrollbar-thumb {
  background: #3498db;
  border-radius: 6px;
  border: 2px solid #34495e;
}

*::-webkit-scrollbar-thumb:hover {
  background: #2980b9;
}

*::-webkit-scrollbar-corner {
  background: #34495e;
}

/* Specific scrollbar styling cho các container quan trọng */
.tool-page,
.effect-canvas-container,
.frame-controls,
.all-parts-panel,
.current-parts-panel,
.parts-list,
.frame-list {
  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #3498db #34495e;
}

.tool-page::-webkit-scrollbar,
.effect-canvas-container::-webkit-scrollbar,
.frame-controls::-webkit-scrollbar,
.all-parts-panel::-webkit-scrollbar,
.current-parts-panel::-webkit-scrollbar,
.parts-list::-webkit-scrollbar,
.frame-list::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.tool-page::-webkit-scrollbar-track,
.effect-canvas-container::-webkit-scrollbar-track,
.frame-controls::-webkit-scrollbar-track,
.all-parts-panel::-webkit-scrollbar-track,
.current-parts-panel::-webkit-scrollbar-track,
.parts-list::-webkit-scrollbar-track,
.frame-list::-webkit-scrollbar-track {
  background: #34495e;
  border-radius: 6px;
}

.tool-page::-webkit-scrollbar-thumb,
.effect-canvas-container::-webkit-scrollbar-thumb,
.frame-controls::-webkit-scrollbar-thumb,
.all-parts-panel::-webkit-scrollbar-thumb,
.current-parts-panel::-webkit-scrollbar-thumb,
.parts-list::-webkit-scrollbar-thumb,
.frame-list::-webkit-scrollbar-thumb {
  background: #3498db;
  border-radius: 6px;
  border: 2px solid #34495e;
}

.tool-page::-webkit-scrollbar-thumb:hover,
.effect-canvas-container::-webkit-scrollbar-thumb:hover,
.frame-controls::-webkit-scrollbar-thumb:hover,
.all-parts-panel::-webkit-scrollbar-thumb:hover,
.current-parts-panel::-webkit-scrollbar-thumb:hover,
.parts-list::-webkit-scrollbar-thumb:hover,
.frame-list::-webkit-scrollbar-thumb:hover {
  background: #2980b9;
}

/* Scrollbar cho các element có thể scroll khác */
.modal,
.dropdown,
.tooltip,
.popup,
.overlay,
.sidebar,
.menu,
.list-container,
.table-container,
.content-area {
  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #3498db #34495e;
}

.modal::-webkit-scrollbar,
.dropdown::-webkit-scrollbar,
.tooltip::-webkit-scrollbar,
.popup::-webkit-scrollbar,
.overlay::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.menu::-webkit-scrollbar,
.list-container::-webkit-scrollbar,
.table-container::-webkit-scrollbar,
.content-area::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.modal::-webkit-scrollbar-track,
.dropdown::-webkit-scrollbar-track,
.tooltip::-webkit-scrollbar-track,
.popup::-webkit-scrollbar-track,
.overlay::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.menu::-webkit-scrollbar-track,
.list-container::-webkit-scrollbar-track,
.table-container::-webkit-scrollbar-track,
.content-area::-webkit-scrollbar-track {
  background: #34495e;
  border-radius: 6px;
}

.modal::-webkit-scrollbar-thumb,
.dropdown::-webkit-scrollbar-thumb,
.tooltip::-webkit-scrollbar-thumb,
.popup::-webkit-scrollbar-thumb,
.overlay::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.menu::-webkit-scrollbar-thumb,
.list-container::-webkit-scrollbar-thumb,
.table-container::-webkit-scrollbar-thumb,
.content-area::-webkit-scrollbar-thumb {
  background: #3498db;
  border-radius: 6px;
  border: 2px solid #34495e;
}

.modal::-webkit-scrollbar-thumb:hover,
.dropdown::-webkit-scrollbar-thumb:hover,
.tooltip::-webkit-scrollbar-thumb:hover,
.popup::-webkit-scrollbar-thumb:hover,
.overlay::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.menu::-webkit-scrollbar-thumb:hover,
.list-container::-webkit-scrollbar-thumb:hover,
.table-container::-webkit-scrollbar-thumb:hover,
.content-area::-webkit-scrollbar-thumb:hover {
  background: #2980b9;
}

/* Sprite canvas container */
.sprite-canvas-container {
  position: relative;
  display: inline-block;
  min-width: -webkit-max-content;
  min-width: max-content;
  width: -webkit-max-content;
  width: max-content;
}

/* Selection overlay base styles */
.selection-overlay {
  pointer-events: none;
  z-index: 10;
  box-sizing: border-box;
  transition: all 0.1s ease-out;
  border-radius: 2px;
}

/* Selection overlay khi đang select */
.selection-overlay.selecting {
  border: 2px dashed #3498db;
  background-color: rgba(52, 152, 219, 0.15);
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.3);
  animation: marchingAnts 1s linear infinite;
}

/* Selection overlay khi đã select xong */
.selection-overlay.selected {
  border: 2px solid #27ae60;
  background-color: rgba(39, 174, 96, 0.15);
  box-shadow: 0 0 8px rgba(39, 174, 96, 0.4);
}

@keyframes marchingAnts {
  0% {
    border-offset: 0;
  }
  100% {
    border-offset: 16px;
  }
}

/* Selection info overlay */
.selection-info-overlay {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(2px);
          backdrop-filter: blur(2px);
}

/* Responsive cho sprite panel */
@media (max-width: 1200px) {
  .sprite-panel-with-manager {
    flex-direction: column;
    align-items: stretch;
  }

  .sprite-section {
    min-width: 300px;
  }

  .parts-manager-panel {
    min-width: 100%;
    max-width: none;
    height: auto !important; /* Override JS height trên mobile */
    min-height: 400px; /* Giảm min-height trên mobile */
  }
}

@media (max-width: 768px) {
  .sprite-container {
    min-height: 300px; /* Giảm min-height trên mobile */
    max-height: 400px;
    padding: 10px;
  }

  .sprite-section {
    min-width: 250px;
  }

  .parts-manager-panel {
    min-height: 300px; /* Giảm thêm min-height trên mobile nhỏ */
  }

  .history-controls {
    gap: 6px;
  }

  .btn-history {
    padding: 6px 12px;
    font-size: 11px;
    min-width: 75px;
  }

  .btn-history.enabled:hover {
    transform: translateY(-1px) scale(1.01);
  }

  .dropdown-menu {
    min-width: 160px;
    margin-top: 2px;
  }

  .dropdown-item {
    padding: 8px 12px;
    font-size: 11px;
  }

  .clear-all-parts-btn {
    padding: 3px 6px;
    font-size: 9px;
    margin-right: 4px;
  }
}

/* Effect Layer Options */
.effect-layer-options {
  margin-left: 20px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(52, 152, 219, 0.2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sub-radio {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sub-radio input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: #9b59b6;
  cursor: pointer;
}

.sub-radio label {
  color: #ecf0f1;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  -webkit-user-select: none;
          user-select: none;
  margin: 0;
  transition: color 0.2s ease;
}

.sub-radio input[type="radio"]:checked + label {
  color: #9b59b6;
  font-weight: 600;
}

.sub-radio:hover label {
  color: #bb77d6;
}

/* ===== PARTS MANAGER PANEL ===== */
.sprite-panel-with-manager {
  display: flex;
  gap: 20px;
  background: rgba(52, 73, 94, 0.95);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  -webkit-backdrop-filter: blur(10px);
          backdrop-filter: blur(10px);
  border: 1px solid rgba(52, 152, 219, 0.2);
  align-items: stretch; /* Đảm bảo cả 2 panel có cùng chiều cao */
  min-height: 600px; /* Chiều cao tối thiểu */
}

.sprite-section {
  flex: 2 1;
  min-width: 400px; /* Đảm bảo có đủ không gian cho sprite sheet */
  overflow: hidden; /* Để container có thể scroll */
  display: flex;
  flex-direction: column;
  /* Đảm bảo alignment với parts manager panel */
  align-self: stretch;
  margin: 0;
  padding: 0;
}

.parts-manager-panel {
  flex: 1 1;
  min-width: 300px;
  max-width: 400px;
  background: rgba(44, 62, 80, 0.8);
  border-radius: 8px;
  padding: 15px;
  border: 1px solid rgba(52, 152, 219, 0.3);
  /* Chiều cao sẽ được sync với sprite container */
  height: -webkit-fit-content;
  height: fit-content;
  min-height: 600px; /* Chiều cao tối thiểu (chiều cao hiện tại) */
  max-height: 100vh; /* Không vượt quá chiều cao màn hình */
  overflow-y: auto;
  /* Đảm bảo panel có cùng chiều cao với sprite section */
  align-self: stretch;
  /* Scrollbar styling đã được áp dụng global */
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  font-weight: 600;
}

.btn-primary.btn-small {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
}

.btn-primary.btn-small:hover {
  background: linear-gradient(135deg, #2980b9, #1f5f8b);
  transform: translateY(-1px);
}

.btn-secondary.btn-small {
  background: linear-gradient(135deg, #95a5a6, #7f8c8d);
  color: white;
}

.btn-secondary.btn-small:hover {
  background: linear-gradient(135deg, #7f8c8d, #6c7b7d);
  transform: translateY(-1px);
}

.btn-danger.btn-small {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

.btn-danger.btn-small:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: translateY(-1px);
}

.btn-full {
  width: 100%;
  padding: 10px;
  margin-top: 10px;
}

/* Selected Part Info */
.selected-part-info {
  background: rgba(52, 152, 219, 0.1);
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.selected-part-info h4 {
  margin: 0 0 15px 0;
  color: #3498db;
  font-size: 16px;
  font-weight: 700;
}

.part-details-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detail-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.detail-group label {
  color: #ecf0f1;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

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

.part-input-small {
  flex: 1 1;
  padding: 8px 10px;
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 6px;
  background: rgba(44, 62, 80, 0.8);
  color: #ecf0f1;
  font-size: 12px;
  text-align: center;
  transition: all 0.3s ease;
}

.part-input-small:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 8px rgba(52, 152, 219, 0.4);
  background: rgba(44, 62, 80, 1);
}

.part-actions-full {
  display: flex;
  gap: 8px;
  margin-top: 15px;
}

/* Add New Part Section */
.add-part-section {
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid rgba(39, 174, 96, 0.3);
  border-radius: 8px;
  padding: 15px;
  margin-bottom: 20px;
}

.add-part-section h4 {
  margin: 0 0 15px 0;
  color: #27ae60;
  font-size: 16px;
  font-weight: 700;
}

.add-part-form .input-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 8px;
  gap: 8px;
  margin-bottom: 10px;
}

/* Parts List Manager */
.parts-list-manager {
  background: rgba(44, 62, 80, 0.6);
  border: 1px solid rgba(52, 152, 219, 0.2);
  border-radius: 8px;
  padding: 15px;
}

.parts-list-manager h4 {
  margin: 0 0 15px 0;
  color: #ecf0f1;
  font-size: 16px;
  font-weight: 700;
}

.parts-list-container {
  max-height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.part-item-manager {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: rgba(52, 73, 94, 0.6);
  border: 1px solid rgba(52, 152, 219, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.part-item-manager:hover {
  background: rgba(52, 152, 219, 0.2);
  border-color: #3498db;
  transform: translateY(-1px);
}

.part-item-manager.selected {
  background: rgba(52, 152, 219, 0.3);
  border-color: #3498db;
  box-shadow: 0 0 10px rgba(52, 152, 219, 0.4);
}

.part-item-manager.used {
  border-left: 4px solid #27ae60;
}

.part-preview-manager {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  background: rgba(44, 62, 80, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

.part-preview-img-manager {
  width: 30px;
  height: 30px;
  object-fit: cover;
  object-position: center;
  image-rendering: pixelated;
  image-rendering: -moz-crisp-edges;
  image-rendering: crisp-edges;
}

.part-preview-placeholder-manager {
  color: #95a5a6;
  font-size: 10px;
  font-weight: 600;
}

.part-info-manager {
  flex: 1 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.part-id-manager {
  color: #3498db;
  font-weight: 700;
  font-size: 12px;
}

.part-size-manager {
  color: #ecf0f1;
  font-size: 10px;
}

.part-pos-manager {
  color: #95a5a6;
  font-size: 10px;
}

.part-actions-manager {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.part-buttons {
  display: flex;
  gap: 4px;
}

.btn-edit-small,
.btn-delete-small {
  width: 24px;
  height: 24px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.btn-edit-small {
  background: linear-gradient(135deg, #f39c12, #e67e22);
  color: white;
}

.btn-edit-small:hover {
  background: linear-gradient(135deg, #e67e22, #d35400);
  transform: scale(1.1);
}

.btn-delete-small {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

.btn-delete-small:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: scale(1.1);
}

.used-badge {
  background: linear-gradient(135deg, #27ae60, #229954);
  color: white;
  padding: 2px 6px;
  border-radius: 10px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== SELECTION TOOL ===== */
.selection-tool {
  background: rgba(39, 174, 96, 0.1);
  border: 1px solid rgba(39, 174, 96, 0.3);
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 15px;
}

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

.tool-header span {
  color: #27ae60;
  font-size: 14px;
  font-weight: 600;
}

.selection-instructions {
  margin-bottom: 8px;
}

.selection-instructions small {
  color: #95a5a6;
  font-style: italic;
}

.selection-info {
  background: rgba(39, 174, 96, 0.1);
  padding: 8px;
  border-radius: 4px;
  margin-top: 8px;
}

.selection-buttons {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.no-selection-message {
  text-align: center;
  padding: 15px;
  background: rgba(149, 165, 166, 0.1);
  border: 1px dashed rgba(149, 165, 166, 0.3);
  border-radius: 6px;
  margin-top: 10px;
}

.no-selection-message small {
  color: #95a5a6;
  font-style: italic;
}

.selection-info small {
  color: #27ae60;
  font-weight: 600;
}

.sprite-canvas-container {
  position: relative;
  overflow: hidden;
  border-radius: 4px;
}

.selection-overlay {
  pointer-events: none;
  z-index: 10;
  transition: all 0.2s ease;
}

.selection-info-overlay {
  pointer-events: none;
  z-index: 11;
  font-family: 'Courier New', monospace;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}



.parts-list {
  max-height: 300px;
  overflow-y: auto;
  padding: 10px;
}

.part-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  margin-bottom: 8px;
  background: rgba(52, 73, 94, 0.6);
  border-radius: 8px;
  border: 1px solid rgba(52, 152, 219, 0.2);
  cursor: pointer;
  transition: all 0.3s ease;
}

.part-item:hover {
  background: rgba(52, 152, 219, 0.2);
  border-color: #3498db;
  transform: translateY(-1px);
}

.part-item.selected {
  background: rgba(231, 76, 60, 0.2);
  border-color: #e74c3c;
  box-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

.part-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.part-id {
  color: #3498db;
  font-weight: 700;
  font-size: 14px;
}

.part-image-id {
  color: #95a5a6;
  font-size: 11px;
}

.part-position,
.part-size {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 11px;
  color: #ecf0f1;
}

.part-position span,
.part-size span {
  background: rgba(52, 152, 219, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  min-width: 40px;
  text-align: center;
}

.part-input {
  width: 50px;
  padding: 2px 4px;
  border: 1px solid rgba(52, 152, 219, 0.3);
  border-radius: 4px;
  background: rgba(44, 62, 80, 0.8);
  color: #ecf0f1;
  font-size: 11px;
  text-align: center;
}

.part-input:focus {
  outline: none;
  border-color: #3498db;
  box-shadow: 0 0 5px rgba(52, 152, 219, 0.5);
}

.timeline-controls input[type="range"] {
  flex: 1 1;
  height: 6px;
  border-radius: 3px;
  background: #34495e;
  outline: none;
  -webkit-appearance: none;
}

.timeline-controls input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #3498db;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
}

.timeline-controls span {
  color: #ecf0f1;
  font-size: 12px;
  font-weight: 500;
}

/* Responsive cho Effect Tool */
@media (max-width: 1200px) {
  .effect-canvas {
    width: 100%;
    max-width: 700px;
  }

  .frame-timeline {
    max-width: 700px;
  }
}

@media (max-width: 768px) {
  .effect-preview-container {
    padding: 15px;
  }

  .effect-canvas {
    width: 100%;
    max-width: 500px;
    height: auto;
  }

  .frame-timeline {
    max-width: 500px;
    padding: 10px;
  }

  .frame-marker {
    min-width: 28px;
    height: 20px;
  }

  .frame-number {
    font-size: 9px;
  }

  .animation-controls {
    flex-direction: column;
    gap: 15px;
    padding: 15px;
  }

  .zoom-controls {
    justify-content: center;
  }

  .checkbox-control {
    justify-content: center;
    padding: 6px 12px;
  }

  .checkbox-control label {
    font-size: 11px;
  }

  .timeline-controls {
    gap: 10px;
  }

  .timeline-buttons {
    justify-content: center;
  }

  .timeline-options {
    flex-direction: column;
    gap: 15px;
    align-items: center;
  }

  .speed-control input[type="range"] {
    width: 150px;
  }

  .all-parts-panel-overlay,
  .current-parts-panel-overlay {
    position: static !important;
    width: 100% !important;
    max-height: 200px !important; /* Giới hạn chiều cao trên mobile */
    height: auto !important; /* Override chiều cao cố định trên mobile */
    margin-top: 15px;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
  }

  .all-parts-panel-overlay {
    margin-bottom: 15px;
  }

  .draggable-header {
    cursor: default !important;
  }

  .sprite-container {
    /* Giảm max-height trên mobile để tiết kiệm không gian */
    max-height: 400px;
  }

  .file-inputs {
    flex-direction: column;
    gap: 10px;
  }

  .effect-info-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .effect-canvas {
    max-width: 100%;
    width: 100%;
  }

  .frame-timeline {
    max-width: 100%;
  }

  .notification {
    position: fixed;
    top: 10px;
    left: 10px;
    right: 10px;
    max-width: none;
    font-size: 14px;
  }
}

/* Add Image Section */
.add-image-section {
  margin-bottom: 20px;
  padding: 15px;
  background: #f0f8ff;
  border-radius: 8px;
  border: 1px solid #b3d9ff;
}

.add-image-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.add-image-info {
  text-align: center;
  color: #666;
  font-style: italic;
}

.width-limit-setting {
  margin-bottom: 15px;
  padding: 12px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.width-limit-setting label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: #495057;
  font-size: 14px;
}

.width-limit-slider {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #e9ecef;
  outline: none;
  -webkit-appearance: none;
  margin-bottom: 8px;
}

.width-limit-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007bff, #0056b3);
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
}

.width-limit-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, #007bff, #0056b3);
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 6px rgba(0, 123, 255, 0.3);
}

.width-limit-info {
  text-align: center;
  color: #6c757d;
  font-size: 12px;
  font-style: italic;
}

/* Width Presets */
.width-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
  justify-content: center;
}

.btn-preset {
  padding: 6px 12px;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  background: white;
  color: #495057;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  min-width: 50px;
  text-align: center;
}

.btn-preset:hover {
  border-color: #007bff;
  background: #f8f9ff;
  color: #007bff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 123, 255, 0.2);
}

.btn-preset.active {
  border-color: #007bff;
  background: linear-gradient(135deg, #007bff, #0056b3);
  color: white;
  box-shadow: 0 3px 12px rgba(0, 123, 255, 0.3);
}

.btn-preset.active:hover {
  background: linear-gradient(135deg, #0056b3, #004085);
  transform: translateY(-1px) scale(1.02);
}

/* Width Manual Input */
.width-manual-input {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  justify-content: center;
}

.width-number-input {
  width: 80px;
  padding: 8px 10px;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  background: white;
  color: #495057;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  transition: all 0.3s ease;
}

.width-number-input:focus {
  outline: none;
  border-color: #007bff;
  box-shadow: 0 0 8px rgba(0, 123, 255, 0.3);
  background: #f8f9ff;
}

.input-unit {
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  margin-left: 2px;
}

/* Loading state for add image button */
.btn-secondary.loading {
  background: linear-gradient(135deg, #ffc107, #fd7e14);
  color: white;
  cursor: not-allowed;
  animation: loadingPulse 1.5s ease-in-out infinite;
}

.btn-secondary.loading:hover {
  transform: none;
  box-shadow: 0 4px 15px rgba(255, 193, 7, 0.4);
}

@keyframes loadingPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.02);
  }
}

/* Backend Connection Status */
.backend-status {
  position: absolute;
  top: 10px;
  right: 20px;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 1000;
}

.backend-status.connected {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  box-shadow: 0 2px 10px rgba(40, 167, 69, 0.3);
}

.backend-status.disconnected {
  background: linear-gradient(135deg, #dc3545, #e74c3c);
  color: white;
  box-shadow: 0 2px 10px rgba(220, 53, 69, 0.3);
  animation: statusPulse 2s ease-in-out infinite;
}

@keyframes statusPulse {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.8;
    transform: scale(1.05);
  }
}

/* Backend Warning */
.backend-warning {
  background: linear-gradient(135deg, #ff6b6b, #ee5a52);
  border: 2px solid #ff4757;
  border-radius: 12px;
  padding: 20px;
  margin: 20px 0;
  box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3);
  animation: warningPulse 3s ease-in-out infinite;
}

.warning-content {
  display: flex;
  align-items: flex-start;
  gap: 15px;
}

.warning-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.warning-text {
  color: white;
  flex: 1 1;
}

.warning-text strong {
  display: block;
  font-size: 18px;
  margin-bottom: 8px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.warning-text p {
  margin: 0;
  font-size: 14px;
  opacity: 0.9;
  line-height: 1.4;
}

@keyframes warningPulse {
  0%, 100% {
    box-shadow: 0 4px 20px rgba(255, 107, 107, 0.3);
  }
  50% {
    box-shadow: 0 6px 25px rgba(255, 107, 107, 0.5);
  }
}

/* Upload Guide Styles */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.section-header h3 {
  margin: 0;
  color: #333;
  font-size: 18px;
}

.btn-help {
  background: linear-gradient(135deg, #17a2b8, #138496);
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(23, 162, 184, 0.3);
}

.btn-help:hover {
  background: linear-gradient(135deg, #138496, #117a8b);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(23, 162, 184, 0.4);
}

.upload-guide {
  background: linear-gradient(135deg, #f8f9fa, #e9ecef);
  border: 2px solid #dee2e6;
  border-radius: 12px;
  padding: 25px;
  margin-bottom: 25px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.guide-content h4 {
  color: #2c3e50;
  font-size: 20px;
  margin-bottom: 20px;
  text-align: center;
  border-bottom: 2px solid #3498db;
  padding-bottom: 10px;
}

.guide-section {
  margin-bottom: 20px;
  background: white;
  padding: 15px;
  border-radius: 8px;
  border-left: 4px solid #3498db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.guide-section h5 {
  color: #2980b9;
  font-size: 16px;
  margin-bottom: 10px;
  font-weight: 700;
}

.guide-section ul {
  margin: 0;
  padding-left: 20px;
}

.guide-section li {
  margin-bottom: 8px;
  line-height: 1.5;
  color: #495057;
}

.guide-section li strong {
  color: #2c3e50;
  font-weight: 600;
}

.guide-tips {
  background: linear-gradient(135deg, #fff3cd, #ffeaa7);
  border: 2px solid #ffc107;
  border-radius: 8px;
  padding: 15px;
  margin-top: 20px;
}

.guide-tips h5 {
  color: #856404;
  font-size: 16px;
  margin-bottom: 10px;
  font-weight: 700;
}

.guide-tips ul {
  margin: 0;
  padding-left: 20px;
}

.guide-tips li {
  margin-bottom: 8px;
  line-height: 1.5;
  color: #856404;
}

.guide-tips li strong {
  color: #6c5ce7;
  font-weight: 600;
}

/* Panel Title Section */
.panel-title-section {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  flex: 1 1;
}

.panel-title-section h4 {
  margin: 0 0 4px 0;
  color: white;
  font-size: 14px;
  font-weight: 600;
}

.panel-title-section .panel-info-mini {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  margin: 0;
}

/* Add All Button */
.btn-add-all {
  background: linear-gradient(135deg, #28a745, #20c997);
  color: white;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 2px 8px rgba(40, 167, 69, 0.3);
  white-space: nowrap;
}

.btn-add-all:hover:not(:disabled) {
  background: linear-gradient(135deg, #20c997, #17a2b8);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(40, 167, 69, 0.4);
}

.btn-add-all:disabled {
  background: #6c757d;
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

/* Update panel header mini to use flexbox */
.panel-header-mini.draggable-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

:root {
  --toastify-color-light: #fff;
  --toastify-color-dark: #121212;
  --toastify-color-info: #3498db;
  --toastify-color-success: #07bc0c;
  --toastify-color-warning: #f1c40f;
  --toastify-color-error: hsl(6, 78%, 57%);
  --toastify-color-transparent: rgba(255, 255, 255, 0.7);

  --toastify-icon-color-info: var(--toastify-color-info);
  --toastify-icon-color-success: var(--toastify-color-success);
  --toastify-icon-color-warning: var(--toastify-color-warning);
  --toastify-icon-color-error: var(--toastify-color-error);

  --toastify-container-width: fit-content;
  --toastify-toast-width: 320px;
  --toastify-toast-offset: 16px;
  --toastify-toast-top: max(var(--toastify-toast-offset), env(safe-area-inset-top));
  --toastify-toast-right: max(var(--toastify-toast-offset), env(safe-area-inset-right));
  --toastify-toast-left: max(var(--toastify-toast-offset), env(safe-area-inset-left));
  --toastify-toast-bottom: max(var(--toastify-toast-offset), env(safe-area-inset-bottom));
  --toastify-toast-background: #fff;
  --toastify-toast-padding: 14px;
  --toastify-toast-min-height: 64px;
  --toastify-toast-max-height: 800px;
  --toastify-toast-bd-radius: 6px;
  --toastify-toast-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
  --toastify-font-family: sans-serif;
  --toastify-z-index: 9999;
  --toastify-text-color-light: #757575;
  --toastify-text-color-dark: #fff;

  /* Used only for colored theme */
  --toastify-text-color-info: #fff;
  --toastify-text-color-success: #fff;
  --toastify-text-color-warning: #fff;
  --toastify-text-color-error: #fff;

  --toastify-spinner-color: #616161;
  --toastify-spinner-color-empty-area: #e0e0e0;
  --toastify-color-progress-light: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);
  --toastify-color-progress-dark: #bb86fc;
  --toastify-color-progress-info: var(--toastify-color-info);
  --toastify-color-progress-success: var(--toastify-color-success);
  --toastify-color-progress-warning: var(--toastify-color-warning);
  --toastify-color-progress-error: var(--toastify-color-error);
  /* used to control the opacity of the progress trail */
  --toastify-color-progress-bgo: 0.2;
}

.Toastify__toast-container {
  z-index: 9999;
  z-index: var(--toastify-z-index);
  -webkit-transform: translate3d(0, 0, 9999);
  -webkit-transform: translate3d(0, 0, var(--toastify-z-index));
  position: fixed;
  width: -webkit-fit-content;
  width: fit-content;
  width: var(--toastify-container-width);
  box-sizing: border-box;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.Toastify__toast-container--top-left {
  top: max(16px, env(safe-area-inset-top));
  top: var(--toastify-toast-top);
  left: max(16px, env(safe-area-inset-left));
  left: var(--toastify-toast-left);
}
.Toastify__toast-container--top-center {
  top: max(16px, env(safe-area-inset-top));
  top: var(--toastify-toast-top);
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}
.Toastify__toast-container--top-right {
  top: max(16px, env(safe-area-inset-top));
  top: var(--toastify-toast-top);
  right: max(16px, env(safe-area-inset-right));
  right: var(--toastify-toast-right);
  align-items: end;
}
.Toastify__toast-container--bottom-left {
  bottom: max(16px, env(safe-area-inset-bottom));
  bottom: var(--toastify-toast-bottom);
  left: max(16px, env(safe-area-inset-left));
  left: var(--toastify-toast-left);
}
.Toastify__toast-container--bottom-center {
  bottom: max(16px, env(safe-area-inset-bottom));
  bottom: var(--toastify-toast-bottom);
  left: 50%;
  transform: translateX(-50%);
  align-items: center;
}
.Toastify__toast-container--bottom-right {
  bottom: max(16px, env(safe-area-inset-bottom));
  bottom: var(--toastify-toast-bottom);
  right: max(16px, env(safe-area-inset-right));
  right: var(--toastify-toast-right);
  align-items: end;
}

.Toastify__toast {
  --y: 0;
  position: relative;
  touch-action: none;
  width: 320px;
  width: var(--toastify-toast-width);
  min-height: 64px;
  min-height: var(--toastify-toast-min-height);
  box-sizing: border-box;
  margin-bottom: 1rem;
  padding: 14px;
  padding: var(--toastify-toast-padding);
  border-radius: 6px;
  border-radius: var(--toastify-toast-bd-radius);
  box-shadow: 0px 4px 12px rgba(0, 0, 0, 0.1);
  box-shadow: var(--toastify-toast-shadow);
  max-height: 800px;
  max-height: var(--toastify-toast-max-height);
  font-family: sans-serif;
  font-family: var(--toastify-font-family);
  /* webkit only issue #791 */
  z-index: 0;
  /* inner swag */
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  word-break: break-word;
}

@media only screen and (max-width: 480px) {
  .Toastify__toast-container {
    width: 100vw;
    left: env(safe-area-inset-left);
    margin: 0;
  }
  .Toastify__toast-container--top-left,
  .Toastify__toast-container--top-center,
  .Toastify__toast-container--top-right {
    top: env(safe-area-inset-top);
    transform: translateX(0);
  }
  .Toastify__toast-container--bottom-left,
  .Toastify__toast-container--bottom-center,
  .Toastify__toast-container--bottom-right {
    bottom: env(safe-area-inset-bottom);
    transform: translateX(0);
  }
  .Toastify__toast-container--rtl {
    right: env(safe-area-inset-right);
    left: auto;
    left: initial;
  }
  .Toastify__toast {
    --toastify-toast-width: 100%;
    margin-bottom: 0;
    border-radius: 0;
  }
}

.Toastify__toast-container[data-stacked='true'] {
  width: 320px;
  width: var(--toastify-toast-width);
}

.Toastify__toast--stacked {
  position: absolute;
  width: 100%;
  transform: translate3d(0, var(--y), 0) scale(var(--s));
  transition: transform 0.3s;
}

.Toastify__toast--stacked[data-collapsed] .Toastify__toast-body,
.Toastify__toast--stacked[data-collapsed] .Toastify__close-button {
  transition: opacity 0.1s;
}

.Toastify__toast--stacked[data-collapsed='false'] {
  overflow: visible;
}

.Toastify__toast--stacked[data-collapsed='true']:not(:last-child) > * {
  opacity: 0;
}

.Toastify__toast--stacked:after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: calc(var(--g) * 1px);
  bottom: 100%;
}

.Toastify__toast--stacked[data-pos='top'] {
  top: 0;
}

.Toastify__toast--stacked[data-pos='bot'] {
  bottom: 0;
}

.Toastify__toast--stacked[data-pos='bot'].Toastify__toast--stacked:before {
  transform-origin: top;
}

.Toastify__toast--stacked[data-pos='top'].Toastify__toast--stacked:before {
  transform-origin: bottom;
}

.Toastify__toast--stacked:before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 100%;
  transform: scaleY(3);
  z-index: -1;
}

.Toastify__toast--rtl {
  direction: rtl;
}

.Toastify__toast--close-on-click {
  cursor: pointer;
}

.Toastify__toast-icon {
  -webkit-margin-end: 10px;
          margin-inline-end: 10px;
  width: 22px;
  flex-shrink: 0;
  display: flex;
}

.Toastify--animate {
  animation-fill-mode: both;
  animation-duration: 0.5s;
}

.Toastify--animate-icon {
  animation-fill-mode: both;
  animation-duration: 0.3s;
}

.Toastify__toast-theme--dark {
  background: #121212;
  background: var(--toastify-color-dark);
  color: #fff;
  color: var(--toastify-text-color-dark);
}

.Toastify__toast-theme--light {
  background: #fff;
  background: var(--toastify-color-light);
  color: #757575;
  color: var(--toastify-text-color-light);
}

.Toastify__toast-theme--colored.Toastify__toast--default {
  background: #fff;
  background: var(--toastify-color-light);
  color: #757575;
  color: var(--toastify-text-color-light);
}

.Toastify__toast-theme--colored.Toastify__toast--info {
  color: #fff;
  color: var(--toastify-text-color-info);
  background: #3498db;
  background: var(--toastify-color-info);
}

.Toastify__toast-theme--colored.Toastify__toast--success {
  color: #fff;
  color: var(--toastify-text-color-success);
  background: #07bc0c;
  background: var(--toastify-color-success);
}

.Toastify__toast-theme--colored.Toastify__toast--warning {
  color: #fff;
  color: var(--toastify-text-color-warning);
  background: #f1c40f;
  background: var(--toastify-color-warning);
}

.Toastify__toast-theme--colored.Toastify__toast--error {
  color: #fff;
  color: var(--toastify-text-color-error);
  background: hsl(6, 78%, 57%);
  background: var(--toastify-color-error);
}

.Toastify__progress-bar-theme--light {
  background: linear-gradient(to right, #4cd964, #5ac8fa, #007aff, #34aadc, #5856d6, #ff2d55);
  background: var(--toastify-color-progress-light);
}

.Toastify__progress-bar-theme--dark {
  background: #bb86fc;
  background: var(--toastify-color-progress-dark);
}

.Toastify__progress-bar--info {
  background: #3498db;
  background: var(--toastify-color-progress-info);
}

.Toastify__progress-bar--success {
  background: #07bc0c;
  background: var(--toastify-color-progress-success);
}

.Toastify__progress-bar--warning {
  background: #f1c40f;
  background: var(--toastify-color-progress-warning);
}

.Toastify__progress-bar--error {
  background: hsl(6, 78%, 57%);
  background: var(--toastify-color-progress-error);
}

.Toastify__progress-bar-theme--colored.Toastify__progress-bar--info,
.Toastify__progress-bar-theme--colored.Toastify__progress-bar--success,
.Toastify__progress-bar-theme--colored.Toastify__progress-bar--warning,
.Toastify__progress-bar-theme--colored.Toastify__progress-bar--error {
  background: rgba(255, 255, 255, 0.7);
  background: var(--toastify-color-transparent);
}

.Toastify__close-button {
  color: #fff;
  position: absolute;
  top: 6px;
  right: 6px;
  background: transparent;
  outline: none;
  border: none;
  padding: 0;
  cursor: pointer;
  opacity: 0.7;
  transition: 0.3s ease;
  z-index: 1;
}

.Toastify__toast--rtl .Toastify__close-button {
  left: 6px;
  right: auto;
  right: initial;
}

.Toastify__close-button--light {
  color: #000;
  opacity: 0.3;
}

.Toastify__close-button > svg {
  fill: currentColor;
  height: 16px;
  width: 14px;
}

.Toastify__close-button:hover,
.Toastify__close-button:focus {
  opacity: 1;
}

@keyframes Toastify__trackProgress {
  0% {
    transform: scaleX(1);
  }
  100% {
    transform: scaleX(0);
  }
}

.Toastify__progress-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  opacity: 0.7;
  transform-origin: left;
}

.Toastify__progress-bar--animated {
  animation: Toastify__trackProgress linear 1 forwards;
}

.Toastify__progress-bar--controlled {
  transition: transform 0.2s;
}

.Toastify__progress-bar--rtl {
  right: 0;
  left: auto;
  left: initial;
  transform-origin: right;
  border-bottom-left-radius: 0;
  border-bottom-left-radius: initial;
}

.Toastify__progress-bar--wrp {
  position: absolute;
  overflow: hidden;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 5px;
  border-bottom-left-radius: 6px;
  border-bottom-left-radius: var(--toastify-toast-bd-radius);
  border-bottom-right-radius: 6px;
  border-bottom-right-radius: var(--toastify-toast-bd-radius);
}

.Toastify__progress-bar--wrp[data-hidden='true'] {
  opacity: 0;
}

.Toastify__progress-bar--bg {
  opacity: 0.2;
  opacity: var(--toastify-color-progress-bgo);
  width: 100%;
  height: 100%;
}

.Toastify__spinner {
  width: 20px;
  height: 20px;
  box-sizing: border-box;
  border: 2px solid;
  border-radius: 100%;
  border-color: #e0e0e0;
  border-color: var(--toastify-spinner-color-empty-area);
  border-right-color: #616161;
  border-right-color: var(--toastify-spinner-color);
  animation: Toastify__spin 0.65s linear infinite;
}

@keyframes Toastify__bounceInRight {
  from,
  60%,
  75%,
  90%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }
  from {
    opacity: 0;
    transform: translate3d(3000px, 0, 0);
  }
  60% {
    opacity: 1;
    transform: translate3d(-25px, 0, 0);
  }
  75% {
    transform: translate3d(10px, 0, 0);
  }
  90% {
    transform: translate3d(-5px, 0, 0);
  }
  to {
    transform: none;
  }
}

@keyframes Toastify__bounceOutRight {
  20% {
    opacity: 1;
    transform: translate3d(-20px, var(--y), 0);
  }
  to {
    opacity: 0;
    transform: translate3d(2000px, var(--y), 0);
  }
}

@keyframes Toastify__bounceInLeft {
  from,
  60%,
  75%,
  90%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }
  0% {
    opacity: 0;
    transform: translate3d(-3000px, 0, 0);
  }
  60% {
    opacity: 1;
    transform: translate3d(25px, 0, 0);
  }
  75% {
    transform: translate3d(-10px, 0, 0);
  }
  90% {
    transform: translate3d(5px, 0, 0);
  }
  to {
    transform: none;
  }
}

@keyframes Toastify__bounceOutLeft {
  20% {
    opacity: 1;
    transform: translate3d(20px, var(--y), 0);
  }
  to {
    opacity: 0;
    transform: translate3d(-2000px, var(--y), 0);
  }
}

@keyframes Toastify__bounceInUp {
  from,
  60%,
  75%,
  90%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }
  from {
    opacity: 0;
    transform: translate3d(0, 3000px, 0);
  }
  60% {
    opacity: 1;
    transform: translate3d(0, -20px, 0);
  }
  75% {
    transform: translate3d(0, 10px, 0);
  }
  90% {
    transform: translate3d(0, -5px, 0);
  }
  to {
    transform: translate3d(0, 0, 0);
  }
}

@keyframes Toastify__bounceOutUp {
  20% {
    transform: translate3d(0, calc(var(--y) - 10px), 0);
  }
  40%,
  45% {
    opacity: 1;
    transform: translate3d(0, calc(var(--y) + 20px), 0);
  }
  to {
    opacity: 0;
    transform: translate3d(0, -2000px, 0);
  }
}

@keyframes Toastify__bounceInDown {
  from,
  60%,
  75%,
  90%,
  to {
    animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
  }
  0% {
    opacity: 0;
    transform: translate3d(0, -3000px, 0);
  }
  60% {
    opacity: 1;
    transform: translate3d(0, 25px, 0);
  }
  75% {
    transform: translate3d(0, -10px, 0);
  }
  90% {
    transform: translate3d(0, 5px, 0);
  }
  to {
    transform: none;
  }
}

@keyframes Toastify__bounceOutDown {
  20% {
    transform: translate3d(0, calc(var(--y) - 10px), 0);
  }
  40%,
  45% {
    opacity: 1;
    transform: translate3d(0, calc(var(--y) + 20px), 0);
  }
  to {
    opacity: 0;
    transform: translate3d(0, 2000px, 0);
  }
}

.Toastify__bounce-enter--top-left,
.Toastify__bounce-enter--bottom-left {
  animation-name: Toastify__bounceInLeft;
}

.Toastify__bounce-enter--top-right,
.Toastify__bounce-enter--bottom-right {
  animation-name: Toastify__bounceInRight;
}

.Toastify__bounce-enter--top-center {
  animation-name: Toastify__bounceInDown;
}

.Toastify__bounce-enter--bottom-center {
  animation-name: Toastify__bounceInUp;
}

.Toastify__bounce-exit--top-left,
.Toastify__bounce-exit--bottom-left {
  animation-name: Toastify__bounceOutLeft;
}

.Toastify__bounce-exit--top-right,
.Toastify__bounce-exit--bottom-right {
  animation-name: Toastify__bounceOutRight;
}

.Toastify__bounce-exit--top-center {
  animation-name: Toastify__bounceOutUp;
}

.Toastify__bounce-exit--bottom-center {
  animation-name: Toastify__bounceOutDown;
}

@keyframes Toastify__zoomIn {
  from {
    opacity: 0;
    transform: scale3d(0.3, 0.3, 0.3);
  }
  50% {
    opacity: 1;
  }
}

@keyframes Toastify__zoomOut {
  from {
    opacity: 1;
  }
  50% {
    opacity: 0;
    transform: translate3d(0, var(--y), 0) scale3d(0.3, 0.3, 0.3);
  }
  to {
    opacity: 0;
  }
}

.Toastify__zoom-enter {
  animation-name: Toastify__zoomIn;
}

.Toastify__zoom-exit {
  animation-name: Toastify__zoomOut;
}

@keyframes Toastify__flipIn {
  from {
    transform: perspective(400px) rotate3d(1, 0, 0, 90deg);
    animation-timing-function: ease-in;
    opacity: 0;
  }
  40% {
    transform: perspective(400px) rotate3d(1, 0, 0, -20deg);
    animation-timing-function: ease-in;
  }
  60% {
    transform: perspective(400px) rotate3d(1, 0, 0, 10deg);
    opacity: 1;
  }
  80% {
    transform: perspective(400px) rotate3d(1, 0, 0, -5deg);
  }
  to {
    transform: perspective(400px);
  }
}

@keyframes Toastify__flipOut {
  from {
    transform: translate3d(0, var(--y), 0) perspective(400px);
  }
  30% {
    transform: translate3d(0, var(--y), 0) perspective(400px) rotate3d(1, 0, 0, -20deg);
    opacity: 1;
  }
  to {
    transform: translate3d(0, var(--y), 0) perspective(400px) rotate3d(1, 0, 0, 90deg);
    opacity: 0;
  }
}

.Toastify__flip-enter {
  animation-name: Toastify__flipIn;
}

.Toastify__flip-exit {
  animation-name: Toastify__flipOut;
}

@keyframes Toastify__slideInRight {
  from {
    transform: translate3d(110%, 0, 0);
    visibility: visible;
  }
  to {
    transform: translate3d(0, var(--y), 0);
  }
}

@keyframes Toastify__slideInLeft {
  from {
    transform: translate3d(-110%, 0, 0);
    visibility: visible;
  }
  to {
    transform: translate3d(0, var(--y), 0);
  }
}

@keyframes Toastify__slideInUp {
  from {
    transform: translate3d(0, 110%, 0);
    visibility: visible;
  }
  to {
    transform: translate3d(0, var(--y), 0);
  }
}

@keyframes Toastify__slideInDown {
  from {
    transform: translate3d(0, -110%, 0);
    visibility: visible;
  }
  to {
    transform: translate3d(0, var(--y), 0);
  }
}

@keyframes Toastify__slideOutRight {
  from {
    transform: translate3d(0, var(--y), 0);
  }
  to {
    visibility: hidden;
    transform: translate3d(110%, var(--y), 0);
  }
}

@keyframes Toastify__slideOutLeft {
  from {
    transform: translate3d(0, var(--y), 0);
  }
  to {
    visibility: hidden;
    transform: translate3d(-110%, var(--y), 0);
  }
}

@keyframes Toastify__slideOutDown {
  from {
    transform: translate3d(0, var(--y), 0);
  }
  to {
    visibility: hidden;
    transform: translate3d(0, 500px, 0);
  }
}

@keyframes Toastify__slideOutUp {
  from {
    transform: translate3d(0, var(--y), 0);
  }
  to {
    visibility: hidden;
    transform: translate3d(0, -500px, 0);
  }
}

.Toastify__slide-enter--top-left,
.Toastify__slide-enter--bottom-left {
  animation-name: Toastify__slideInLeft;
}

.Toastify__slide-enter--top-right,
.Toastify__slide-enter--bottom-right {
  animation-name: Toastify__slideInRight;
}

.Toastify__slide-enter--top-center {
  animation-name: Toastify__slideInDown;
}

.Toastify__slide-enter--bottom-center {
  animation-name: Toastify__slideInUp;
}

.Toastify__slide-exit--top-left,
.Toastify__slide-exit--bottom-left {
  animation-name: Toastify__slideOutLeft;
  animation-timing-function: ease-in;
  animation-duration: 0.3s;
}

.Toastify__slide-exit--top-right,
.Toastify__slide-exit--bottom-right {
  animation-name: Toastify__slideOutRight;
  animation-timing-function: ease-in;
  animation-duration: 0.3s;
}

.Toastify__slide-exit--top-center {
  animation-name: Toastify__slideOutUp;
  animation-timing-function: ease-in;
  animation-duration: 0.3s;
}

.Toastify__slide-exit--bottom-center {
  animation-name: Toastify__slideOutDown;
  animation-timing-function: ease-in;
  animation-duration: 0.3s;
}

@keyframes Toastify__spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

/* ===== FREE BADGE STYLING - PERFORMANCE OPTIMIZED ===== */
.free-badge {
  display: inline-block;
  background: #10b981;
  color: white;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.7em;
  font-weight: bold;
  margin-left: 8px;
  /* Tắt animation để giảm lag */
  /* animation: freePulse 2s infinite; */
  /* box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3); */
  /* border: 2px solid rgba(255, 255, 255, 0.2); */
}

/* Tắt animation để giảm lag */
/*
@keyframes freePulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.3);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(16, 185, 129, 0.5);
  }
}
*/

.App {
  text-align: center;
  min-height: 100vh;
  background: #667eea; /* Tắt gradient để giảm lag */
}

/* Global scrollbar styling cho toàn bộ ứng dụng */
html, body {
  /* Firefox scrollbar */
  scrollbar-width: thin;
  scrollbar-color: #3498db #34495e;
}

/* Webkit scrollbar cho html và body */
html::-webkit-scrollbar,
body::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

html::-webkit-scrollbar-track,
body::-webkit-scrollbar-track {
  background: #34495e;
  border-radius: 6px;
}

html::-webkit-scrollbar-thumb,
body::-webkit-scrollbar-thumb {
  background: #3498db;
  border-radius: 6px;
  border: 2px solid #34495e;
}

html::-webkit-scrollbar-thumb:hover,
body::-webkit-scrollbar-thumb:hover {
  background: #2980b9;
}

html::-webkit-scrollbar-corner,
body::-webkit-scrollbar-corner {
  background: #34495e;
}

.App-header {
  background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
  padding: 20px;
  color: white;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.App-header h1 {
  margin: 0 0 10px 0;
  font-size: 2.5rem;
  font-weight: bold;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.App-header p {
  margin: 0;
  font-size: 1.1rem;
  opacity: 0.9;
}

.App-main {
  padding: 20px;
  max-width: 1400px;
  margin: 0 auto;
}

/* Global styles */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
    sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  cursor: pointer;
  border: none;
  border-radius: 6px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

button:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn-success {
  background: linear-gradient(135deg, #56ab2f 0%, #a8e6cf 100%);
  color: white;
}

.btn-danger {
  background: linear-gradient(135deg, #ff416c 0%, #ff4b2b 100%);
  color: white;
}

.btn-secondary {
  background: linear-gradient(135deg, #bdc3c7 0%, #2c3e50 100%);
  color: white;
}

/* Page Transition Animations */
.page-transition {
  width: 100%;
  min-height: 100vh;
  position: relative;
  overflow: hidden;
}

.page-transition.transitioning {
  pointer-events: none;
}

.page-transition.fadeIn {
  animation: smoothFadeIn 0.6s cubic-bezier(0.23, 1, 0.32, 1) forwards;
}

.page-transition.fadeOut {
  animation: smoothFadeOut 0.4s cubic-bezier(0.755, 0.05, 0.855, 0.06) forwards;
}

@keyframes smoothFadeIn {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.95);
    filter: blur(8px) brightness(1.1);
  }
  50% {
    opacity: 0.7;
    transform: translateY(20px) scale(0.98);
    filter: blur(4px) brightness(1.05);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0) brightness(1);
  }
}

@keyframes smoothFadeOut {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0) brightness(1);
  }
  50% {
    opacity: 0.3;
    transform: translateY(-20px) scale(0.98);
    filter: blur(4px) brightness(0.95);
  }
  100% {
    opacity: 0;
    transform: translateY(-40px) scale(0.95);
    filter: blur(8px) brightness(0.9);
  }
}

/* Smooth scroll behavior */
html {
  scroll-behavior: smooth;
}

/* Enhanced focus styles */
*:focus {
  outline: 2px solid #667eea;
  outline-offset: 2px;
}

/* Loading animation */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

.loading-shimmer {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

