/* Enhanced Calculator Styles */

/* Module coefficient styling */
.coefficient {
  display: inline-block;
  background-color: rgba(0, 0, 0, 0.2);
  color: #ffc10d;
  font-size: 12px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 10px;
}

/* Hide results div by default */
.results {
  display: none;
}

/* Results Popup styling */
#resultsPopup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 1000;
  display: none;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  transition: all 0.3s ease;
}

.popup-content {
  background-color: #f8f9fa;
  width: 92%;
  max-width: 480px;
  max-height: 85vh;
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95);
  opacity: 0;
  transition: all 0.3s ease;
  animation: popup-appear 0.3s ease forwards;
}

@keyframes popup-appear {
  from {
    transform: scale(0.95);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.popup-header {
  background: linear-gradient(135deg, #1d4358 0%, #0f2a3b 100%);
  color: white;
  padding: 18px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative;
  border-bottom: 3px solid #ffc10d;
}

.popup-header::after {
  content: "";
  position: absolute;
  bottom: -10px;
  left: 20px;
  width: 20px;
  height: 20px;
  background: #ffc10d;
  transform: rotate(45deg);
  z-index: 0;
}

.popup-header h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.popup-close {
  cursor: pointer;
  width: 34px;
  height: 34px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 50%;
  background-color: rgba(255, 255, 255, 0.15);
  transition: all 0.2s ease;
  font-size: 20px;
  z-index: 1;
}

.popup-close:hover {
  background-color: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.popup-body {
  padding: 25px 20px;
  overflow-y: auto;
}

/* Popup results styling */
.popup-result {
  background: linear-gradient(135deg, #141c33 0%, #0d1424 100%);
  color: white;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  position: relative;
  overflow: hidden;
}

.popup-result::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background-color: #ffc10d;
}

.popup-result span:first-child {
  font-size: 18px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.popup-result span:last-child {
  font-size: 24px;
  font-weight: 700;
}

.popup-unit {
  background: linear-gradient(135deg, #1d4358 0%, #173646 100%);
  color: white;
  border-radius: 12px;
  margin-bottom: 18px;
  padding: 0;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  overflow: hidden;
}

.popup-unit-header {
  display: flex;
  justify-content: space-between;
  padding: 15px 18px;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  background-color: rgba(0, 0, 0, 0.15);
}

.popup-unit-header span:first-child {
  font-size: 16px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.popup-unit-header span:last-child {
  font-size: 18px;
  font-weight: 700;
}

.popup-unit-coef {
  background-color: rgba(0, 0, 0, 0.3);
  color: #ffc10d;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  margin-left: 10px;
  font-weight: normal;
  text-transform: none;
  letter-spacing: normal;
}

.popup-unit-details {
  padding: 12px 10px;
}

.popup-unit-details div {
  display: flex;
  justify-content: space-between;
  padding: 10px 15px;
  transition: background-color 0.2s ease;
  border-radius: 6px;
}

.popup-unit-details div:hover {
  background-color: rgba(255, 255, 255, 0.05);
}

.popup-unit-details div:not(:last-child) {
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 5px;
}

.popup-module-name {
  display: flex;
  align-items: center;
  font-weight: 500;
}

.popup-module-name i {
  margin-right: 10px;
  color: rgba(255, 255, 255, 0.7);
}

.popup-unit-details p {
  margin: 0;
}

.popup-unit-details p:last-child {
  font-weight: 700;
  font-size: 16px;
}

.popup-good {
  color: #2ecc71 !important;
  text-shadow: 0 0 10px rgba(46, 204, 113, 0.3);
}

.popup-bad {
  color: #e74c3c !important;
  text-shadow: 0 0 10px rgba(231, 76, 60, 0.3);
}

/* Error styling */
#erreur {
  display: none;
  color: #e74c3c;
  text-align: center;
  margin: 15px auto;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(231, 76, 60, 0.1) 0%, rgba(192, 57, 43, 0.1) 100%);
  border-radius: 10px;
  font-weight: 500;
  max-width: 480px;
  animation: error-shake 0.5s ease-in-out;
}

@keyframes error-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.input-error {
  border-color: #e74c3c !important;
  box-shadow: 0 0 0 2px rgba(231, 76, 60, 0.25) !important;
  background-color: rgba(231, 76, 60, 0.05) !important;
  animation: error-pulse 1.5s infinite;
}

@keyframes error-pulse {
  0% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(231, 76, 60, 0); }
  100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0); }
}

/* Calculator section styling */
.calculator-section {
  position: relative;
}

/* Input tooltip */
.input-tooltip {
  display: none;
}

/* Error icon styling */
.error-icon {
  display: none;
  position: absolute;
  right: -25px;
  top: 50%;
  transform: translateY(-50%);
  color: #e74c3c;
  font-size: 16px;
  animation: error-attention 2s infinite;
}

@keyframes error-attention {
  0% { transform: scale(1); }
  50% { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Results Summary styles for popup */
.result-summary {
  padding: 15px;
}

.result-summary h3 {
  text-align: center;
  margin-bottom: 25px;
  font-size: 22px;
  color: #1d4358;
}

.result-summary h3 span {
  font-weight: bold;
  padding: 3px 10px;
  border-radius: 6px;
}

.units-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 15px;
}

.unit-box {
  background-color: #f0f2f5;
  border-radius: 10px;
  padding: 15px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.unit-box h4 {
  color: #1d4358;
  margin-top: 0;
  margin-bottom: 10px;
  padding-bottom: 5px;
  border-bottom: 1px solid #ddd;
}

.unit-box p {
  margin: 5px 0;
  display: flex;
  justify-content: space-between;
  font-size: 14px;
}

.good {
  background-color: #d4edda;
  color: #155724;
}

.normal {
  background-color: #d4edda;
  color: #155724;
}

.bad {
  background-color: #f8d7da;
  color: #721c24;
}

#resultsPopup {
  display: none;
}

#resultsPopup.active {
  display: flex;
}

/* Coefficient Editor Popup Styles */
#coeffEditorPopup .popup-module {
  padding: 12px 15px;
  border-bottom: none;
  background-color: rgba(255, 255, 255, 0.05);
  margin-bottom: 6px;
  border-radius: 4px;
  transition: all 0.2s ease;
}

#coeffEditorPopup .popup-module:hover {
  background-color: rgba(255, 255, 255, 0.08);
}

