/**
 * LightEFX Pool Calculator Styles
 *
 * Theme-agnostic styling using CSS custom properties.
 * Adapts to both light and dark themes automatically.
 *
 * @package LightEFX_Plugin
 * @since   1.0.0
 */

/* ============================================================================
   CSS Custom Properties for Theme Adaptation
   ========================================================================= */

:root {
  /* Primary accent color (brand color) */
  --lightefx-pool-accent: #daa14c;
  --lightefx-pool-accent-hover: #ffffff;
  --lightefx-pool-accent-contrast: #202020;

  /* Pool visual colors */
  --lightefx-pool-water: #3d5a80;
  --lightefx-pool-edge: #98c1d9;
  --lightefx-pool-glow: rgba(218, 161, 76, 0.7);
  --lightefx-pool-illuminator-bg: #e0fbfc;
  --lightefx-pool-illuminator-text: #293241;

  /* Error color */
  --lightefx-pool-error: #d93030;
  --lightefx-pool-error-bg: #fff0f0;

  /* Modal & Calculator surface colors - dark theme defaults */
  --lightefx-pool-surface: #202020;
  --lightefx-pool-surface-secondary: #2a2a2a;

  /* Text colors - dark theme defaults */
  --lightefx-pool-text-primary: #ffffff;
  --lightefx-pool-text-secondary: #ddd;
  --lightefx-pool-text-muted: #8a9bad;

  /* Input colors */
  --lightefx-pool-input-bg: #ffffff;
  --lightefx-pool-input-text: #1a3b5d;
  --lightefx-pool-input-border: #a0b3c2;
  --lightefx-pool-input-focus: #007bff;
  --lightefx-pool-input-focus-shadow: rgba(0, 123, 255, 0.2);

  /* Border colors */
  --lightefx-pool-border-light: #444;
  --lightefx-pool-border-medium: #555;

  /* Modal backdrop */
  --lightefx-pool-backdrop: rgba(0, 0, 0, 0.6);

  /* Close button */
  --lightefx-pool-close-btn: #ffffff;

  /* Dimension label */
  --lightefx-pool-label-bg: rgba(255, 255, 255, 0.9);
  --lightefx-pool-label-text: #334e68;
  --lightefx-pool-label-border: #cddde8;
}

/* Light theme adjustments */
@media (prefers-color-scheme: light) {
  :root:not(.dark-theme):not([data-theme="dark"]) {
    --lightefx-pool-surface: #f8f8f8;
    --lightefx-pool-surface-secondary: #ececec;

    --lightefx-pool-text-primary: #1a1a1a;
    --lightefx-pool-text-secondary: #4a4a4a;

    --lightefx-pool-border-light: rgba(0, 0, 0, 0.1);
    --lightefx-pool-border-medium: rgba(0, 0, 0, 0.2);

    --lightefx-pool-close-btn: #1a1a1a;
  }
}

/* Explicit light theme override */
body.light-theme,
body.light,
html[data-theme="light"],
.light-mode {
  --lightefx-pool-surface: #f8f8f8;
  --lightefx-pool-surface-secondary: #ececec;

  --lightefx-pool-text-primary: #1a1a1a;
  --lightefx-pool-text-secondary: #4a4a4a;

  --lightefx-pool-border-light: rgba(0, 0, 0, 0.1);
  --lightefx-pool-border-medium: rgba(0, 0, 0, 0.2);

  --lightefx-pool-close-btn: #1a1a1a;
}

/* ============================================================================
   Modal & Wrapper
   ========================================================================= */

#pool-calculator-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9998;
  overflow-y: auto;
}

body.modal-open {
  overflow: hidden;
}

#pool-calculator-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--lightefx-pool-backdrop);
  z-index: 9998;
}

#pool-calculator-content-wrapper {
  position: relative;
  background: transparent;
  margin: 20px;
  padding: 20px;
  z-index: 9999;
  border-radius: 12px;
}

@media (min-width: 1400px) {
  #pool-calculator-content-wrapper {
    margin: 40px auto;
    max-width: 1390px;
  }
}

