/* Modern UI/UX Styling for Property Details Form - Refreshed Design */

:root {
  /* Core Color Palette */
  --primary-dark: #333333;
  --primary-accent: #f2682c;
  --light-gray: #f9f9f9;
  --white: #ffffff;
  
  /* Extended Color Palette */
  --primary-dark-transparent: rgba(51, 51, 51, 0.05);
  --accent-transparent: rgba(242, 104, 44, 0.1);
  --border-color: rgba(51, 51, 51, 0.2);
  --text-color: #333333;
  --text-secondary: #555555;
  
  /* Sizing & Effects */
  --border-radius-sm: 6px;
  --border-radius-md: 8px;
  --border-radius-lg: 12px;
  --section-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  --input-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
  --transition-fast: all 0.2s ease;
  --transition-normal: all 0.3s ease;
}

/* Base Styles */
body {
  font-family: 'Segoe UI', Arial, sans-serif;
  margin: 0;
  padding: 0;
  color: var(--text-color);
  line-height: 1.6;
  background-color: var(--light-gray);
}

form {
  max-width: 100%;
  margin: 0 auto;
  padding: 0;
  border: none;
  background: transparent;
}

h2 {
  color: var(--primary-dark);
  font-size: 1.4rem;
  margin-top: 0;
  margin-bottom: 1.5rem;
  padding-bottom: 12px;
  position: relative;
}

h2::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  width: 60px;
  background-color: var(--primary-accent);
}

h3 {
  color: var(--primary-dark);
  font-size: 1.2rem;
  margin-top: 1.5rem;
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-top: 12px;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* Form Controls */
select, input[type="text"] {
  width: 100%;
  padding: 12px 16px;
  margin-top: 6px;
  margin-bottom: 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-sm);
  box-shadow: var(--input-shadow);
  transition: var(--transition-normal);
  font-size: 0.95rem;
  background-color: var(--white);
}

select:hover, input[type="text"]:hover {
  border-color: var(--primary-accent);
}

select:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 3px rgba(242, 104, 44, 0.15);
}

/* Layout Containers */
section {
  background-color: var(--white);
  padding: 16px;
  border-radius: var(--border-radius-lg);
  margin: 24px auto;
  max-width: 1800px;
  width: 95%;
}

/* Property details and room details sections */
#property-details, #room-details, #calculation {
  background-color: var(--white);
  padding: 30px;
  border-radius: var(--border-radius-lg);
  border: none;
  margin-bottom: 24px;
  box-shadow: var(--section-shadow);
  transition: var(--transition-normal);
}

#property-details:hover, #room-details:hover {
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.08);
}

/* Multi-step Form Navigation */
.form-step {
  display: none;
  animation: fadeIn 0.4s ease;
}

.form-step.active {
  display: block;
}

/* Progress indicator */
.form-progress {
  display: flex;
  justify-content: space-between;
  margin: 20px 0 40px;
  position: relative;
}

.form-progress::before {
  content: '';
  position: absolute;
  top: 16px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--border-color);
  z-index: 1;
}

.step {
  position: relative;
  z-index: 2;
  background: var(--white);
  padding: 0 15px;
  display: flex;
  align-items: center;
  flex-direction: column;
}

.step-number {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background-color: var(--light-gray);
  color: var(--text-secondary);
  font-weight: bold;
  margin-bottom: 8px;
  transition: var(--transition-normal);
  border: 2px solid transparent;
}

.step-title {
  font-size: 0.9rem;
  white-space: nowrap;
  transition: var(--transition-normal);
}

.step.active .step-number {
  background-color: var(--primary-accent);
  color: var(--white);
  box-shadow: 0 0 0 5px rgba(242, 104, 44, 0.2);
}

.step.active .step-title {
  font-weight: bold;
  color: var(--primary-accent);
}

/* Table styling */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  margin-top: 24px;
  table-layout: fixed;
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius-md);
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

th, td {
  padding: 14px 12px;
  text-align: center;
  font-size: 0.95rem;
}

th {
  background-color: var(--primary-dark);
  color: var(--white);
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.8rem;
  letter-spacing: 0.5px;
}

td {
  border-bottom: 1px solid var(--border-color);
}

tr:last-child td {
  border-bottom: none;
}

tr:nth-child(even) {
  background-color: var(--light-gray);
}

tr {
  transition: var(--transition-fast);
}

tr:hover {
  background-color: var(--accent-transparent);
}

/* Specific column styles */
th#room-name {
  width: 140px;
}

th#width, th#length, th#height {
  width: 80px;
}

th#external-walls, th#glazed-area {
  width: 90px;
}

th#floor-level, th#panel-type {
  width: 120px;
}

/* Input fields in table */
td input[type="text"], td select {
  width: 100%;
  padding: 10px;
  border-radius: var(--border-radius-sm);
  border: 1px solid var(--border-color);
  box-sizing: border-box;
  margin: 0;
  font-size: 0.9rem;
  box-shadow: none;
}