#coeffEditorPopup .popup-module-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

#coeffEditorPopup .popup-unit-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #0f2a3b;
  padding: 14px 15px;
  margin-bottom: 0;
  border-radius: 4px 4px 0 0;
  min-height: 28px;
}

#coeffEditorPopup .popup-unit-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: #ffc10d;
}

#coeffEditorPopup .popup-body {
  padding: 15px;
  max-height: 70vh;
  overflow-y: auto;
}

#coeffEditorPopup .popup-unit {
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 14px;
  background-color: #0f2a3b;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

#coeffEditorPopup .popup-result {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #0f2a3b;
  padding: 15px;
  border-radius: 6px;
  margin-bottom: 14px;
}

/* Unit and Module styles for the coefficient display */
#coeffEditorPopup .popup-unit-coef {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  padding: 0;
  height: 100%;
}

/* Style for the dark module boxes like in the image */
.popup-module {
  background-color: #0d1d25;
  padding: 10px 15px;
  transition: all 0.2s ease;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  min-height: 28px;
  display: flex;
  align-items: center;
}

.popup-module:last-child {
  border-bottom: none;
}

.popup-module:hover {
  background-color: #14262f;
}

.popup-module-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  min-height: 28px;
}

/* Improved coefficient input style */
.coef-input-mini {
  width: 60px;
  height: 28px;
  background-color: #1d2e3a;
  color: #ffc10d;
  border-radius: 3px;
  border: none;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  transition: background-color 0.2s ease;
  margin: 0;
  padding: 0 5px;
}

.coef-input-mini:focus {
  outline: none;
  background-color: #253846;
  box-shadow: 0 0 0 2px rgba(255, 193, 13, 0.3);
}

/* Hidden arrows on number inputs */
.coef-input-mini::-webkit-outer-spin-button,
.coef-input-mini::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.coef-input-mini[type=number] {
  -moz-appearance: textfield;
}

/* Coefficient labels */
#coeffEditorPopup .popup-unit-coef {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  background: none;
  padding: 0;
}

#coeffEditorPopup .popup-unit-header .popup-unit-coef {
  background-color: rgba(0, 0, 0, 0.3);
}

/* Action buttons styling */
.coef-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin: 20px 0 15px;
  padding: 0;
  border-top: none;
}

#resetCoef, #applyCoef {
  padding: 10px 25px;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.2s;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

#resetCoef {
  background-color: rgba(255, 255, 255, 0.15);
  color: #fff;
}

#resetCoef:hover {
  background-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

#applyCoef {
  background-color: #ffc10d;
  color: #000;
}

#applyCoef:hover {
  background-color: #ffca3a;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

/* Global styles for the coefficient editor popup */
#coeffEditorPopup .popup-content {
  max-width: 450px;
  max-height: 85vh;
  width: 95%;
  margin: 0 auto;
  overflow: hidden;
  background-color: #101e28;
}

#coeffEditorPopup .popup-body {
  padding: 15px;
  max-height: 70vh;
  overflow-y: auto;
  background-color: #101e28;
}

#coeffEditorPopup .popup-header {
  background-color: #0f2a3b;
  border-bottom: none;
}

#coeffEditorPopup .popup-header::after {
  display: none;
}

#coeffEditorPopup .popup-header h3 {
  color: white;
  font-size: 18px;
  margin: 0;
}

/* Unit header styling */
#coeffEditorPopup .popup-unit-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: white;
}

/* Module name styling */
#coeffEditorPopup .popup-module-name {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.9);
}

/* Apply and Reset buttons */
#resetCoef, #applyCoef {
  padding: 8px 16px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s;
}

#resetCoef {
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
}

#resetCoef:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

#applyCoef {
  background-color: #ffc10d;
  color: #000;
} 