#pool-close-modal {
  position: absolute;
  top: 0;
  right: 10px;
  font-size: 2.5em;
  font-weight: bold;
  color: var(--lightefx-pool-close-btn);
  background: transparent;
  border: none;
  cursor: pointer;
  line-height: 1;
  z-index: 10000;
  padding: 0;
  margin: 0;
  transition: transform 0.2s, opacity 0.2s;
}

#pool-close-modal:hover {
  transform: scale(1.1);
  opacity: 0.8;
}

#pool-close-modal:focus {
  outline: 2px solid var(--lightefx-pool-accent);
  outline-offset: 4px;
}

/* ============================================================================
   Layout Containers
   ========================================================================= */

.pool-main-wrapper {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 1350px;
  margin: 0 auto;
  transition: all 0.4s ease-in-out;
}

.pool-main-wrapper.pool-initial-state {
  height: calc(100vh - 80px);
  justify-content: center;
}

.pool-top-row-wrapper {
  position: relative;
  display: flex;
  gap: 20px;
  align-items: stretch;
  width: 100%;
}

.pool-main-wrapper.pool-initial-state .pool-top-row-wrapper {
  justify-content: center;
}

.pool-content-box {
  background-color: var(--lightefx-pool-surface);
  padding: 30px;
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0, 70, 150, 0.12);
  box-sizing: border-box;
  color: var(--lightefx-pool-text-secondary);
}

.pool-calculator-container {
  position: relative;
  flex: 1 1 400px;
}

.pool-main-wrapper.pool-initial-state .pool-calculator-container {
  flex: 0 0 400px;
}

.pool-calc-results-visual-container {
  flex: 2 1 600px;
}

.pool-components-container {
  flex: 1 1 350px;
}

/* ============================================================================
   Typography
   ========================================================================= */

h2,
h3 {
  color: var(--lightefx-pool-text-primary);
  text-align: center;
  margin-top: 0;
  margin-bottom: 20px;
}

/* ============================================================================
   Form Elements
   ========================================================================= */

.pool-input-group,
.pool-options-group {
  margin-bottom: 20px;
}

.pool-imperial-input-group {
  display: flex;
  gap: 10px;
  align-items: center;
}

.pool-imperial-input-group span {
  color: var(--lightefx-pool-text-secondary);
}

.pool-options-group {
  background-color: var(--lightefx-pool-surface);
  padding: 12px 15px;
  border-radius: 8px;
}

.pool-radio-option {
  display: inline-block;
  margin-right: 20px;
}

.pool-radio-option input[type="radio"] {
  margin-right: 8px;
}

.pool-radio-option label {
  display: inline;
  font-weight: 500;
  cursor: pointer;
}

label,
.pool-group-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  color: var(--lightefx-pool-text-secondary);
}

input[type="number"],
select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--lightefx-pool-input-border);
  border-radius: 8px;
  font-size: 1em;
  font-weight: 500;
  color: var(--lightefx-pool-input-text);
  background-color: var(--lightefx-pool-input-bg);
  box-sizing: border-box;
  transition: border-color 0.3s, box-shadow 0.3s;
}

input[type="number"]::placeholder {
  color: var(--lightefx-pool-text-muted);
}

input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--lightefx-pool-input-focus);
  box-shadow: 0 0 0 3px var(--lightefx-pool-input-focus-shadow);
}

/* ============================================================================
   Buttons
   ========================================================================= */

#pool-calculateBtn {
  width: 100%;
  padding: 15px;
  background-color: var(--lightefx-pool-accent);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s;
  margin-top: 10px;
}

#pool-calculateBtn:hover {
  background-color: var(--lightefx-pool-accent-hover);
  color: var(--lightefx-pool-accent-contrast);
}

#pool-calculateBtn:focus {
  outline: none;
}

#pool-add-to-cart-btn {
  width: 100%;
  padding: 15px;
  background-color: var(--lightefx-pool-accent);
  color: white;
  border: none;
  border-radius: 30px;
  font-size: 1.1em;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.3s;
  margin-top: 20px;
}

#pool-add-to-cart-btn:hover {
  background-color: var(--lightefx-pool-accent-hover);
  color: var(--lightefx-pool-accent-contrast);
}

