@import url("input.css");
@import url("card.css");
@import url("alert.css");
@import url("pagination.css");

/* ==========================================================================
   1. GLOBAL COMPONENTS (ใช้ร่วมกันทุกหน้า)
   ========================================================================== */

/* Buttons & Animations */
.btn-outline-main {
  border: 1px solid #6f42c1;
  color: #6f42c1;
  transition: all 0.3s ease;
}

.btn-outline-main:hover {
  background-color: #6f42c1;
  color: white;
}

.btn-outline-main:hover i.fa-rotate-left {
  animation: spin-around 0.8s ease-in-out;
}

@keyframes spin-around {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-360deg);
  }
}

/* Table Utilities */
.table-layout td .truncate-text {
  max-width: 300px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  position: relative;
}

.table-layout td .truncate-text:hover::after {
  content: attr(data-full-text);
  position: absolute;
  top: 100%;
  left: 0;
  background: #333;
  color: #fff;
  padding: 5px 10px;
  z-index: 100;
  min-width: 200px;
  border-radius: 4px;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* ==========================================================================
   2. LAYOUT & SIDEBAR (Header, Sidebar)
   ========================================================================== */

/* Custom Sidebar Menu */
.custom-menu-list .list-group-item {
  padding: 12px 20px;
  font-size: 15px;
  color: #555;
  transition: all 0.2s;
  border-radius: 8px !important;
  margin: 2px 4px;
}

.custom-menu-list .list-group-item:hover {
  background-color: #f8f9fa;
  color: #6f42c1;
}

.custom-menu-list .list-group-item.active {
  background-color: #f3f0ff !important;
  color: #6f42c1 !important;
  font-weight: 500;
  border: none;
}

.list-group-flush > .list-group-item {
  border-width: 0 !important;
}

.text-question,
.icon-question {
  color: #ac99ec;
}

/* Sidebar Badge (Circle) */
.menu-badge {
  background-color: #f0ebf8;
  color: #6f42c1;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: bold;
}

.active .menu-badge {
  background-color: rgba(255, 255, 255, 0.2);
  color: white;
}

/* ==========================================================================
   3. PAGE SPECIFIC (แยกตามหน้าไฟล์)
   ========================================================================== */

/* --- home.php --- */
.home-category .card-table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, auto);
  gap: 10px;
}

.article .card-table {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, auto);
  gap: 10px;
}

.popular-tag .tag-list .tag-btn.active {
  background-color: #673ab7 !important;
  color: #fff !important;
  border-color: #673ab7 !important;
}

/* ==========================================================================
   4. CODE BLOCK & TEXTAREA (Technical Components)
   ========================================================================== */

.code-block pre {
  background-color: #ffffff;
  color: #000000;
  border: 1px solid #e0e0e0 !important;
  border-radius: 6px;
  padding: 16px;
  overflow: visible !important;
  white-space: pre-wrap !important;
}

.container-lineNumber {
  position: relative;
}

.container-lineNumber .list {
  position: absolute;
  top: 4px;
  left: 0;
  width: 30px;
  text-align: right;
  padding-right: 5px;
  z-index: 2;
  user-select: none;
}

.container-lineNumber .textarea textarea {
  padding-left: 35px;
  line-height: 1.4em;
  overflow: auto;
}

/* ==========================================================================
   5. RESPONSIVE (Media Queries)
   ========================================================================== */

@media screen and (max-width: 992px) {
  .hero-banner-title {
    font-size: 26px;
  }
  .hero-banner-body {
    width: 100% !important;
  }
  .hero-banner-body a {
    width: 40%;
    text-align: center;
  }

  .home-category .card-table {
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: repeat(3, auto);
  }

  .card-item {
    width: calc(50% - 1rem); /* ปรับเหลือ 2 คอลัมน์บนจอ Tablet */
  }
}

@media screen and (max-width: 768px) {
  .card-item {
    width: 100%; /* จอมือถือแสดงแถวละ 1 */
  }
}

.active-all-btn {
  color: #6f42c1 !important;
  font-weight: 800 !important;
}

/* คุมให้ Grid Item สูงเท่ากัน */
#datasetContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
  align-items: stretch; /* ทำให้ทุก item ใน row สูงเท่าตัวที่สูงที่สุด */
}

.right-body-img {
  width: 100%;
  height: auto;
  min-height: 250px;
  background-color: #f8f9fa;
}

.input-file-form {
  border: 2px dashed #d1d5db;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  transition: all 0.3s ease;
  background: #f9fafb;
  color: #6b7280;
  cursor: pointer;
}

.input-file-form:hover {
  border-color: #6f42c1;
  background: #f3f0ff;
  color: #6f42c1;
}

.input-file-form.dragover {
  border-color: #6f42c1;
  background-color: rgba(111, 66, 193, 0.1);
  transform: scale(1.02);
}

.input-file-form i {
  font-size: 3rem;
  margin-bottom: 15px;
  display: block;
}

.file-item {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 4px 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.file-item:hover {
  border-color: #6f42c1;
  transform: translateY(-1px);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.07);
}

.file-info {
  display: flex;
  align-items: center;
  gap: 15px;
}

.file-name-wrapper {
  display: flex;
  flex-direction: column;
}

.file-name-text {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.95rem;
}

.file-size-text {
  color: #6b7280;
  font-size: 0.85rem;
}

.preview-file-btn {
  color: #6f42c1;
  background: transparent;
  border: none;
  transition: all 0.2s;
}

.preview-file-btn:hover {
  color: #5f26ca;
}

.remove-file-btn {
  color: #dc3545;
  background: transparent;
  border: none;
  transition: all 0.2s;
}

.remove-file-btn:hover {
  color: #a52834;
}

.file-name-wrapper {
  display: flex;
  flex-direction: column;
  max-width: 250px;
  overflow: hidden;
}

.file-name-text {
  font-weight: 600;
  color: #1f2937;
  font-size: 0.95rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
