@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap");

/* -------------------- Global -------------------- */
* {
  box-sizing: border-box;
}

body,
html {
  font-family: "Montserrat", sans-serif;
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #000000;
  color: #ffffff;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

main {
  flex: 1;
}

/* -------------------- Hero Background (Homepage) -------------------- */
.custom-bg {
  position: relative;
  width: 100vw;
  height: 100vh;
  border-radius: 1rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.7);
  overflow: hidden;
  background: linear-gradient(135deg, #000000 0%, #001f3f 60%, #000000 100%);
  display: flex;
  flex-direction: column;
  padding: 2.5rem 1.5rem;
  align-items: center;
  text-align: center;
}

.custom-bg::before {
  content: "";
  position: absolute;
  top: -40%;
  left: -30%;
  width: 160%;
  height: 160%;
  background: radial-gradient(circle at center, #001f3f 0%, transparent 70%);
  opacity: 0.6;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
  border-radius: 50%;
}

.custom-bg::after {
  content: "";
  position: absolute;
  bottom: -30%;
  right: -20%;
  width: 140%;
  height: 140%;
  background: radial-gradient(circle at center, #0a2a5e 0%, transparent 70%);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
  filter: blur(100px);
  border-radius: 50%;
}

/* -------------------- Vertical Dots (Homepage Decoration) -------------------- */
.dots-vertical {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  z-index: 10;
  align-items: center;
}

.dots-vertical .line {
  width: 2px;
  height: 64px;
  background: white;
  border-radius: 9999px;
  margin-bottom: 1.5rem;
}

/* -------------------- Page Container (Inner Pages) -------------------- */
.page-container {
  background: linear-gradient(135deg, #000000 0%, #001f3f 60%, #000000 100%);
  min-height: 100vh;
  position: relative;
  padding: 3rem 0;
}

.page-container::before {
  content: "";
  position: absolute;
  top: -20%;
  left: -15%;
  width: 80%;
  height: 80%;
  background: radial-gradient(circle at center, #001f3f 0%, transparent 70%);
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
  filter: blur(80px);
}

/* -------------------- Calculation Cards -------------------- */
.calc-card {
  background: linear-gradient(135deg, #001f3f 0%, #000814 100%);
  border-radius: 1rem;
  padding: 2rem;
  text-align: center;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.calc-card:hover {
  transform: translateY(-10px) scale(1.05);
  box-shadow: 0 12px 30px rgba(0, 31, 63, 0.8);
  background: linear-gradient(135deg, #003566 0%, #001f3f 100%);
}

.calc-card h2,
.calc-card h3 {
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 0.75rem;
}

.calc-card p {
  color: #cbd5e1;
  font-size: 0.875rem;
  margin: 0;
}

/* -------------------- Form Elements -------------------- */
.form-label {
  color: #ffffff;
  font-weight: 600;
  margin-bottom: 0.5rem;
  display: block;
}

.form-control,
.form-select {
  background-color: #001f3f;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  border-radius: 0.5rem;
  padding: 0.75rem 1rem;
  width: 100%;
  font-family: "Montserrat", sans-serif;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-control:focus,
.form-select:focus {
  border-color: #4da3ff;
  box-shadow: 0 0 0 0.25rem rgba(77, 163, 255, 0.25);
  background-color: #002a52;
  color: #ffffff;
  outline: none;
}

.form-control::placeholder {
  color: #94a3b8;
}

input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  opacity: 1;
}

/* -------------------- Buttons -------------------- */
.btn {
  font-family: "Montserrat", sans-serif;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.btn-primary {
  background-color: #0066cc;
  color: #ffffff;
}

.btn-primary:hover {
  background-color: #0052a3;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.4);
}

.btn-success {
  background-color: #10b981;
  color: #ffffff;
}

.btn-success:hover {
  background-color: #059669;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background-color: #ef4444;
  color: #ffffff;
}

.btn-danger:hover {
  background-color: #dc2626;
  transform: translateY(-2px);
}

.btn-warning {
  background-color: #f59e0b;
  color: #ffffff;
}

.btn-warning:hover {
  background-color: #d97706;
  transform: translateY(-2px);
}

.btn-secondary {
  background-color: #475569;
  color: #ffffff;
}

.btn-secondary:hover {
  background-color: #334155;
  transform: translateY(-2px);
}

/* -------------------- Cards -------------------- */
.card {
  background: linear-gradient(135deg, #001f3f 0%, #000814 100%);
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.6);
  margin-bottom: 2rem;
  overflow: hidden;
}

.card-header {
  background: linear-gradient(135deg, #0066cc 0%, #003d7a 100%);
  color: #ffffff;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header h3 {
  margin: 0;
  font-weight: 700;
  font-size: 1.25rem;
}

.card-body {
  padding: 1.5rem;
  color: #ffffff;
}

/* -------------------- Tables -------------------- */
.table-responsive {
  overflow-x: auto;
  margin: 1rem 0;
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: #001a33;
  border-radius: 0.5rem;
  overflow: hidden;
  color: #ffffff;
}

.table thead th {
  background: linear-gradient(135deg, #0066cc 0%, #003d7a 100%);
  color: #ffffff;
  font-weight: 700;
  padding: 1rem;
  text-align: center;
  border: none;
}

.table tbody td,
.table tfoot td {
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.table tbody tr:hover {
  background-color: rgba(0, 102, 204, 0.1);
}

.table-bordered td,
.table-bordered th {
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.table tfoot {
  background-color: rgba(0, 102, 204, 0.2);
  font-weight: 600;
}

/* -------------------- Canvas -------------------- */
canvas {
  background-color: #001a33;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  max-width: 100%;
  height: auto;
}

#traverseCanvas {
  background-color: #001a33;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
}

/* -------------------- Visualization Elements -------------------- */
.visualization-container {
  height: 300px;
  position: relative;
  margin-top: 20px;
  background: #001a33;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  overflow: hidden;
}

.station-marker {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #4da3ff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.station-label {
  position: absolute;
  font-size: 0.8rem;
  transform: translate(-50%, -120%);
  color: #4da3ff;
  font-weight: bold;
}

.level-line {
  position: absolute;
  height: 2px;
  background: #4da3ff;
  z-index: 5;
}

.ground-line {
  position: absolute;
  height: 2px;
  background: #64748b;
  bottom: 0;
  width: 100%;
}

/* -------------------- Legend -------------------- */
.legend {
  margin-top: 1rem;
  font-size: 0.9em;
  text-align: center;
}

.legend-item {
  display: inline-block;
  margin-right: 1.5rem;
  color: #cbd5e1;
}

.legend-color {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 0.5rem;
  vertical-align: middle;
  border-radius: 2px;
}

.station-color {
  background-color: #4da3ff;
}

.line-color {
  background-color: #ffffff;
}

.error-color {
  background-color: #ef4444;
}

/* -------------------- Typography -------------------- */
h1,
h2,
h3,
h4,
h5,
h6 {
  color: #ffffff;
  font-weight: 700;
  margin-bottom: 1rem;
}

h1 {
  font-size: 2.5rem;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.5rem;
}

p {
  color: #cbd5e1;
  line-height: 1.6;
}

.text-primary {
  color: #4da3ff !important;
}

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

/* -------------------- Utility Classes -------------------- */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  position: relative;
  z-index: 1;
}

.row {
  display: flex;
  flex-wrap: wrap;
  margin: 0 -0.75rem;
}

.col-md-6 {
  flex: 0 0 50%;
  max-width: 50%;
  padding: 0 0.75rem;
}

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

.mb-4 {
  margin-bottom: 1.5rem;
}

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

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

.mt-4 {
  margin-top: 1.5rem;
}

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

.me-2 {
  margin-right: 0.5rem;
}

.py-5 {
  padding-top: 3rem;
  padding-bottom: 3rem;
}

.px-5 {
  padding-left: 3rem;
  padding-right: 3rem;
}

.fw-bolder {
  font-weight: 700;
}

.d-flex {
  display: flex;
}

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

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

/* -------------------- Footer -------------------- */
footer {
  background: #000000;
  color: #cbd5e1;
  padding: 2rem 0;
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

footer a {
  color: #4da3ff;
  text-decoration: none;
  transition: color 0.3s ease;
}

footer a:hover {
  color: #66b3ff;
  text-decoration: underline;
}

footer .small {
  font-size: 0.875rem;
}

/* -------------------- Responsive -------------------- */
@media (max-width: 768px) {
  .col-md-6 {
    flex: 0 0 100%;
    max-width: 100%;
  }

  .calc-card {
    padding: 1.5rem;
  }

  .custom-bg {
    height: auto;
    min-height: 100vh;
    padding: 2rem 1rem;
  }

  h1 {
    font-size: 2rem;
  }

  h2 {
    font-size: 1.75rem;
  }

  .table {
    font-size: 0.875rem;
  }

  .table thead th,
  .table tbody td {
    padding: 0.5rem;
  }

  .btn {
    padding: 0.625rem 1.25rem;
    font-size: 0.875rem;
  }

  .legend-item {
    display: block;
    margin-bottom: 0.5rem;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 1rem;
  }

  .dots-vertical {
    display: none;
  }
}
