style.css

20.37 KB
30/10/2025 02:07
CSS
style.css
/* Global Styles & Reset */
body {
  font-family: 'Kanit', sans-serif;
  /* ใช้ฟอนต์ Kanit หรือฟอนต์อื่นที่คุณชอบ */
  margin: 0;
  padding: 0;
  background-color: #f0f2f5;
  /* สีพื้นหลังโดยรวม */
  color: #333;
  font-size: 14px;
}
.container {
  display: flex;
  min-height: 100vh;
}
ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
a {
  text-decoration: none;
  color: inherit;
}
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  margin-bottom: 10px;
  font-weight: 500;
}
.card {
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  padding: 20px;
  margin-bottom: 20px;
}
/* Status Tags & Colors */
.status-tag {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  display: inline-block;
}
.green-bg {
  background-color: #28a745;
}
/* Operational, Excellent */
.blue-bg {
  background-color: #007bff;
}
/* Good, Active */
.orange-bg {
  background-color: #ffc107;
  color: #333;
}
/* Maintenance, Needs Attention */
.red-bg {
  background-color: #dc3545;
}
/* Offline, Critical */
.green-text {
  color: #28a745;
}
.blue-text {
  color: #007bff;
}
.orange-text {
  color: #ffc107;
}
.red-text {
  color: #dc3545;
}
.green-dot {
  color: #28a745;
  font-size: 8px;
  vertical-align: middle;
  margin-right: 5px;
}
.blue-dot {
  color: #007bff;
  font-size: 8px;
  vertical-align: middle;
  margin-right: 5px;
}
.orange-dot {
  color: #ffc107;
  font-size: 8px;
  vertical-align: middle;
  margin-right: 5px;
}
.red-dot {
  color: #dc3545;
  font-size: 8px;
  vertical-align: middle;
  margin-right: 5px;
}
/* Sidebar */
.sidebar {
  width: 250px;
  background-color: #ffffff;
  /* เปลี่ยนเป็นสีขาว */
  box-shadow: 2px 0 5px rgba(0, 0, 0, 0.05);
  padding: 20px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #e0e0e0;
  /* เพิ่มเส้นแบ่ง */
}
.sidebar-header {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #eee;
}
.sidebar-header .logo {
  font-size: 30px;
  color: #007bff;
  margin-right: 10px;
}
.sidebar-header .platform-name p {
  margin: 0;
  font-weight: 600;
  font-size: 18px;
  color: #333;
}
.sidebar-header .platform-name small {
  display: block;
  font-size: 12px;
  color: #666;
}
.sidebar-summary {
  display: flex;
  justify-content: space-between;
  margin-bottom: 25px;
}
.sidebar-summary .summary-item {
  text-align: center;
  padding: 10px 5px;
  border-radius: 5px;
  font-weight: 600;
  width: 30%;
  /* ปรับความกว้าง */
  box-sizing: border-box;
}
.sidebar-summary .summary-item span {
  display: block;
  font-size: 20px;
  margin-bottom: 5px;
}
.sidebar-summary .summary-item small {
  font-size: 10px;
  display: block;
}
.sidebar-summary .summary-item.red {
  background-color: #ffe8e8;
  color: #dc3545;
}
.sidebar-summary .summary-item.green {
  background-color: #e8f8e8;
  color: #28a745;
}
.sidebar-summary .summary-item.blue {
  background-color: #e8f3ff;
  color: #007bff;
}
.main-navigation h5, .system-status h5 {
  font-size: 11px;
  color: #888;
  margin-top: 20px;
  margin-bottom: 10px;
  text-transform: uppercase;
  padding-left: 5px;
}
.main-navigation ul li, .system-status ul li {
  margin-bottom: 5px;
  padding: 8px 5px;
  display: flex;
  align-items: center;
  position: relative;
  border-radius: 5px;
}
.main-navigation ul li a {
  display: flex;
  align-items: center;
  color: #555;
  font-weight: 500;
  flex-grow: 1;
}
.main-navigation ul li a i {
  margin-right: 10px;
  font-size: 16px;
  color: #888;
}
.main-navigation ul li small {
  font-size: 11px;
  color: #888;
  margin-left: 10px;
  position: absolute;
  /* เพื่อจัดตำแหน่ง */
  left: 40px;
  /* ให้มันอยู่ใต้ชื่อเมนู */
  top: 28px;
}
.main-navigation ul li.nav-item {
  flex-wrap: wrap;
  /* เพื่อให้ small ลงบรรทัดใหม่ */
  align-items: flex-start;
  height: 45px;
  /* กำหนดความสูง เพื่อให้ small มีที่อยู่ */
  padding-top: 5px;
  padding-bottom: 5px;
}
.main-navigation ul li.nav-item a {
  width: 100%;
  /* ให้ link กินพื้นที่เต็ม */
  line-height: 1;
  /* ปรับ line-height */
}
.main-navigation ul li.nav-item small {
  position: static;
  /* ไม่ใช้ absolute สำหรับ small ใน nav-item */
  display: block;
  /* ให้ small อยู่บรรทัดใหม่ */
  margin-left: 30px;
  /* เยื้องเล็กน้อย */
}
.main-navigation ul li.active {
  background-color: #e8f3ff;
  color: #007bff;
  font-weight: 600;
}
.main-navigation ul li.active a {
  color: #007bff;
}
.main-navigation ul li.active a i {
  color: #007bff;
}
.sidebar .status-tag {
  margin-left: auto;
  /* ชิดขวา */
  background-color: #eee;
  color: #666;
  padding: 2px 6px;
  font-size: 10px;
  font-weight: 500;
}
.system-status ul li {
  font-size: 13px;
  color: #555;
}
.sidebar-user-info {
  display: flex;
  align-items: center;
  margin-top: auto;
  /* ยึดไปด้านล่าง */
  padding-top: 20px;
  border-top: 1px solid #eee;
}
.sidebar-user-info .user-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background-color: #007bff;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  margin-right: 10px;
  font-size: 16px;
}
.sidebar-user-info .user-details p {
  margin: 0;
  font-weight: 600;
}
.sidebar-user-info .user-details small {
  display: block;
  font-size: 11px;
  color: #777;
}
/* Main Content */
.main-content {
  flex-grow: 1;
  padding: 30px;
}
/* Topbar */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #fff;
  padding: 15px 30px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
  margin-bottom: 30px;
}
.topbar-left {
  display: flex;
  align-items: center;
}
.topbar-left h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
  color: #333;
}
.topbar-left .subtitle {
  margin-left: 15px;
  font-size: 14px;
  color: #777;
}
.topbar-left .system-status-indicator {
  margin-left: 20px;
  padding: 5px 10px;
  border-radius: 5px;
  font-weight: 500;
  font-size: 13px;
}
.topbar-left .system-status-indicator.online {
  background-color: #e8f8e8;
  color: #28a745;
}
.topbar-left .system-status-indicator i {
  font-size: 8px;
  vertical-align: middle;
  margin-right: 5px;
}
.topbar-left .last-sync {
  margin-left: 15px;
  font-size: 13px;
  color: #888;
}
.topbar-left .last-sync i {
  margin-right: 5px;
}
.topbar-right {
  display: flex;
  align-items: center;
}
.search-box {
  position: relative;
  margin-right: 20px;
}
.search-box i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
}
.search-box input {
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 8px 12px 8px 35px;
  width: 250px;
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}
.search-box input:focus {
  border-color: #007bff;
}
.topbar-right .uptime {
  font-weight: 600;
  color: #28a745;
  margin-right: 20px;
  font-size: 14px;
}
.topbar-right .uptime i {
  margin-right: 5px;
}
.icon-group {
  display: flex;
  align-items: center;
  margin-right: 20px;
}
.icon-group i {
  font-size: 18px;
  color: #777;
  margin-left: 15px;
  position: relative;
}
.icon-group .badge {
  position: absolute;
  top: -5px;
  right: -5px;
  background-color: #dc3545;
  color: #fff;
  border-radius: 50%;
  width: 15px;
  height: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 600;
}
.icon-group i:first-child {
  margin-left: 0;
}
.topbar .user-profile {
  display: flex;
  align-items: center;
  margin-left: 20px;
  border-left: 1px solid #eee;
  padding-left: 20px;
}
.topbar .user-profile .user-avatar {
  width: 35px;
  height: 35px;
  font-size: 14px;
}
.topbar .user-profile .user-details {
  margin-left: 10px;
}
.topbar .user-profile .user-details p {
  font-weight: 600;
  margin: 0;
}
.topbar .user-profile .user-details small {
  font-size: 11px;
  color: #777;
}
/* Action Buttons */
.action-buttons {
  margin-bottom: 20px;
  display: flex;
  gap: 10px;
  /* ระยะห่างระหว่างปุ่ม */
}
.btn {
  padding: 10px 18px;
  border-radius: 5px;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.2s;
}
.btn i {
  margin-right: 8px;
}
.btn-primary {
  background-color: #007bff;
  color: #fff;
}
.btn-primary:hover {
  background-color: #0056b3;
}
.btn-secondary {
  background-color: #e9ecef;
  color: #333;
}
.btn-secondary:hover {
  background-color: #dee2e6;
}
/* Metric Cards */
.metric-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  /* ปรับตามขนาดหน้าจอ */
  gap: 20px;
  margin-bottom: 20px;
}
.metric-card {
  padding: 15px 20px;
  /* ปรับ padding */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 120px;
  /* กำหนดความสูงขั้นต่ำ */
}
.metric-card h5 {
  font-size: 14px;
  color: #666;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.metric-card h5 i {
  color: #ccc;
  font-size: 12px;
}
.metric-card .card-content {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  /* จัดให้ไอคอนอยู่ด้านล่างขวา */
  margin-bottom: 10px;
}
.metric-card .main-value {
  font-size: 32px;
  font-weight: 700;
  color: #333;
  line-height: 1;
}
.metric-card .chart-icon {
  font-size: 40px;
  color: #e0e0e0;
}
.metric-card .sub-text {
  font-size: 12px;
  color: #888;
  margin-bottom: 15px;
}
.metric-card .sub-text .green-text i {
  margin-right: 3px;
}
.metric-card .progress-bar-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid #eee;
}
.metric-card .progress-bar-label .label {
  font-size: 12px;
  color: #666;
}
.metric-card .progress-bar-label .status {
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #fff;
}
/* Dashboard Sections - Layout for Equipment and Alerts */
.dashboard-sections {
  display: grid;
  grid-template-columns: 2fr 1fr;
  /* Equipment takes 2/3, Alerts takes 1/3 */
  gap: 20px;
}
/* Equipment Status Section */
.equipment-status {
  padding: 20px;
}
.equipment-status .card-header {
  display: flex;
  flex-wrap: wrap;
  /* เพื่อให้สามารถจัดองค์ประกอบได้หลายบรรทัด */
  justify-content: space-between;
  align-items: flex-start;
  /* จัดให้อยู่ด้านบน */
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
}
.equipment-status .card-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  width: 100%;
  /* ให้ h3 กินเต็มความกว้าง */
}
.equipment-status .card-header h3 i {
  margin-right: 10px;
  color: #007bff;
}
.equipment-status .card-header p {
  font-size: 13px;
  color: #777;
  margin-top: 5px;
  margin-bottom: 10px;
  width: 100%;
  /* ให้ p กินเต็มความกว้าง */
}
.equipment-status .card-header .search-and-filter {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  /* ขยับลงมาเล็กน้อย */
  width: 100%;
  /* ให้ search and filter กินเต็มความกว้าง */
  justify-content: flex-end;
  /* ชิดขวา */
}
.equipment-status .card-header .search-and-filter i {
  color: #aaa;
  font-size: 16px;
}
.search-box-small {
  position: relative;
}
.search-box-small i {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #aaa;
}
.search-box-small input {
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 6px 10px 6px 30px;
  width: 180px;
  font-size: 13px;
  outline: none;
}
.filter-dropdown {
  display: flex;
  align-items: center;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 6px 12px;
  font-size: 13px;
  color: #555;
  cursor: pointer;
}
.filter-dropdown i {
  margin-left: 8px;
  font-size: 12px;
}
/* Equipment Status Section*/
.equipment-status .status-summary {
  display: flex;
  justify-content: space-around;
  align-items: center;
  margin-bottom: 20px;
  background-color: #f8f9fa;
  /* สีพื้นหลังอ่อนๆ */
  border-radius: 8px;
  padding: 15px 10px;
  border: 1px solid #eee;
}
.equipment-status .status-summary .status-item {
  text-align: center;
  padding: 5px 10px;
  border-right: 1px solid #eee;
}
.equipment-status .status-summary .status-item:last-child {
  border-right: none;
}
.equipment-status .status-summary .status-item span {
  display: block;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 5px;
}
.equipment-status .status-summary .status-item small {
  font-size: 12px;
  color: #777;
  display: block;
}
.equipment-status .status-summary .status-item.total span {
  color: #333;
}
.equipment-status .status-summary .status-item.operational span {
  color: #28a745;
}
.equipment-status .status-summary .status-item.maintenance span {
  color: #ffc107;
}
.equipment-status .status-summary .status-item.offline span {
  color: #dc3545;
}
.equipment-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  /* 3 คอลัมน์สำหรับภาพตัวอย่าง */
  gap: 15px;
}
.equipment-card {
  display: flex;
  align-items: center;
  border: 1px solid #eee;
  border-radius: 8px;
  padding: 10px;
  background-color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
}
.equipment-card img {
  width: 80px;
  height: 60px;
  object-fit: cover;
  border-radius: 4px;
  margin-right: 15px;
}
.equipment-card .equipment-details p {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  color: #333;
}
.equipment-card .equipment-details .status-tag {
  font-size: 11px;
  padding: 3px 7px;
  margin-top: 5px;
}
/* System Alerts Section */
.system-alerts .card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 15px;
}
.system-alerts .card-header h3 {
  font-size: 18px;
  font-weight: 600;
  margin: 0;
}
.system-alerts .card-header p {
  font-size: 13px;
  color: #777;
  margin: 0;
  flex-grow: 1;
  /* ให้ p กินพื้นที่ */
  padding-left: 10px;
  /* เว้นระยะจาก h3 */
}
.system-alerts .card-header i.fa-ellipsis-v {
  font-size: 16px;
  color: #aaa;
  cursor: pointer;
}
.alert-list {
  display: flex;
  flex-direction: column;
}
.alert-item {
  display: flex;
  align-items: flex-start;
  /* จัดให้อยู่ด้านบนสำหรับข้อความหลายบรรทัด */
  padding: 15px 0;
  border-bottom: 1px solid #eee;
}
.alert-item:last-child {
  border-bottom: none;
}
.alert-item i {
  font-size: 20px;
  margin-right: 15px;
  margin-top: 3px;
  /* จัดให้อยู่ตรงกลางตามแนวตั้งเล็กน้อย */
}
.alert-item .alert-details {
  flex-grow: 1;
}
.alert-item .alert-details p {
  margin: 0;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  line-height: 1.4;
}
.alert-item .alert-details small {
  display: block;
  font-size: 12px;
  color: #777;
  margin-top: 3px;
  line-height: 1.3;
}
.alert-item .alert-details small:last-of-type {
  color: #999;
}
.alert-item .status-tag {
  margin-left: 15px;
  padding: 3px 8px;
  font-size: 10px;
  align-self: flex-start;
  /* จัดให้อยู่ด้านบน */
}
.alert-item .time-ago {
  font-size: 11px;
  color: #999;
  margin-left: 10px;
  white-space: nowrap;
  /* ไม่ให้ขึ้นบรรทัดใหม่ */
  align-self: flex-start;
  /* จัดให้อยู่ด้านบน */
  margin-top: 3px;
  /* ให้มันอยู่แนวเดียวกับไอคอน */
}
/* Responsive Design (ขั้นพื้นฐาน) */
@media (max-width: 1200px) {
  .dashboard-sections {
    grid-template-columns: 1fr;
    /* Stack on smaller screens */
  }
  .topbar {
    flex-wrap: wrap;
    /* ให้ Topbar สามารถขึ้นบรรทัดใหม่ได้ */
    padding: 15px 20px;
  }
  .topbar-right {
    margin-top: 15px;
    width: 100%;
    justify-content: flex-end;
    /* ชิดขวา */
  }
  .topbar-left .subtitle,
  .topbar-left .system-status-indicator,
  .topbar-left .last-sync {
    margin-left: 10px;
  }
}
@media (max-width: 992px) {
  .sidebar {
    width: 200px;
    /* ลดขนาด sidebar */
    padding: 15px;
  }
  .main-content {
    padding: 20px;
  }
  .metric-cards {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }
  .topbar-left h1 {
    font-size: 20px;
  }
  .topbar .user-profile {
    margin-left: 10px;
    padding-left: 10px;
  }
  .search-box input {
    width: 200px;
  }
  .action-buttons {
    flex-wrap: wrap;
    /* ปุ่ม action buttons ขึ้นบรรทัดใหม่ */
  }
  .action-buttons button {
    flex-grow: 1;
    /* ให้ปุ่มขยายเต็มพื้นที่ */
  }
  .equipment-status .card-header .search-and-filter {
    flex-wrap: wrap;
    justify-content: flex-start;
    /* ชิดซ้าย */
    width: auto;
  }
}
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    /* Sidebar อยู่ด้านบนของ content */
  }
  .sidebar {
    width: 100%;
    height: auto;
    padding: 15px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    border-right: none;
    border-bottom: 1px solid #e0e0e0;
  }
  .sidebar-header {
    justify-content: center;
    border-bottom: none;
    /* ลบเส้นแบ่ง */
    margin-bottom: 10px;
  }
  .sidebar-summary {
    display: none;
    /* ซ่อนสรุปด้านบนในมือถือ */
  }
  .main-navigation, .system-status {
    display: none;
    /* ซ่อนเมนูนำทางในมือถือ */
  }
  .sidebar-user-info {
    margin-top: 10px;
    justify-content: center;
    /* จัดให้อยู่ตรงกลาง */
    padding-top: 10px;
  }
  .topbar {
    flex-direction: column;
    /* topbar เรียงเป็นคอลัมน์ */
    align-items: flex-start;
    padding: 15px;
  }
  .topbar-left, .topbar-right {
    width: 100%;
    flex-wrap: wrap;
    margin-bottom: 10px;
  }
  .topbar-left h1 {
    width: 100%;
    margin-bottom: 10px;
  }
  .topbar-left .subtitle,
  .topbar-left .system-status-indicator,
  .topbar-left .last-sync {
    margin-left: 0;
    margin-right: 10px;
    margin-bottom: 5px;
  }
  .topbar-right {
    justify-content: space-between;
    margin-top: 0;
    border-top: 1px solid #eee;
    padding-top: 10px;
  }
  .search-box {
    margin-right: 0;
    margin-bottom: 10px;
    width: 100%;
  }
  .search-box input {
    width: calc(100% - 40px);
  }
  .topbar-right .uptime {
    margin-right: auto;
    /* ชิดซ้าย */
  }
  .icon-group {
    margin-right: 0;
  }
  .topbar .user-profile {
    display: none;
    /* ซ่อน user profile บน topbar ในมือถือ */
  }
  .metric-cards {
    grid-template-columns: 1fr;
    /* การ์ดเรียงเป็นคอลัมน์เดียว */
  }
  .equipment-status .card-header .search-and-filter {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .search-box-small input {
    width: calc(100% - 40px);
  }
}
@media (max-width: 480px) {
  body {
    font-size: 13px;
  }
  .main-content {
    padding: 15px;
  }
  .topbar-left h1 {
    font-size: 18px;
  }
  .btn {
    padding: 8px 12px;
    font-size: 13px;
  }
  .metric-card .main-value {
    font-size: 28px;
  }
  .metric-card .chart-icon {
    font-size: 35px;
  }
  .equipment-card img {
    width: 60px;
    height: 45px;
  }
  .equipment-card .equipment-details p {
    font-size: 13px;
  }
  .alert-item i {
    font-size: 18px;
  }
  .alert-item .alert-details p {
    font-size: 13px;
  }
  .alert-item .alert-details small, .alert-item .time-ago {
    font-size: 11px;
  }
}