td input[type="text"]:focus, td select:focus {
  border-color: var(--primary-accent);
  box-shadow: 0 0 0 2px rgba(242, 104, 44, 0.15);
}

/* Button Styling */
.button-group {
  display: flex;
  gap: 12px;
  margin-top: 24px;
}

button {
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 12px 20px;
  border-radius: var(--border-radius-sm);
  transition: var(--transition-normal);
  border: none;
}

button.nextBtn {
  background-color: var(--primary-accent);
  color: white;
  box-shadow: 0 4px 6px rgba(242, 104, 44, 0.2);
}

button.backBtn {
  background-color: var(--light-gray);
  color: var(--text-color);
  border: 1px solid var(--border-color);
}

button.addRowBtn,
button.deleteRowBtn {
  background-color: var(--primary-dark);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

button.addRowBtn::before {
  content: '+';
  margin-right: 8px;
  font-size: 1.2rem;
}

button.deleteRowBtn::before {
  content: '−';
  margin-right: 8px;
  font-size: 1.2rem;
}

button:hover {
  transform: translateY(-2px);
}

button.nextBtn:hover {
  background-color: #f47a45;
  box-shadow: 0 6px 10px rgba(242, 104, 44, 0.25);
}

button.backBtn:hover {
  background-color: #eeeeee;
}

button.addRowBtn:hover,
button.deleteRowBtn:hover {
  background-color: #444444;
}

button:active {
  transform: translateY(0);
}

/* Calculation Results Styling */
#calculation h3 {
  color: var(--primary-dark);
  font-size: 1.3rem;
  margin-bottom: 1rem;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary-accent);
  display: inline-block;
}

#calculation table {
  margin-bottom: 30px;
}

#calculation table th {
  background-color: var(--primary-accent);
}

/* Help tooltips */
.field-with-tooltip {
  position: relative;
  display: inline-block;
  width: 100%;
}

.tooltip-icon {
  position: absolute;
  right: 12px;
  top: 12px;
  width: 18px;
  height: 18px;
  background-color: var(--primary-dark);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 18px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: var(--transition-normal);
}

.tooltip-icon:hover {
  background-color: var(--primary-accent);
  transform: scale(1.1);
}

.tooltip-text {
  visibility: hidden;
  width: 220px;
  background-color: var(--primary-dark);
  color: white;
  text-align: center;
  border-radius: var(--border-radius-sm);
  padding: 10px;
  position: absolute;
  z-index: 10;
  bottom: 130%;
  left: 50%;
  margin-left: -110px;
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  transform: translateY(10px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
  font-size: 0.85rem;
  line-height: 1.4;
}

.tooltip-text::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  margin-left: -8px;
  border-width: 8px;
  border-style: solid;
  border-color: var(--primary-dark) transparent transparent transparent;
}

.tooltip-icon:hover + .tooltip-text {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

/* Visual validation cues */
input:valid, select:valid {
  border-left: 3px solid var(--primary-accent);
}

input:invalid {
  border-left: 3px solid #dc3545;
}

/* Responsive styles */
@media (max-width: 1200px) {
  section {
    max-width: 800px;
  }

  /* Card view for mobile */
  #room-details table thead {
    display: none;
  }

  #room-details table tr {
    display: block;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    border-radius: var(--border-radius-md);
    padding: 16px;
    box-shadow: var(--card-shadow);
  }

  #room-details table td {
    display: block;
    text-align: right;
    position: relative;
    padding: 12px 10px;
    padding-left: 50%;
    border: none;
    border-bottom: 1px solid var(--border-color);
  }

  #room-details table tr td:last-child {
    border-bottom: none;
  }

  /* Label pseudoelements for mobile */
  #room-details table tr td::before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
    color: var(--primary-dark);
  }

  /* Since we can't add data-label attributes directly to the HTML, 
     we'll keep using nth-of-type selectors */
  #room-details table tr td:nth-of-type(1)::before {
    content: "Room";
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
  
  #room-details table tr td:nth-of-type(2)::before {
    content: "Width (M)";
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
  
  #room-details table tr td:nth-of-type(3)::before {
    content: "Length (M)";
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
  
  #room-details table tr td:nth-of-type(4)::before {
    content: "Height (M)";
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
  
  #room-details table tr td:nth-of-type(5)::before {
    content: "External Walls";
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
  
  #room-details table tr td:nth-of-type(6)::before {
    content: "Glazed Area (m²)";
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
  
  #room-details table tr td:nth-of-type(7)::before {
    content: "Floor Level";
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }
  
  #room-details table tr td:nth-of-type(8)::before {
    content: "Panel Type";
    position: absolute;
    left: 10px;
    width: 45%;
    text-align: left;
    font-weight: bold;
  }

  /* Adjust buttons for mobile */
  .button-group {
    flex-direction: column;
  }

  button {
    width: 100%;
  }
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Conditional styling for the calculation section populated by JS */
#calculation:empty {
  display: none;
}

#calculation:not(:empty) {
  animation: fadeIn 0.5s ease-in-out;
}
