/* /assets/css/style.css - ไฟล์ CSS หลักสำหรับทั้งเว็บไซต์ */

/* Variables and Base Styles */
:root {
  --primary-color: #2c3e50;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --light-bg: #f8f9fa;
  --dark-bg: #2c3e50;
  --text-light: #ecf0f1;
  --text-dark: #2c3e50;
  --border-color: #ddd;
  --success-color: #27ae60;
  --warning-color: #f39c12;
  --error-color: #e74c3c;
  --sidebar-width: 280px;
  --header-height: 60px;
}

[data-theme="dark"] {
  --primary-color: #ecf0f1;
  --secondary-color: #3498db;
  --accent-color: #e74c3c;
  --light-bg: #2c3e50;
  --dark-bg: #1a252f;
  --text-light: #2c3e50;
  --text-dark: #ecf0f1;
  --border-color: #444;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Sarabun', 'Noto Sans Thai', sans-serif;
  background-color: var(--light-bg);
  color: var(--text-dark);
  line-height: 1.6;
  transition: background-color 0.3s, color 0.3s;
}

body[data-theme="dark"] {
  background-color: var(--dark-bg);
  color: var(--text-light);
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header and Navigation */
header {
  background-color: var(--primary-color);
  color: var(--text-light);
  padding: 1rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.header-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 700;
}

.nav-menu {
  display: flex;
  list-style: none;
}

.nav-menu li {
  margin-left: 1.5rem;
}

.nav-menu a {
  color: var(--text-light);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.nav-menu a:hover {
  color: var(--secondary-color);
}

.theme-toggle {
  background: none;
  border: none;
  color: var(--text-light);
  cursor: pointer;
  font-size: 1.2rem;
  margin-left: 1rem;
}

.breadcrumb {
  background-color: rgba(255,255,255,0.1);
  padding: 0.5rem 1rem;
  margin-bottom: 1rem;
  border-radius: 5px;
}

.breadcrumb a {
  color: var(--text-light);
  text-decoration: none;
}

.breadcrumb span {
  margin: 0 0.5rem;
  color: var(--text-light);
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.8rem 1.5rem;
  background-color: var(--secondary-color);
  color: white;
  text-decoration: none;
  border-radius: 5px;
  font-weight: 600;
  transition: background-color 0.3s;
  border: none;
  cursor: pointer;
  margin: 0.5rem;
}

.btn:hover {
  background-color: #2980b9;
}

.btn-outline {
  background-color: transparent;
  border: 2px solid var(--text-light);
}

.btn-outline:hover {
  background-color: var(--text-light);
  color: var(--primary-color);
}

.btn-small {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
}

/* Cards and Sections */
.card {
  background-color: white;
  border-radius: 10px;
  padding: 2rem;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.3s, box-shadow 0.3s;
  margin-bottom: 1.5rem;
}

[data-theme="dark"] .card {
  background-color: #34495e;
}

.card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 15px rgba(0,0,0,0.2);
}

.section-title {
  font-size: 1.8rem;
  margin-bottom: 1.5rem;
  color: var(--primary-color);
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--secondary-color);
}

[data-theme="dark"] .section-title {
  color: var(--text-light);
}

/* Progress Bars */
.progress-container {
  width: 100%;
  height: 20px;
  background-color: #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  margin: 0.5rem 0;
}

[data-theme="dark"] .progress-container {
  background-color: #444;
}

.progress-fill {
  height: 100%;
  background-color: var(--secondary-color);
  border-radius: 10px;
  transition: width 0.5s ease-in-out;
}

/* Accessibility */
:focus {
  outline: 3px solid var(--secondary-color);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .nav-menu {
    display: none;
  }
  
  .mobile-menu-btn {
    display: block;
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.5rem;
    cursor: pointer;
  }
  
  .breadcrumb {
    font-size: 0.9rem;
    padding: 0.3rem 0.5rem;
  }
}

/* Scroll to top button */
.back-to-top {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background-color: var(--primary-color);
  color: var(--text-light);
  width: 50px;
  height: 50px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
  z-index: 99;
}

.back-to-top.show {
  opacity: 1;
  visibility: visible;
}

/* Footer */
footer {
  background-color: var(--primary-color);
  color: var(--text-light);
  padding: 2rem 0;
  margin-top: 3rem;
}

.footer-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 2rem;
}

.footer-section h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.footer-section ul {
  list-style: none;
}

.footer-section li {
  margin-bottom: 0.5rem;
}

.footer-section a {
  color: var(--text-light);
  text-decoration: none;
  transition: color 0.3s;
}

.footer-section a:hover {
  color: var(--secondary-color);
}

.copyright {
  text-align: center;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255,255,255,0.1);
}

/* Utility Classes */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.ml-1 { margin-left: 0.5rem; }
.ml-2 { margin-left: 1rem; }
.ml-3 { margin-left: 1.5rem; }
.ml-4 { margin-left: 2rem; }

.mr-1 { margin-right: 0.5rem; }
.mr-2 { margin-right: 1rem; }
.mr-3 { margin-right: 1.5rem; }
.mr-4 { margin-right: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Animation */
.fade-in {
  animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Tooltip */
.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltip-text {
  visibility: hidden;
  width: 200px;
  background-color: var(--dark-bg);
  color: var(--text-light);
  text-align: center;
  border-radius: 6px;
  padding: 5px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  transition: opacity 0.3s;
  font-size: 0.9rem;
}

.tooltip:hover .tooltip-text {
  visibility: visible;
  opacity: 1;
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0,0,0,0.5);
}

.modal-content {
  background-color: white;
  margin: 10% auto;
  padding: 2rem;
  border-radius: 10px;
  width: 80%;
  max-width: 600px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  position: relative;
  animation: modalOpen 0.3s;
}

[data-theme="dark"] .modal-content {
  background-color: #34495e;
}

@keyframes modalOpen {
  from { opacity: 0; transform: translateY(-50px); }
  to { opacity: 1; transform: translateY(0); }
}

.close {
  color: #aaa;
  float: right;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

.close:hover {
  color: #000;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 2px solid var(--border-color);
  margin-bottom: 1rem;
}

.tab {
  padding: 0.8rem 1.5rem;
  cursor: pointer;
  border: none;
  background: none;
  font-size: 1rem;
  color: var(--text-dark);
  transition: all 0.3s;
}

[data-theme="dark"] .tab {
  color: var(--text-light);
}

.tab.active {
  color: var(--secondary-color);
  border-bottom: 3px solid var(--secondary-color);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.5s;
}

/* Print styles */
@media print {
  .no-print {
    display: none !important;
  }
  
  body {
    background-color: white;
    color: black;
  }
  
  .card, .modal-content {
    box-shadow: none;
    border: 1px solid #ccc;
  }
}