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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f5f5;
  min-height: 100vh;
  line-height: 1.5;
  padding-top: 100px; /* Space for top bar */
  text-align: center;
}

/* LAYOUT COMPONENTS */

/* Top Navigation Bar */
.top-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  padding: 0 20px;
  background-color: #0b1e3f;
  z-index: 1000;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.logo {
  width: 400px;
  height: auto;
}

/* Main Containers */
.form-container {
  max-width: 800px;
  margin: 2cm auto 50px;
  background: white;
  padding: 40px 30px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  text-align: left;
}

.summary-container {
  max-width: 900px;
  margin: 50px auto;
  background: white;
  padding: 40px 30px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* TYPOGRAPHY */

h1 {
  font-size: 2.5rem;
  margin-bottom: 30px;
  color: #0b1e3f;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: #2c3e50;
  margin-bottom: 20px;
  border-bottom: 2px solid #e1e8ed;
  padding-bottom: 10px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: #2c3e50;
}

.required {
  color: #e74c3c;
}

/* FORM ELEMENTS */

/* Form Structure */
.form-row {
  margin-bottom: 25px;
}

.form-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
}

/* Form Inputs */
.form-input {
  width: 100%;
  padding: 12px 15px;
  border: 2px solid #ddd;
  border-radius: 5px;
  font-size: 1rem;
  font-family: inherit;
  transition: border-color 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: #00d4aa;
}

/* Toggle Controls */
.toggle-group {
  display: inline-flex;
  justify-content: center;
}

.toggle-group input[type="radio"] {
  display: none;
}

.toggle-option {
  padding: 8px 16px;
  cursor: pointer;
  background: #f4f4f4;
  border-radius: 10%;
  color: #333;
  font-weight: 500;
  transition: all 0.2s;
}

.toggle-group input[type="radio"]:checked + .toggle-option {
  background: #e1bbd0;
  color: white;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Checkboxes */
.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.checkbox-group label {
  font-weight: normal;
}

/* BUTTONS */

.submit-btn {
  width: 100%;
  padding: 15px;
  background: #00d4aa;
  color: white;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.submit-btn:hover {
  background: #00b894;
}

.secondary-btn {
  width: 30%;
  padding: 15px;
  background: #ccc;
  color: #333;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.secondary-btn:hover {
  background: #999;
}

.back-btn {
  width: 30%;
  padding: 15px;
  background: #ccc;
  color: #333;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.back-btn:hover {
  background: #999;
}

.button-container {
  display: flex;
  text-align: right;
  gap: 10px;
  margin-top: 45px;
}

.add-form-btn,
.remove-btn {
  background: #eee;
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.add-form-btn:hover,
.remove-btn:hover {
  background: #ddd;
}

/* SPECIALIZED COMPONENTS */

/* Alloy Cards */
.alloy-card {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 15px;
  margin-bottom: 20px;
  background: #fafafa;
}

.alloy-card h3 {
  margin-top: 0;
}

.alloy-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;   /* keeps grid aligned with select */
  margin-bottom: 4px;
}

/* Make the select fixed width, dimension fields flexible */
.alloy-row select {
  flex: 0 0 180px;
  padding: 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* Inputs container: always 2 per row */
.alloy-row .dimension-fields {
  flex: 1;  /* takes remaining space */
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 2px;
}

.alloy-row input.alloy-code-input,
.alloy-row .dimension-fields input {
  padding: 9px;
  border: 1px solid #ccc;
  border-radius: 4px;
  width: 100%;  /* fill grid cell */
}

/* Information Display */
.info-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.info-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.info-label {
  font-weight: 600;
  color: #2c3e50;
}

.info-value {
  color: #333;
  text-align: right;
}

/* Certification Display */
.cert-grid {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.cert-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 5px;
}

.cert-label {
  font-weight: 600;
  color: #2c3e50;
}

.cert-badge {
  padding: 6px 12px;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
}

.cert-yes {
  background: #00d4aa;
  color: white;
}

.cert-no {
  background: #e74c3c;
  color: white;
}

/* TABLES */

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 30px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #ddd;
}

table th {
  background: #2c3e50;
  color: white;
  padding: 15px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 0.95rem;
}

table td {
  border: none;
  border-bottom: 1px solid #e1e8ed;
  padding: 12px;
  text-align: left;
  color: #333;
}

/* Table States */
table tbody tr:nth-child(even) {
  background: #fafafa;
}

table tbody tr:hover {
  background: #f0f8ff;
  transition: background 0.2s ease;
}

.empty-table-message {
  background: #f8f9fa !important;
  color: #6c757d;
  font-style: italic;
  text-align: center;
  padding: 30px 12px;
}

/* Modal */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.modal-content {
    background: white;
    margin: 25% auto;
    padding: 20px;
    border-radius: 8px;
    width: 90%;
    max-width: 450px;
    text-align: center;
}

.modal-btn {
    background: #00d4aa;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    margin-top: 15px;
}

.modal-btn:hover {
    background: #00b894;
}

/* Terms & Conditions */
.terms-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid #ddd;
  background: #fafafa;
  color: rgb(0, 0, 0);
  padding: 10px 15px;
  cursor: pointer;
  user-select: none;
  border-radius: 5px;
  margin-bottom: 0px;
}
.terms-header .arrow {
  transition: transform 0.3s ease;
}
.terms-box {
  border: 1px solid #ccc;
  border-top: none;
  padding: 10px 15px;
  margin-bottom: 10px;
  max-height: 200px;
  overflow-y: auto;
}
.terms-checkbox {
  display: block;
  margin-bottom: 10px;
}


/* LOADING & UI STATES */

.loader-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  display: none; /* hidden by default */
  justify-content: center;
  align-items: center;
  flex-direction: column;
  z-index: 9999;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 6px solid #ccc;
  border-top: 6px solid #0b1e3f;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* RESPONSIVE DESIGN */

/* Mobile Tablets */
@media (max-width: 768px) {
  .form-container,
  .summary-container {
    padding: 30px 20px;
  }

  h1 {
    font-size: 2rem;
  }

  .alloy-row {
    flex-direction: column;
    align-items: stretch;
  }

  .info-item,
  .cert-item {
    flex-direction: column;
    align-items: stretch;
    text-align: left;
  }
  
  .info-value {
    text-align: left;
    margin-top: 5px;
  }
}

/* Mobile Phones */
@media (max-width: 600px) {
  table {
    font-size: 0.9rem;
  }
  
  table th,
  table td {
    padding: 8px 6px;
  }
}