/* 主要配色變數 */
:root {
  --primary: #FF7A00;       /* 主橘色 */
  --primary-light: #FFB266; /* 淺橘色 */
  --primary-dark: #E65C00;  /* 深橘色 */
  --background: #FFF5EB;    /* 極淺橘色背景 */
  --text: #333333;          /* 深灰色文字 */
  --warning: #FF3B30;       /* 警告紅色 */
  --success: #34C759;       /* 成功綠色 */
  --border: #E0E0E0;        /* 邊框色 */
  --white: #FFFFFF;         /* 白色 */
  --gray-light: #F5F5F5;    /* 淺灰色 */
  --gray: #CCCCCC;          /* 灰色 */
}

/* 全局樣式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans TC', Arial, sans-serif;
  background-color: var(--background);
  color: var(--text);
  line-height: 1.6;
}

/* 容器 */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 15px;
}

/* 響應式斷點 */
@media (max-width: 1200px) {
  .container {
    max-width: 992px;
  }
}

@media (max-width: 992px) {
  .container {
    max-width: 768px;
  }
}

@media (max-width: 768px) {
  .container {
    max-width: 100%;
  }
}

/* 按鈕樣式 */
.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 4px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: all 0.3s ease;
}

.btn-primary {
  background-color: var(--primary);
  color: var(--white);
}

.btn-primary:hover {
  background-color: var(--primary-dark);
}

.btn-secondary {
  background-color: var(--white);
  color: var(--primary);
  border: 1px solid var(--primary);
}

.btn-secondary:hover {
  background-color: var(--primary-light);
  color: var(--white);
}

.btn-danger {
  background-color: var(--warning);
  color: var(--white);
}

.btn-success {
  background-color: var(--success);
  color: var(--white);
}

/* 表單元素 */
.form-group {
  margin-bottom: 15px;
}

.form-label {
  display: block;
  margin-bottom: 5px;
  font-weight: 500;
}

.form-control {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 14px;
}

.form-control:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 122, 0, 0.2);
}

/* 表格樣式 */
.table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

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

.table th {
  background-color: var(--primary-light);
  color: var(--white);
  font-weight: 500;
}

.table tr:nth-child(even) {
  background-color: var(--gray-light);
}

.table tr:hover {
  background-color: rgba(255, 178, 102, 0.1);
}

/* 卡片樣式 */
.card {
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 20px;
  margin-bottom: 20px;
}

