/* 
  --------------
  Global Styles
  --------------
*/
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #d0f5dd, #a7ebc9);
  min-height: 100vh;
  padding: 20px;
  color: #333;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

/* 
  --------------
  Error Message
  --------------
*/
.error-message {
  background-color: #fff;
  color: #dc3545;
  padding: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  margin: 20px;
  text-align: center;
  font-weight: 500;
}

/* 
  --------------
  Typography
  --------------
*/
h1 {
  color: #0b6b3f;
  margin-bottom: 1.5rem;
  font-size: 1.8rem;
  font-weight: 600;
  text-align: center;
}

h2 {
  color: #0b6b3f;
  margin: 1rem 0;
  font-size: 1.4rem;
}

p {
  margin-bottom: 1rem;
  line-height: 1.5;
  color: #333;
}

/* 
  --------------
  Map Area
  --------------
*/
.area {
  background-color: #ffffff;
  width: 90%;
  max-width: 1200px;
  padding: 2rem 1.5rem;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  margin: 2rem auto;
}

#map {
  width: 100%;
  height: 500px;
  border: 2px solid #ccc;
  border-radius: 8px;
  margin-bottom: 1.5rem;
}

#result {
  font-size: 16px;
  font-weight: 500;
  color: #0b6b3f;
  margin: 1rem 0;
  text-align: center;
  padding: 0.5rem;
  background-color: rgba(255, 255, 255, 0.9);
  border-radius: 4px;
}

/* 
  --------------
  Form Elements
  --------------
*/
form {
  margin: 1rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input[type="text"],
input[type="file"] {
  width: 100%;
  padding: 0.8rem;
  margin: 0.5rem 0;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 1rem;
  transition: border-color 0.3s ease;
}

input[type="text"]:focus,
input[type="file"]:focus {
  outline: none;
  border-color: #0b6b3f;
  box-shadow: 0 0 0 2px rgba(11, 107, 63, 0.1);
}

label {
  display: block;
  margin-bottom: 0.5rem;
  color: #0b6b3f;
  font-weight: 500;
}

/* 
  --------------
  Buttons
  --------------
*/
button,
.btn-upload,
#nextRoad,
#download {
  background-color: #0b6b3f;
  color: white;
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 4px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: inline-block;
  text-align: center;
  text-decoration: none;
  margin: 0.5rem 0;
}

button:hover,
.btn-upload:hover,
#nextRoad:hover,
#download:hover {
  background-color: #094d2e;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:active,
.btn-upload:active,
#nextRoad:active,
#download:active {
  transform: translateY(0);
}

/* 
  --------------
  Table Styles
  --------------
*/
.table-container {
  max-height: 300px;
  overflow-y: auto;
  border: 1px solid #ccc;
  border-radius: 5px;
  margin: 1rem 0;
  background: white;
}

.table-container::-webkit-scrollbar {
  width: 8px;
}

.table-container::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 4px;
}

.table-container::-webkit-scrollbar-thumb {
  background: #0b6b3f;
  border-radius: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: white;
}

th,
td {
  padding: 0.8rem;
  text-align: left;
  border-bottom: 1px solid #ddd;
}

th {
  background-color: #f5f5f5;
  color: #0b6b3f;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}

tr:hover {
  background-color: #f9f9f9;
}

/* 
  --------------
  Distance Labels
  --------------
*/
.distance-label {
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid #0b6b3f;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 14px;
  pointer-events: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* 
  --------------
  Road Input Section
  --------------
*/
.road-input {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin: 1rem 0;
  flex-wrap: wrap;
}

.road-input input[type="text"] {
  flex: 1;
  min-width: 200px;
}

.road-input button {
  margin: 0;
}

/* 
  --------------
  Responsive Design
  --------------
*/
@media (max-width: 768px) {
  body {
    padding: 10px;
  }

  .area {
    width: 95%;
    padding: 1rem;
  }

  #map {
    height: 400px;
  }

  h1 {
    font-size: 1.5rem;
  }

  button,
  .btn-upload,
  #nextRoad,
  #download {
    padding: 0.6rem 1.2rem;
    font-size: 0.9rem;
    width: 100%;
  }

  .road-input {
    flex-direction: column;
  }

  .road-input input[type="text"] {
    width: 100%;
  }

  th,
  td {
    padding: 0.6rem;
    font-size: 0.9rem;
  }
}

/* 
  --------------
  Utility Classes
  --------------
*/
.text-center {
  text-align: center;
}

.mt-1 {
  margin-top: 0.5rem;
}

.mt-2 {
  margin-top: 1rem;
}

.mb-1 {
  margin-bottom: 0.5rem;
}

.mb-2 {
  margin-bottom: 1rem;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-1 {
  gap: 0.5rem;
}

.gap-2 {
  gap: 1rem;
}