/* Import Fonts (CHANGED to Kanit) */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;500;700&display=swap');

/* --- Root & Light Theme (Apple-inspired) --- */
:root, [data-bs-theme="light"] {
  --bs-body-font-family: 'Kanit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: #1d1d1f;
  --bs-body-bg: #f5f5f7;
  --bs-tertiary-bg: #ffffff;
  --bs-primary: #0071e3;
  --bs-secondary: #6e6e73;
  --bs-link-color: #0066cc;
  --bs-link-hover-color: #0071e3;
  --bs-border-color: #d2d2d7;
  
  /* Increased border-radius for a softer, more modern look */
  --bs-border-radius: 0.75rem;
  --bs-border-radius-lg: 1rem;
  --bs-border-radius-sm: 0.5rem;

  --custom-card-bg: var(--bs-tertiary-bg);
  --custom-card-shadow: 0 4px 16px rgba(0, 0, 0, 0.07); /* Softer shadow */
  --custom-card-shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.1); /* More pronounced hover */
  --custom-navbar-bg: rgba(255, 255, 255, 0.85);
}

/* --- Dark Theme (Apple-inspired) --- */
[data-bs-theme="dark"] {
  --bs-body-color: #f5f5f7;
  --bs-body-bg: #161617; /* Off-black background */
  --bs-tertiary-bg: #1d1d1f; /* Slightly lighter surface */
  --bs-primary: #0a84ff;
  --bs-secondary: #8e8e93;
  --bs-link-color: #0a84ff;
  --bs-link-hover-color: #40a0ff;
  --bs-border-color: #3a3a3c;

  --custom-card-bg: var(--bs-tertiary-bg);
  --custom-card-shadow: 0 4px 16px rgba(0, 0, 0, 0.12); /* Softer shadow */
  --custom-card-shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.2); /* More pronounced hover */
  --custom-navbar-bg: rgba(29, 29, 31, 0.85);
}

/* --- Base Body --- */
body {
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* --- Navbar --- */
.navbar {
  background-color: var(--custom-navbar-bg);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--bs-border-color);
}
.navbar .dropdown-menu {
  background-color: var(--custom-navbar-bg);
  backdrop-filter: blur(10px);
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--custom-card-shadow);
  border-radius: var(--bs-border-radius-lg);
}
.navbar .dropdown-item {
  border-radius: var(--bs-border-radius);
}

.navbar-toggler {
  border: none;
  font-size: 1.25rem;
  color: var(--bs-secondary);
}
.navbar-toggler:focus {
  box-shadow: none;
}

.btn-icon {
  color: var(--bs-secondary);
  background-color: transparent;
  border: none;
  font-size: 1.1rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--bs-border-radius);
}
.btn-icon:hover {
  color: var(--bs-primary);
  background-color: var(--bs-tertiary-bg);
}

/* --- Offcanvas --- */
.offcanvas {
  background-color: var(--bs-tertiary-bg);
}

/* --- Footer --- */
.footer-custom {
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-secondary);
  border-top: 1px solid var(--bs-border-color);
}
/* NEW: Footer Link Style */
.footer-links a {
  color: var(--bs-secondary);
  transition: color 0.2s ease;
}
.footer-links a:hover {
  color: var(--bs-primary);
}

/* --- Card --- */
.card-custom {
  background-color: var(--custom-card-bg);
  border: 1px solid var(--bs-border-color);
  box-shadow: var(--custom-card-shadow);
  transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  height: 100%;
  border-radius: var(--bs-border-radius-lg); /* Softer corners */
  overflow: hidden; /* Ensure image corners are rounded */
}
.card-custom:hover {
  transform: translateY(-6px); /* Increased lift */
  box-shadow: var(--custom-card-shadow-hover);
}

.card-img-top-container {
  overflow: hidden;
  aspect-ratio: 16 / 9;
}
.card-img-top-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.card-custom:hover .card-img-top-container img {
  transform: scale(1.05);
}

/* --- Hero Section (for Home Page) --- */
.hero-section {
  padding: 6rem 1rem;
  background-color: var(--bs-tertiary-bg);
  text-align: center;
  border-bottom: 1px solid var(--bs-border-color);
}
.hero-section h1 {
  font-size: 3.5rem;
  font-weight: 700;
}
.hero-section .lead {
  font-size: 1.5rem;
  color: var(--bs-secondary);
}

/* --- Page Content --- */
.page-container {
  padding: 3rem 1rem; /* Increased padding */
}

/* --- Search Modal --- */
#searchModal .modal-content {
  background-color: var(--bs-tertiary-bg);
  border-radius: var(--bs-border-radius-lg);
}
#searchModal .form-control {
  font-size: 1.5rem;
}
#searchModal .form-control:focus {
  border-color: var(--bs-primary);
  box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}