.card-header {
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.card-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

/* 導航欄 */
.navbar {
  background-color: var(--white);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 10px 0;
}

.navbar-brand {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.navbar-nav {
  display: flex;
  list-style: none;
}

.nav-item {
  margin-right: 15px;
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s ease;
}

.nav-link:hover,
.nav-link.active {
  color: var(--primary);
}

/* 側邊欄 */
.sidebar {
  background-color: var(--white);
  width: 250px;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  z-index: 1000;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sidebar-brand {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.sidebar-menu {
  list-style: none;
  padding: 0;
}

.sidebar-item {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.3s ease;
}

.sidebar-item.active {
  background-color: #ff6b35;
}

.sidebar-item.active .sidebar-link {
  color: var(--white);
}

.sidebar-item.active .sidebar-link i {
  color: var(--white);
}

.sidebar-link {
  color: var(--text);
  text-decoration: none;
  display: flex;
  align-items: center;
}

.sidebar-link i {
  margin-right: 10px;
  color: var(--primary);
}

.sidebar-link:hover {
  color: var(--primary);
}

/* 主內容區域 */
.main-content {
  margin-left: 250px;
  padding: 20px;
  transition: all 0.3s ease;
}

/* 主內容區域展開狀態（側邊欄隱藏時） */
.main-content.expanded {
  margin-left: 0;
}

/* 側邊欄遮罩層 */
.sidebar-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.sidebar-overlay.active {
  display: block;
  opacity: 1;
}

/* 響應式側邊欄 */
@media (max-width: 768px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.active {
    transform: translateX(0);
  }

  .main-content {
    margin-left: 0;
    padding: 20px 10px;
  }
}

/* 頁頭 */
.page-header {
  margin-bottom: 20px;
}

.page-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 10px;
}

/* 分頁 */
.pagination {
  display: flex;
  list-style: none;
  justify-content: center;
  margin-top: 20px;
}

.page-item {
  margin: 0 5px;
}

.page-link {
  display: block;
  padding: 8px 12px;
  border-radius: 4px;
  background-color: var(--white);
  color: var(--text);
  text-decoration: none;
  transition: all 0.3s ease;
}

.page-link:hover,
.page-link.active {
  background-color: var(--primary);
  color: var(--white);
}

/* 徽章 */
.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}

.badge-primary {
  background-color: var(--primary);
  color: var(--white);
}

.badge-success {
  background-color: var(--success);
  color: var(--white);
}

.badge-warning {
  background-color: var(--warning);
  color: var(--white);
}

/* 警告和提示 */
.alert {
  padding: 12px 15px;
  border-radius: 4px;
  margin-bottom: 15px;
}

.alert-success {
  background-color: rgba(52, 199, 89, 0.1);
  border: 1px solid var(--success);
  color: var(--success);
}

.alert-warning {
  background-color: rgba(255, 59, 48, 0.1);
  border: 1px solid var(--warning);
  color: var(--warning);
}

/* 工具類 */
.text-center {
  text-align: center;
}

.text-right {
  text-align: right;
}

.text-primary {
  color: var(--primary);
}

.text-success {
  color: var(--success);
}

.text-warning {
  color: var(--warning);
}

.mt-1 { margin-top: 5px; }
.mt-2 { margin-top: 10px; }
.mt-3 { margin-top: 15px; }
.mt-4 { margin-top: 20px; }
.mt-5 { margin-top: 25px; }

.mb-1 { margin-bottom: 5px; }
.mb-2 { margin-bottom: 10px; }
.mb-3 { margin-bottom: 15px; }
.mb-4 { margin-bottom: 20px; }
.mb-5 { margin-bottom: 25px; }

.ml-1 { margin-left: 5px; }
.ml-2 { margin-left: 10px; }
.ml-3 { margin-left: 15px; }
.ml-4 { margin-left: 20px; }
.ml-5 { margin-left: 25px; }

.mr-1 { margin-right: 5px; }
.mr-2 { margin-right: 10px; }
.mr-3 { margin-right: 15px; }
.mr-4 { margin-right: 20px; }
.mr-5 { margin-right: 25px; }

.p-1 { padding: 5px; }
.p-2 { padding: 10px; }
.p-3 { padding: 15px; }
.p-4 { padding: 20px; }
.p-5 { padding: 25px; }

/* 網格系統 */
.row {
  display: flex;
  flex-wrap: wrap;
  margin-right: -15px;
  margin-left: -15px;
}

.col {
  flex: 1 0 0%;
  padding-right: 15px;
  padding-left: 15px;
}

.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* 響應式網格 */
@media (max-width: 768px) {
  .col-sm-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-sm-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-sm-3 { flex: 0 0 25%; max-width: 25%; }
  .col-sm-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-sm-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-sm-6 { flex: 0 0 50%; max-width: 50%; }
  .col-sm-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-sm-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-sm-9 { flex: 0 0 75%; max-width: 75%; }
  .col-sm-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-sm-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-sm-12 { flex: 0 0 100%; max-width: 100%; }
}

@media (max-width: 992px) and (min-width: 769px) {
  .col-md-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
  .col-md-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
  .col-md-3 { flex: 0 0 25%; max-width: 25%; }
  .col-md-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
  .col-md-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
  .col-md-6 { flex: 0 0 50%; max-width: 50%; }
  .col-md-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
  .col-md-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
  .col-md-9 { flex: 0 0 75%; max-width: 75%; }
  .col-md-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
  .col-md-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
  .col-md-12 { flex: 0 0 100%; max-width: 100%; }
}

/* 登入頁面特殊樣式 */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background-color: var(--background);
}

.login-card {
  width: 100%;
  max-width: 400px;
  padding: 30px;
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.login-logo {
  text-align: center;
  margin-bottom: 20px;
}

.login-title {
  font-size: 24px;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
  margin-bottom: 20px;
}

/* 加載動畫 */
.loader {
  display: inline-block;
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 122, 0, 0.3);
  border-radius: 50%;
  border-top-color: var(--primary);
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* 模態框 */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1050;
  overflow: auto;
}

.modal-dialog {
  margin: 50px auto;
  max-width: 500px;
  background-color: var(--white);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
}

.modal-footer .btn {
  margin-left: 10px;
}

/* 漢堡選單按鈕 */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--primary);
}

@media (max-width: 768px) {
  .menu-toggle {
    display: block;
    position: fixed;
    top: 15px;
    right: 15px;
    z-index: 1100;
  }
}

/* 響應式表格 */
@media (max-width: 768px) {
  .table-responsive {
    overflow-x: auto;
  }
}

/* 打印樣式 */
@media print {
  .sidebar, .navbar, .no-print {
    display: none !important;
  }
  
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
  }
  
  body {
    background-color: var(--white);
  }
}