#pool-add-to-cart-btn:disabled {
  background-color: #5a7184;
  cursor: not-allowed;
}

/* ============================================================================
   Results Display
   ========================================================================= */

.pool-result-block {
  padding: 15px;
  border-radius: 8px;
  margin-top: 0;
}

.pool-result-block.pool-error {
  background-color: var(--lightefx-pool-error-bg);
  border-left: 5px solid var(--lightefx-pool-error);
  color: var(--lightefx-pool-error);
  font-weight: 500;
}

.pool-result-header {
  font-weight: 700;
  font-size: 1.1em;
  color: var(--lightefx-pool-text-primary);
  margin-bottom: 8px;
  text-align: left;
}

.pool-result-details {
  color: var(--lightefx-pool-text-secondary);
  line-height: 1.7;
  text-align: left;
}

.pool-result-details .pool-info-block {
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed var(--lightefx-pool-text-secondary);
}

.pool-info-block ul {
  padding-left: 20px;
  margin: 5px 0 0 0;
  list-style-type: "- ";
}

.pool-info-block li {
  margin-bottom: 8px;
}

/* ============================================================================
   Visual Layout
   ========================================================================= */

#pool-visual-layout-wrapper {
  margin-top: 20px;
  border-top: 1px solid var(--lightefx-pool-border-light);
  padding-top: 20px;
}

#pool-visual-layout {
  position: relative;
  width: 100%;
  min-height: 500px;
}

.pool-visual-header {
  position: absolute;
  top: 0;
  left: 0;
  font-weight: 700;
  font-size: 1.1em;
  color: var(--lightefx-pool-text-primary);
  margin: 0;
  text-align: left;
}

.pool-pool-shape {
  position: absolute;
  background-color: var(--lightefx-pool-water);
  border: 4px solid var(--lightefx-pool-edge);
  border-radius: 10px;
  box-sizing: border-box;
  box-shadow: inset 0 0 15px 4px var(--lightefx-pool-glow);
}

#pool-visual-layout svg line {
  filter: drop-shadow(0 0 5px var(--lightefx-pool-accent));
  stroke-width: 3;
}

.pool-illuminator-div {
  position: absolute;
  background-color: var(--lightefx-pool-illuminator-bg);
  border-radius: 5px;
  color: var(--lightefx-pool-illuminator-text);
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  text-align: center;
}

.pool-dimension-label {
  position: absolute;
  background-color: var(--lightefx-pool-label-bg);
  color: var(--lightefx-pool-label-text);
  border: 1px solid var(--lightefx-pool-label-border);
  font-size: 12px;
  font-weight: bold;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
  z-index: 10;
}

/* ============================================================================
   Pricing Styles
   ========================================================================= */

#pool-price-results-wrapper {
  width: 100%;
}

#pool-price-results-wrapper .pool-result-header {
  text-align: center;
  font-size: 1.5em;
}

.pool-price-line-item {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 1em;
}

.pool-price-line-item .pool-price-label {
  font-weight: 600;
}

.pool-price-line-item .pool-price-value {
  font-weight: 500;
}

.pool-price-summary-separator {
  border-top: 1px solid var(--lightefx-pool-border-light);
  margin: 15px 0;
}

.pool-price-total {
  display: flex;
  justify-content: space-between;
  margin-top: 10px;
}

.pool-price-total .pool-price-label {
  font-size: 1.2em;
  font-weight: 700;
}

.pool-price-total .pool-price-value {
  font-size: 1.3em;
  font-weight: 700;
  color: var(--lightefx-pool-accent);
}

/* ============================================================================
   Responsive Styles
   ========================================================================= */

@media (max-width: 1200px) {

  .pool-main-wrapper,
  .pool-main-wrapper.pool-initial-state {
    height: auto;
    align-items: center;
  }

  .pool-top-row-wrapper {
    flex-direction: column;
    align-items: center;
    width: 100%;
    gap: 0;
  }

  .pool-calculator-container,
  .pool-calc-results-visual-container,
  .pool-components-container,
  #pool-price-results-wrapper {
    width: 100%;
    max-width: 550px;
    margin-top: 20px;
  }

  .pool-calculator-container {
    margin-top: 0;
  }
}