.search-result-item {
  display: block;
  padding: 1rem;
  border-radius: var(--bs-border-radius);
  text-decoration: none;
  color: var(--bs-body-color);
  background-color: transparent;
  transition: background-color 0.2s ease;
}
.search-result-item:hover {
  background-color: var(--bs-tertiary-bg);
  color: var(--bs-primary);
}
.search-result-type {
  font-size: 0.8rem;
  color: var(--bs-secondary);
  text-transform: uppercase;
}

/* --- Image Modal --- */
#imageModal .modal-content {
  box-shadow: none;
}
#imageModalContent {
  max-height: 90vh;
  width: auto;
  border-radius: var(--bs-border-radius-lg);
}

/* --- Article Detail --- */
.article-detail-header {
  height: 60vh;
  background-size: cover;
  background-position: center;
  position: relative;
  color: white;
  display: flex;
  align-items: flex-end;
  border-radius: var(--bs-border-radius-lg);
  overflow: hidden;
  margin-top: -1rem; /* Overlap slightly */
}
.article-detail-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.8), rgba(0,0,0,0.1));
}
.article-detail-header .container {
  position: relative;
  z-index: 2;
  padding-bottom: 2rem;
}
.article-detail-content {
  font-size: 1.1rem;
  line-height: 1.8;
}
.article-detail-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--bs-border-radius);
  margin-top: 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
}

/* --- Skills Grid (About Page) --- */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 1rem;
}
.skill-item {
  background-color: var(--bs-tertiary-bg);
  border: 1px solid var(--bs-border-color);
  border-radius: var(--bs-border-radius);
  padding: 1rem;
  text-align: center;
  transition: all 0.2s ease;
}
.skill-item:hover {
  transform: translateY(-3px);
  box-shadow: var(--custom-card-shadow);
  color: var(--bs-primary);
}
.skill-item i {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  display: block;
}
.skill-item span {
  font-size: 0.9rem;
  font-weight: 500;
}

/* --- Other Web Page (NEW DESIGN V3) --- */
.other-web-card-v3 {
  text-decoration: none;
  color: var(--bs-body-color);
  background-color: var(--custom-card-bg);
  border: 0; /* Remove border */
  box-shadow: var(--custom-card-shadow);
  transition: all 0.25s ease-in-out;
  height: 100%;
  border-radius: var(--bs-border-radius-lg);
  display: flex;
  flex-direction: column;
}
.other-web-card-v3 .card-body {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
  position: relative;
  padding: 1.5rem;
}
.other-web-card-v3:hover {
  transform: translateY(-6px);
  box-shadow: var(--custom-card-shadow-hover);
  color: var(--bs-primary);
}
.other-web-card-v3 .card-icon-bg {
  font-size: 2.5rem;
  color: var(--bs-primary);
  margin-bottom: 1rem;
  width: 60px;
  height: 60px;
  background-color: var(--bs-primary-bg-subtle);
  border-radius: var(--bs-border-radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.other-web-card-v3 .card-title {
  font-weight: 700;
  font-size: 1.25rem;
}
.other-web-card-v3 .card-text {
  font-size: 0.9rem;
}
.other-web-card-v3 .tags-container {
  margin-top: auto; /* Pushes tags to the bottom */
  padding-top: 1rem;
}
.other-web-card-v3::after {
  content: '\f061'; /* Font Awesome arrow-right */
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  font-size: 1rem;
  color: var(--bs-secondary);
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.25s ease-out;
}
.other-web-card-v3:hover::after {
  opacity: 1;
  transform: translateX(0);
  color: var(--bs-primary);
}

/* --- Utility --- */
.tag-badge {
  font-size: 0.8rem;
  font-weight: 500;
  background-color: var(--bs-primary-bg-subtle) !important;
  color: var(--bs-primary) !important;
  border: 1px solid var(--bs-primary-bg-subtle) !important;
  border-radius: var(--bs-border-radius-sm);
  padding: 0.3em 0.6em;
}

/* Apply border-radius to components */
.modal-content, .accordion-item, .accordion-button, .form-control, .form-select, .btn {
  border-radius: var(--bs-border-radius);
}
.btn-lg, .form-control-lg, .form-select-lg {
  border-radius: var(--bs-border-radius-lg);
}
.modal-content {
  border-radius: var(--bs-border-radius-lg);
}
.accordion-item:first-of-type, .accordion-item:first-of-type .accordion-button {
  border-top-left-radius: var(--bs-border-radius-lg);
  border-top-right-radius: var(--bs-border-radius-lg);
}
.accordion-item:last-of-type, .accordion-item:last-of-type .accordion-button.collapsed {
  border-bottom-left-radius: var(--bs-border-radius-lg);
  border-bottom-right-radius: var(--bs-border-radius-lg);
}



.badge-disabled {
  position: absolute;
  right: 15px;
  background: rgba(0, 0, 0, 0.1);
  color: rgba(255, 255, 255, 0.7);
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.7rem;
}