:root {
  --primary-color: #9b59b6;
  --secondary-color: #8e44ad;
  --accent-color: #e74c3c;
  --light-color: #f5f5f5;
  --dark-color: #333;
  --success-color: #2ecc71;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: #f0f2f5;
  color: var(--dark-color);
  line-height: 1.6;
  padding: 20px;
  opacity: 0;
  animation: fadeIn 0.8s ease-out forwards;
}

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

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

header {
  text-align: center;
  margin-bottom: 30px;
  padding: 20px;
  background-color: white;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  transform: translateY(-20px);
  opacity: 0;
  animation: slideDown 0.8s ease-out 0.2s forwards;
}

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

h1 {
  color: var(--primary-color);
  margin-bottom: 10px;
}

.description {
  color: #666;
  max-width: 800px;
  margin: 0 auto;
}

.method-navigation {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
  gap: 10px;
}

.nav-btn {
  padding: 10px 20px;
  background-color: white;
  border: 2px solid var(--primary-color);
  color: var(--primary-color);
  border-radius: 5px;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  text-decoration: none;
}

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

.nav-btn:hover {
  background-color: var(--primary-color);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.main-content {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  opacity: 0;
  animation: fadeIn 0.8s ease-out 0.4s forwards;
}

@media (max-width: 768px) {
  .main-content {
    grid-template-columns: 1fr;
  }
}

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

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.card h2 {
  color: var(--primary-color);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #eee;
}

.form-group {
  margin-bottom: 15px;
}

.balance-info {
  margin-top: 10px;
  padding: 10px;
  background-color: rgba(46, 204, 113, 0.1);
  border-radius: 5px;
  font-weight: 500;
  transition: all 0.3s ease;
}

.balance-warning {
  margin-top: 10px;
  padding: 10px;
  background-color: rgba(231, 76, 60, 0.1);
  border-radius: 5px;
  font-weight: 500;
  color: var(--accent-color);
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { background-color: rgba(231, 76, 60, 0.1); }
  50% { background-color: rgba(231, 76, 60, 0.2); }
  100% { background-color: rgba(231, 76, 60, 0.1); }
}

label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

input, select {
  width: 100%;
  padding: 10px;
  border: 1px solid #ddd;
  border-radius: 5px;
  font-size: 16px;
  transition: all 0.3s ease;
}

input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px rgba(155, 89, 182, 0.2);
  outline: none;
}

button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 20px;
  border-radius: 5px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5px;
  height: 5px;
  background: rgba(255, 255, 255, 0.5);
  opacity: 0;
  border-radius: 100%;
  transform: scale(1, 1) translate(-50%);
  transform-origin: 50% 50%;
}

button:focus:not(:active)::after {
  animation: ripple 1s ease-out;
}

@keyframes ripple {
  0% {
    transform: scale(0, 0);
    opacity: 0.5;
  }
  100% {
    transform: scale(20, 20);
    opacity: 0;
  }
}

