/* Reset and base styles */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Segoe UI', sans-serif;
}

body {
  background: #f4f6f8;
  color: #333;
  padding: 20px;
  display: flex;
  justify-content: center;
}

/* Main container */
.calculator-container {
  background: white;
  max-width: 1000px;
  width: 100%;
  padding: 30px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
}

h1 {
  text-align: center;
  margin-top: 30px;
  margin-bottom: 80px;
}




/* Inputs */
.input-group {
  margin-bottom: 15px;
}

label {
  display: block;
  font-weight: bold;
  margin-bottom: 5px;
}

input {
  width: 100%;
  padding: 10px;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 6px;
}

/* Button */
button {
  width: 100%;
  padding: 15px;
  background-color: #0077cc;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 10px;
  transition: background 0.3s;
}

button:hover {
  background-color: #005fa3;
}

/* Result */
.result {
  min-height: 32px;
  font-size: 1.4rem;
  font-weight: bold;
  text-align: center;
  color: #0077cc;
  margin-top: 40px;     /* 👈 pushes result down */
  margin-bottom: 0;     /* 👈 keeps box tight below */
  transition: all 0.2s ease;
}





/* Box Visual */
.box-visual {
  margin-top: 40px;
  display: flex;
  justify-content: center;
}

.box {
  position: relative;
  width: 200px;
  height: 120px;
  background: #e0ecf8;
  border: 2px dashed #0077cc;
  border-radius: 6px;
  transform: perspective(600px) rotateX(20deg) rotateY(20deg);
}

/* Dimensions */
.dim {
  position: absolute;
  font-size: 0.8rem;
  background: #0077cc;
  color: white;
  padding: 2px 5px;
  border-radius: 4px;
}

.dim-length {
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
}

.dim-width {
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
}

.dim-depth {
  top: 50%;
  right: -70px;
  transform: translateY(-50%) rotate(90deg);
}

/* Horizontal input layout */
.inputs-row {
  display: flex;
  flex-direction: row;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 15px;
}

.input-group {
  flex: 1;
  min-width: 100px;
}

/* 3D Box Scene */
.box-visual {
  perspective: 800px;
  height: 300px;
  margin-top: 40px;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 3D cube */
.cube {
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(-20deg) rotateY(30deg);
  transition: all 0.3s ease;
}

.cube .face {
  position: absolute;
  background-color: rgba(0, 119, 204, 0.1);
  border: 2px solid #0077cc;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.8rem;
  color: #0077cc;
  font-weight: bold;
}

/* Cube faces */
.cube .front  { transform: translateZ(calc(var(--depth) / 2)); width: var(--width); height: var(--height); }
.cube .back   { transform: rotateY(180deg) translateZ(calc(var(--depth) / 2)); width: var(--width); height: var(--height); }
.cube .right  { transform: rotateY(90deg) translateZ(calc(var(--width) / 2)); width: var(--depth); height: var(--height); }
.cube .left   { transform: rotateY(-90deg) translateZ(calc(var(--width) / 2)); width: var(--depth); height: var(--height); }
.cube .top    { transform: rotateX(90deg) translateZ(calc(var(--height) / 2)); width: var(--width); height: var(--depth); }
.cube .bottom { transform: rotateX(-90deg) translateZ(calc(var(--height) / 2)); width: var(--width); height: var(--depth); }

.simple-box {
  position: relative;
  width: 200px;
  height: 100px; /* 👈 reduced from 120px */
  background: linear-gradient(135deg, #e0ecf8, #c7dff7);
  border: 2px solid #0077cc;
  border-radius: 6px;
  box-shadow: 10px 10px 20px rgba(0,0,0,0.1);
  margin-top: 10px; /* 👈 tighter spacing from result text */
  transform: skewY(-5deg) rotateX(5deg);
}


/* Dimension Labels */
.label {
  position: absolute;
  background: #0077cc;
  color: white;
  padding: 2px 6px;
  font-size: 0.75rem;
  border-radius: 4px;
  font-weight: bold;
}

.length-label {
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
}

.width-label {
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
}

.height-label {
  top: 50%;
  right: -60px;
  transform: translateY(-50%) rotate(-90deg);
}

.button-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 15px;
}

.btn {
  flex: 1;
  padding: 15px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.3s;
  color: white;
  font-weight: bold;
}

.btn-green {
  background-color: #28a745;
}

.btn-green:hover {
  background-color: #218838;
}

.btn-grey {
  background-color: #6c757d;
}

.btn-grey:hover {
  background-color: #5a6268;
}

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

.back-link a {
  text-decoration: none;
  color: #0077cc;
  font-weight: bold;
  font-size: 1rem;
  transition: color 0.3s ease;
}

.back-link a:hover {
  color: #005fa3;
  text-decoration: underline;
}
