/* =========================
   IMPORT DATA STYLESHEET (MATCHING THEMES)
========================= */

html, body {
  width: 100%;
  min-height: 100%;
  font-family: Arial, sans-serif;
  background: #f3f6fb;
  overflow-x: hidden;
}

.import-page {
  width: 100%;
  min-height: 100vh;
  background: #f3f6fb;
}

/* =========================
   HEADER (MATCHING BANNER)
========================= */
.import-header {
  width: 100%;
  height: 155px;
  background: url('../img/banner-pdam.jpg') center center / cover no-repeat;
  border-bottom-left-radius: 26px;
  border-bottom-right-radius: 26px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 24px;
  overflow: hidden;
}

.header-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    135deg,
    rgba(22, 144, 255, 0.82),
    rgba(0, 114, 236, 0.78)
  );
  backdrop-filter: blur(1px);
  z-index: 1;
}

.import-header h1 {
  position: relative;
  z-index: 2;
  color: white;
  font-size: 20px;
  font-weight: 700;
}

/* =========================
   BACK BUTTON
========================= */
.back-btn {
  position: absolute;
  top: 18px;
  left: 16px;
  width: 38px;
  height: 38px;
  border: none;
  border-radius: 10px;
  background: white;
  color: #222;
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(0,0,0,0.12);
  z-index: 2;
}

/* =========================
   CONTENT CARD CONTAINER
========================= */
.import-content {
  width: calc(100% - 24px);
  max-width: 420px;
  margin: 14px auto 30px auto;
  background: white;
  border-radius: 24px;
  padding: 20px 16px 30px;
  min-height: 500px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.05);
}

/* Section Cards inside the main card container */
.import-card {
  margin-bottom: 24px;
  border-bottom: 1px solid #eef2f6;
  padding-bottom: 20px;
}

.import-card:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.import-title {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 14px;
}

/* =========================
   MENU GRID TABS
========================= */
.menu-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.menu-btn {
  border: none;
  background: #eef2f6;
  color: #4b5563;
  padding: 12px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.2s ease;
}

.menu-btn.active {
  background: #2d8cf0;
  color: white;
  box-shadow: 0 4px 10px rgba(45, 140, 240, 0.3);
}

/* =========================
   DROPZONE AREA
========================= */
.upload-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 14px;
  padding: 30px 16px;
  text-align: center;
  background: #f8fafc;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.upload-dropzone:hover, .upload-dropzone.dragover {
  border-color: #2d8cf0;
  background: #f0f7ff;
}

.upload-icon {
  width: 40px;
  height: 40px;
  opacity: 0.7;
}

.upload-text {
  font-size: 13px;
  color: #4b5563;
  font-weight: 600;
}

.upload-subtext {
  font-size: 11px;
  color: #94a3b8;
}

.file-input {
  display: none;
}

/* Selected File Info */
.file-info-card {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 12px;
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.file-details {
  display: flex;
  align-items: center;
  gap: 10px;
}

.file-name {
  font-size: 13px;
  font-weight: 600;
  color: #166534;
}

.file-size {
  font-size: 11px;
  color: #15803d;
}

.btn-remove-file {
  background: none;
  border: none;
  color: #dc3545;
  font-size: 18px;
  cursor: pointer;
  font-weight: bold;
}

/* =========================
   TEMPLATE SECTION
========================= */
.template-section {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f8fafc;
  border-radius: 12px;
  padding: 12px;
  border: 1px solid #e2e8f0;
  gap: 12px;
  flex-wrap: wrap; /* Allows wrapping on smaller viewports */
}

.template-info {
  flex: 1;
  min-width: 200px; /* Forces wrap if space is less than 200px + button width */
}

.template-info h4 {
  font-size: 13px;
  font-weight: 700;
  color: #334155;
  margin-bottom: 2px;
}

.template-info p {
  font-size: 11px;
  color: #64748b;
  line-height: 1.3;
}

.btn-download {
  background: white;
  border: 1px solid #cbd5e1;
  color: #4b5563;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-download:hover {
  background: #f1f5f9;
  border-color: #94a3b8;
  color: #1e293b;
}

.btn-download img {
  width: 12px;
  height: 12px;
  filter: opacity(0.7);
}

/* =========================
   PREVIEW TABLE
========================= */
.preview-container {
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid #e2e8f0;
  margin-top: 10px;
  background: white;
  max-height: 300px;
  width: 100%;
}

.preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: left;
}

.preview-table th {
  background: #f8fafc;
  padding: 10px;
  font-weight: 700;
  color: #475569;
  border-bottom: 2px solid #e2e8f0;
  position: sticky;
  top: 0;
}

.preview-table td {
  padding: 10px;
  border-bottom: 1px solid #f1f5f9;
  color: #334155;
  white-space: nowrap;
}

.preview-table tr.row-invalid {
  background: #fff5f5;
}

.preview-table tr.row-invalid td {
  color: #b91c1c;
}

.badge {
  display: inline-block;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
}

.badge-success {
  background: #dcfce7;
  color: #15803d;
}

.badge-danger {
  background: #fee2e2;
  color: #b91c1c;
}

.error-text {
  font-size: 10px;
  font-weight: 600;
  color: #b91c1c;
  display: block;
}

/* =========================
   BUTTON ACTIONS
========================= */
.action-btn {
  width: 100%;
  height: 50px;
  border: none;
  border-radius: 14px;
  background: #2d8cf0;
  color: white;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 6px 14px rgba(45, 140, 240, 0.22);
  transition: 0.2s ease;
  letter-spacing: 0.5px;
}

.action-btn:hover {
  background: #1a7fe8;
}

.action-btn:active {
  transform: scale(0.98);
}

.action-btn:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
  box-shadow: none;
}

/* =========================
   RESULT BOX
========================= */
.result-box {
  border-radius: 12px;
  padding: 14px;
  margin-top: 16px;
  display: none;
  font-size: 13px;
}

.result-box.success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  display: block;
}

.result-box.error {
  background: #fef2f2;
  border: 1px solid #fca5a5;
  color: #991b1b;
  display: block;
}

.result-title {
  font-weight: 700;
  margin-bottom: 4px;
}

.result-details {
  line-height: 1.5;
}

.result-details ul {
  padding-left: 18px;
  margin-top: 4px;
}

/* =========================
   MOBILE RESPONSIVE
========================= */
@media (max-width: 480px) {
  .import-header {
    height: 145px;
    padding-top: 20px;
  }
  .import-header h1 {
    font-size: 18px;
  }
  .import-content {
    width: calc(100% - 24px); /* Keep healthy margins */
    margin: 14px auto 28px;
    padding: 18px 12px 28px; /* Slightly reduce internal padding */
  }
  .menu-btn {
    font-size: 11px;
    padding: 10px 4px;
  }
  .template-section {
    flex-direction: column;
    align-items: stretch;
    text-align: center;
  }
  .btn-download {
    width: 100%;
  }
}
