/* --- General Styling --- */
body {
    font-family: 'Sarabun', sans-serif;
    background-color: #f4f7f9;
    color: #333;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: #ffffff;
    padding: 25px 40px;
    border-radius: 12px;
    box-shadow: 0 8px G30px rgba(0, 0, 0, 0.05);
}

header {
    text-align: center;
    margin-bottom: 30px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 20px;
}

header h1 {
    color: #2c3e50;
    margin-bottom: 5px;
}

/* --- Controls --- */
.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 30px;
}

button {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
    transition: all 0.3s ease;
}

#add-project-btn {
    background-color: #3498db;
    color: white;
}
#add-project-btn:hover { background-color: #2980b9; }

#calculate-btn {
    background-color: #27ae60;
    color: white;
}
#calculate-btn:hover { background-color: #229954; }

/* --- Project Cards & Forms --- */
#projects-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.project-card {
    border: 1px solid #ddd;
    border-radius: 10px;
    padding: 20px;
    background-color: #fafafa;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.project-header h3 { margin: 0; color: #2c3e50; }

.remove-project-btn {
    background-color: #e74c3c;
    color: white;
    padding: 5px 10px;
    font-size: 12px;
}
.remove-project-btn:hover { background-color: #c0392b; }

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 5px;
    font-weight: bold;
    font-size: 14px;
    color: #555;
}

.form-group.optional label::after {
    content: '(ไม่บังคับ)';
    font-weight: normal;
    color: #999;
    margin-left: 5px;
}


input[type="text"],
input[type="number"] {
    width: 100%;
    padding: 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    font-size: 16px;
    box-sizing: border-box;
}

/* --- Results --- */
.hidden { display: none; }

#results-container { margin-top: 40px; }

.table-wrapper { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th { background-color: #ecf0f1; font-weight: bold; }

td.highlight {
    background-color: #e8f5e9;
    font-weight: bold;
    color: #27ae60;
}

/* เพิ่มคลาสนี้เข้าไป */
td.negative-value {
    color: #e74c3c; /* สีแดงที่ดูเด่นชัด */
    font-weight: bold;
}

.chart-wrapper { max-height: 500px; }



.back-home-btn {
  position: absolute;         /* ✅ ปุ่มลอย */
  top: 30px;               /* ✅ ระยะห่างจากขอบบน */
  right: 45px;             /* ✅ ระยะห่างจากขอบขวา */
  display: inline-block;
  background: #1e88e5;
  color: #fff;
  padding: 10px 16px;
  border-radius: 6px;
  text-decoration: none;
  font-weight: bold;
  transition: 0.2s;
  z-index: 1000;           /* ✅ ให้ลอยเหนือทุก element */
}

.back-home-btn:hover {
  background: #1565c0;
}
