/* Style đặc thù cho công cụ TNCN */
.header {
  position: relative;
}

.back-link {
  position: absolute;
  left: 0;
  top: 10px;
  text-decoration: none;
  color: var(--text2);
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  transition: all 0.2s;
  padding: 8px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
}

.back-link:hover {
  color: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 4px 12px rgba(61,142,248,0.15);
}

.tncn-wrapper {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0,0,0,0.1);
  margin-top: 20px;
  margin-bottom: 40px;
}

.tncn-tabs {
  display: flex;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}

.tncn-tab {
  flex: 1;
  padding: 20px 10px;
  background: none;
  border: none;
  color: var(--text2);
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all 0.3s;
}

.tncn-tab:hover {
  background: var(--bg3);
  color: var(--text);
}

.tncn-tab.active {
  background: var(--card);
  color: var(--blue);
  box-shadow: inset 0 3px 0 var(--blue);
}

.tab-icon {
  font-size: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.tncn-tab.active .tab-icon {
  border-color: var(--blue);
  background: rgba(61,142,248,0.1);
}

.tncn-tab-content {
  display: none;
  padding: 30px;
}

.tncn-tab-content.active {
  display: block;
}

.section-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
}

.calc-block {
  background: var(--bg2);
  border-radius: 12px;
  padding: 24px;
  border: 1px solid var(--border);
}

.mt-24 {
  margin-top: 24px;
}

.block-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 20px;
  text-align: center;
}

.form-row {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
}

.form-label {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-label .icon {
  font-size: 18px;
  opacity: 0.8;
}

.required {
  color: #ff4757;
}

.info-icon {
  color: var(--gold);
  cursor: help;
  font-size: 12px;
}

.form-input {
  flex: 1;
}

.form-input input,
.form-input select {
  width: 100%;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  outline: none;
  transition: all 0.2s;
}

.form-input input:focus,
.form-input select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(61,142,248,0.2);
}

.result-row {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px dashed var(--border2);
}

.result-value {
  color: var(--blue);
  font-weight: 700;
  font-size: 16px;
}

.result-value.highlight {
  color: var(--green);
  font-size: 20px;
}

.result-value.warning {
  color: #ff4757;
  font-size: 20px;
}

.note-text {
  font-size: 12px;
  color: var(--text3);
  font-style: italic;
  margin-top: 10px;
}

@media (max-width: 768px) {
  .back-link {
    position: static;
    margin-bottom: 20px;
  }
  .form-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .tncn-tab {
    font-size: 14px;
    padding: 15px 5px;
  }
}

/* Period Toggle */
.tncn-period-toggle {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  background: var(--card);
  padding: 12px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
}

.period-label {
  display: block;
  margin-bottom: 8px;
  font-size: 16px;
  font-weight: 800;
  color: var(--text);
}

.period-radio-group {
  display: flex;
  background: var(--bg2);
  border-radius: 20px;
  padding: 4px;
  border: 1px solid var(--border2);
}

.period-radio-group input[type="radio"] {
  display: none;
}

.period-radio-group label {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  cursor: pointer;
  border-radius: 16px;
  transition: all 0.2s;
}

.period-radio-group input[type="radio"]:checked + label {
  background: var(--blue);
  color: #fff;
  box-shadow: 0 2px 8px rgba(61,142,248,0.3);
}

/* 2-Column Layout */
.tncn-layout {
  display: flex;
  gap: 24px;
  align-items: flex-start;
}

.tncn-wrapper {
  flex: 7;
  margin-top: 0;
}

.tncn-sidebar {
  flex: 3;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text2);
  box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}

.sidebar-box.info-box {
  background: rgba(61,142,248,0.05);
  border-color: rgba(61,142,248,0.2);
}

.sidebar-box h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.sidebar-box h4 .icon {
  color: var(--blue);
  font-size: 16px;
}

.sidebar-box ul {
  margin-left: 20px;
  margin-bottom: 0;
  padding-left: 0;
}

.sidebar-box li {
  margin-bottom: 8px;
}

.sidebar-box li:last-child {
  margin-bottom: 0;
}

.mt-16 {
  margin-top: 16px;
}

@media (max-width: 992px) {
  .tncn-layout {
    flex-direction: column;
  }
  .tncn-wrapper, .tncn-sidebar {
    width: 100%;
    flex: none;
  }
  .tncn-period-toggle {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* Detailed Tax Report */
.tax-report {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border2);
  animation: fadeIn 0.5s ease;
}

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

.smart-alert {
  background: rgba(245, 166, 35, 0.1);
  border: 1px solid var(--gold);
  color: var(--gold);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.tax-progress-wrapper {
  margin-bottom: 24px;
}

.tax-progress-bar {
  display: flex;
  height: 12px;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
  background: var(--bg);
}

.tax-progress-segment {
  height: 100%;
  transition: width 0.5s ease;
}

.segment-net { background: var(--green); }
.segment-tax { background: #ff4757; }
.segment-ins { background: var(--gold); }

.tax-progress-legend {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--text2);
  justify-content: center;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.tax-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 16px;
}

.tax-breakdown-table th,
.tax-breakdown-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border2);
  text-align: left;
}

.tax-breakdown-table th {
  color: var(--text2);
  font-weight: 600;
}

.tax-breakdown-table td.amount {
  text-align: right;
  font-weight: 600;
  color: var(--text);
}

.tax-breakdown-table tr:last-child th,
.tax-breakdown-table tr:last-child td {
  border-bottom: none;
}

.table-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--blue);
  margin-bottom: 12px;
}

/* Multi-source blocks */
.source-block {
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
  position: relative;
}

.source-block .block-title-small {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.remove-source-btn {
  background: none;
  border: none;
  color: #ff4757;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  transition: all 0.2s;
}

.remove-source-btn:hover {
  background: rgba(255, 71, 87, 0.1);
}

.add-source-btn {
  width: 100%;
  padding: 12px;
  background: rgba(61,142,248,0.05);
  color: var(--blue);
  border: 1px dashed var(--blue);
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  transition: all 0.2s;
  margin-bottom: 16px;
}

.add-source-btn:hover {
  background: rgba(61,142,248,0.15);
}