button:hover {
  background-color: var(--secondary-color);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn-calculate {
  background-color: var(--success-color);
  width: 100%;
  margin-top: 10px;
}

.btn-calculate:hover {
  background-color: #27ae60;
}

.matrix-container {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  opacity: 0;
  animation: fadeIn 0.5s ease-out forwards;
}

th, td {
  border: 1px solid #ddd;
  padding: 10px;
  text-align: center;
  transition: all 0.3s ease;
}

th {
  background-color: var(--light-color);
  font-weight: 600;
}

.supply-cell, .demand-cell {
  background-color: #f9f9f9;
  font-weight: 600;
}

.least-cost-cell {
  background-color: rgba(155, 89, 182, 0.2);
  font-weight: bold;
  animation: highlight 1.5s ease-out;
}

@keyframes highlight {
  0% { background-color: rgba(155, 89, 182, 0); }
  50% { background-color: rgba(155, 89, 182, 0.5); }
  100% { background-color: rgba(155, 89, 182, 0.2); }
}

.allocated-cell {
  background-color: rgba(46, 204, 113, 0.2);
  animation: allocated 0.8s ease-out;
}

@keyframes allocated {
  0% { background-color: rgba(46, 204, 113, 0); transform: scale(0.9); }
  70% { background-color: rgba(46, 204, 113, 0.5); transform: scale(1.05); }
  100% { background-color: rgba(46, 204, 113, 0.2); transform: scale(1); }
}

.cost-cell {
  position: relative;
}

.cost-value {
  font-weight: bold;
}

.step-container {
  margin-top: 20px;
}

.step {
  margin-bottom: 15px;
  padding: 15px;
  background-color: var(--light-color);
  border-radius: 5px;
  border-left: 4px solid var(--primary-color);
  transform: translateX(-20px);
  opacity: 0;
  animation: slideIn 0.5s ease-out forwards;
}

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

.step:nth-child(even) {
  animation-delay: 0.1s;
}

.step-number {
  display: inline-block;
  background-color: var(--primary-color);
  color: white;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  text-align: center;
  line-height: 25px;
  margin-right: 10px;
  font-weight: bold;
  animation: bounceIn 0.5s ease-out;
}

@keyframes bounceIn {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.result-container {
  margin-top: 20px;
  padding: 15px;
  background-color: rgba(46, 204, 113, 0.1);
  border-radius: 5px;
  border-left: 4px solid var(--success-color);
  transform: scale(0.9);
  opacity: 0;
  animation: zoomIn 0.5s ease-out forwards;
}

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

.result-value {
  font-size: 18px;
  font-weight: bold;
  color: var(--success-color);
  margin-top: 10px;
  animation: countUp 1.5s ease-out;
}

@keyframes countUp {
  from { transform: scale(1.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.instructions {
  margin-top: 30px;
  opacity: 0;
  animation: fadeIn 0.8s ease-out 0.6s forwards;
}

.instructions ol {
  padding-left: 20px;
}

.instructions li {
  margin-bottom: 10px;
  padding-left: 10px;
  transition: all 0.3s ease;
}

.instructions li:hover {
  background-color: rgba(155, 89, 182, 0.1);
  transform: translateX(5px);
  border-radius: 5px;
}

footer {
  text-align: center;
  margin-top: 30px;
  padding: 20px;
  color: #666;
  font-size: 14px;
  opacity: 0;
  animation: fadeIn 0.8s ease-out 0.8s forwards;
}

.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #fff;
  animation: spin 1s ease-in-out infinite;
  margin-right: 10px;
  vertical-align: middle;
}

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

.progress-bar {
  height: 5px;
  background-color: #eee;
  border-radius: 5px;
  margin-top: 10px;
  overflow: hidden;
}

.progress {
  height: 100%;
  background-color: var(--primary-color);
  width: 0%;
  transition: width 0.5s ease;
}

.min-cost-indicator {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 20px;
  height: 20px;
  background-color: var(--accent-color);
  color: white;
  border-radius: 50%;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 1.5s infinite;
}

.cost-comparison {
  display: flex;
  justify-content: space-between;
  margin-top: 20px;
  padding: 15px;
  background-color: rgba(52, 152, 219, 0.1);
  border-radius: 5px;
}

.comparison-item {
  text-align: center;
  flex: 1;
  padding: 10px;
}

.comparison-value {
  font-size: 18px;
  font-weight: bold;
  color: var(--primary-color);
  margin-top: 5px;
}



/* Indikator sel North West Corner aktif */
.nwc-indicator {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 30px;
  height: 30px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  animation: pulse 1.5s infinite;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 10;
}

/* Contoh indikator untuk keterangan */
.nwc-indicator-example {
  display: inline-block;
  width: 30px;
  height: 20px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 4px;
  font-size: 10px;
  text-align: center;
  line-height: 20px;
  margin: 0 5px;
}

.allocated-example {
  display: inline-block;
  width: 20px;
  height: 20px;
  background-color: rgba(46, 204, 113, 0.2);
  border: 1px solid rgba(46, 204, 113, 0.5);
  border-radius: 4px;
  margin: 0 5px;
}

.exhausted-example {
  display: inline-block;
  text-decoration: line-through;
  margin: 0 5px;
  color: var(--accent-color);
}

/* Style untuk sel yang sudah habis */
.exhausted {
  background-color: rgba(231, 76, 60, 0.1) !important;
  position: relative;
}

.exhausted-text {
  color: var(--accent-color);
  font-size: 10px;
  font-weight: bold;
  display: block;
}

/* Style untuk sel biaya */
.cost-cell {
  position: relative;
  font-weight: bold;
  min-width: 80px;
  height: 50px;
}

.cost-value {
  display: block;
  z-index: 1;
  position: relative;
}

/* Animasi untuk indikator NWC */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(52, 152, 219, 0.7); }
  70% { transform: scale(1.1); 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); }
}


/* Indikator sel Least Cost aktif */
.lc-indicator {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 30px;
  height: 30px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  animation: pulse 1.5s infinite;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
  z-index: 10;
}

/* Contoh indikator untuk keterangan */
.lc-indicator-example {
  display: inline-block;
  width: 30px;
  height: 20px;
  background-color: var(--primary-color);
  color: white;
  border-radius: 4px;
  font-size: 10px;
  text-align: center;
  line-height: 20px;
  margin: 0 5px;
}

/* Sel yang tidak tersedia karena baris/kolom dicoret */
.unavailable-cell {
  background-color: rgba(149, 165, 166, 0.2) !important;
  color: #7f8c8d;
}

/* Baris atau kolom yang dicoret */
.crossed-out {
  background-color: rgba(149, 165, 166, 0.3) !important;
  text-decoration: line-through;
  color: #7f8c8d;
}

/* Contoh untuk keterangan crossed out */
.crossed-out-example {
  display: inline-block;
  background-color: rgba(149, 165, 166, 0.3);
  padding: 2px 5px;
  border-radius: 4px;
  margin: 0 5px;
  text-decoration: line-through;
}

/* Animasi untuk indikator LC */
@keyframes pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(155, 89, 182, 0.7); }
  70% { transform: scale(1.1); box-shadow: 0 0 0 10px rgba(155, 89, 182, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(155, 89, 182, 0); }
}
