/**
 * HomeWorth Engine Frontend Styles
 *
 * @package HomeWorthEngine
 * @since 1.1.0
 */

/* ===========================
   Form Container
   =========================== */
#homeworth-engine-form {
    max-width: 600px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

/* ===========================
   Steps
   =========================== */
.hwe-step {
    display: none;
    margin-bottom: 20px;
    padding: 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hwe-step[data-step="1"] {
    display: block;
}

.hwe-step-active {
    display: block;
    animation: hwe-fade-in 0.3s ease-in;
}

@keyframes hwe-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hwe-step h3 {
    margin: 0 0 20px 0;
    padding-bottom: 10px;
    border-bottom: 2px solid #0073aa;
    color: #23282d;
    font-size: 1.5em;
    font-weight: 600;
}

/* ===========================
   Form Fields
   =========================== */
.hwe-step p {
    margin: 0 0 15px 0;
}

.hwe-step label {
    display: block;
    margin-bottom: 5px;
    color: #23282d;
    font-weight: 500;
    font-size: 14px;
}

.hwe-step input[type="text"],
.hwe-step input[type="email"],
.hwe-step input[type="number"],
.hwe-step input[type="tel"],
.hwe-step select,
.hwe-step textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: border-color 0.3s, box-shadow 0.3s;
    box-sizing: border-box;
}

.hwe-step input:focus,
.hwe-step select:focus,
.hwe-step textarea:focus {
    outline: none;
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.hwe-step input::placeholder,
.hwe-step textarea::placeholder {
    color: #999;
}

/* Field Error State */
.hwe-field-error {
    border-color: #dc3232 !important;
    box-shadow: 0 0 0 1px #dc3232 !important;
}

.hwe-error-message {
    display: block;
    margin-top: 5px;
    color: #dc3232;
    font-size: 13px;
    font-weight: 500;
}

/* ===========================
   Buttons
   =========================== */
.hwe-step button {
    padding: 12px 24px;
    background: #0073aa;
    color: #ffffff;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.3s, transform 0.1s;
}

.hwe-step button:hover {
    background: #005a87;
}

.hwe-step button:active {
    transform: scale(0.98);
}

.hwe-step button:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

.hwe-step button.prev-step {
    background: #f7f7f7;
    color: #555;
    margin-right: 10px;
}

.hwe-step button.prev-step:hover {
    background: #e5e5e5;
}

/* Loading State */
button.hwe-loading {
    position: relative;
    color: transparent;
}

button.hwe-loading::after {
    content: "";
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid #ffffff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: hwe-spin 0.6s linear infinite;
}

@keyframes hwe-spin {
    to {
        transform: rotate(360deg);
    }
}

/* ===========================
   Messages
   =========================== */
.hwe-message {
    display: none;
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
    font-size: 14px;
    line-height: 1.5;
}

.hwe-message-success {
    background: #d4edda;
    border: 1px solid #c3e6cb;
    color: #155724;
}

.hwe-message-error {
    background: #f8d7da;
    border: 1px solid #f5c6cb;
    color: #721c24;
}

.hwe-message::before {
    content: "";
    display: inline-block;
    width: 18px;
    height: 18px;
    margin-right: 8px;
    vertical-align: middle;
}

.hwe-message-success::before {
    content: "✓";
    font-weight: bold;
}

.hwe-message-error::before {
    content: "✕";
    font-weight: bold;
}

/* ===========================
   Progress Indicator
   =========================== */
.hwe-progress {
    display: flex;
    justify-content: space-between;
    margin-bottom: 30px;
    padding: 0;
    list-style: none;
}

.hwe-progress-step {
    flex: 1;
    text-align: center;
    padding: 10px;
    position: relative;
}

.hwe-progress-step::after {
    content: "";
    position: absolute;
    top: 15px;
    left: 50%;
    width: 100%;
    height: 2px;
    background: #ddd;
    z-index: -1;
}

.hwe-progress-step:last-child::after {
    display: none;
}

.hwe-progress-step.active {
    color: #0073aa;
    font-weight: 600;
}

/* ===========================
   Responsive Design
   =========================== */
@media (max-width: 768px) {
    #homeworth-engine-form {
        padding: 15px;
    }

    .hwe-step {
        padding: 15px;
    }

    .hwe-step h3 {
        font-size: 1.3em;
    }

    .hwe-step button {
        width: 100%;
        margin-bottom: 10px;
    }

    .hwe-step button.prev-step {
        margin-right: 0;
    }
}

@media (max-width: 480px) {
    #homeworth-engine-form {
        padding: 10px;
    }

    .hwe-step {
        padding: 10px;
    }

    .hwe-step h3 {
        font-size: 1.2em;
    }

    .hwe-step input,
    .hwe-step select,
    .hwe-step textarea {
        font-size: 16px; /* Prevent zoom on iOS */
    }
}

/* ===========================
   Accessibility
   =========================== */
.hwe-step input:focus,
.hwe-step select:focus,
.hwe-step textarea:focus,
.hwe-step button:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
}

/* Screen reader only */
.hwe-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ===========================
   Valuation Display
   =========================== */

/* Default Color Scheme (customizable via admin settings):
   - Primary: #0073aa (WordPress blue)
   - Secondary: #005a87
   - Can be overridden via inline styles based on branding settings
*/

.hwe-valuation {
    max-width: 700px;
    margin: 30px auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
}

.hwe-valuation-loading,
.hwe-valuation-error {
    text-align: center;
    padding: 40px 20px;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.hwe-valuation-loading p {
    font-size: 16px;
    color: #32373c;
    margin: 0;
}

.hwe-valuation-error p {
    font-size: 16px;
    color: #dc3232;
    margin: 0;
}

.hwe-valuation-content {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.hwe-valuation-header {
    padding: 30px;
    background: linear-gradient(135deg, #0073aa 0%, #005a87 100%);
    text-align: center;
}

.hwe-valuation-header h2 {
    margin: 0;
    color: #ffffff;
    font-size: 28px;
    font-weight: 600;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.hwe-valuation-results {
    padding: 40px 30px;
}

.hwe-valuation-item {
    margin-bottom: 20px;
    text-align: center;
}

.hwe-valuation-mean {
    padding: 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 8px;
    margin-bottom: 30px;
}

.hwe-valuation-mean .hwe-valuation-label {
    display: block;
    font-size: 16px;
    font-weight: 500;
    color: #32373c;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.hwe-valuation-mean .hwe-valuation-value {
    display: block;
    font-size: 48px;
    font-weight: 700;
    color: #0073aa;
    line-height: 1.2;
}

.hwe-valuation-range {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 30px;
}

.hwe-valuation-range .hwe-valuation-item {
    padding: 20px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.hwe-valuation-range .hwe-valuation-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: #6c757d;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hwe-valuation-range .hwe-valuation-value {
    display: block;
    font-size: 24px;
    font-weight: 700;
    color: #32373c;
}

.hwe-valuation-disclaimer {
    padding: 20px 30px 30px;
    border-top: 1px solid #e9ecef;
}

.hwe-valuation-disclaimer p {
    margin: 0;
    font-size: 13px;
    color: #6c757d;
    line-height: 1.6;
    font-style: italic;
}

/* Responsive Valuation Display */
@media (max-width: 768px) {
    .hwe-valuation {
        margin: 20px auto;
    }

    .hwe-valuation-header {
        padding: 25px 20px;
    }

    .hwe-valuation-header h2 {
        font-size: 24px;
    }

    .hwe-valuation-results {
        padding: 30px 20px;
    }

    .hwe-valuation-mean {
        padding: 25px 20px;
    }

    .hwe-valuation-mean .hwe-valuation-value {
        font-size: 36px;
    }

    .hwe-valuation-range {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .hwe-valuation-range .hwe-valuation-value {
        font-size: 20px;
    }
}

@media (max-width: 480px) {
    .hwe-valuation-header h2 {
        font-size: 20px;
    }

    .hwe-valuation-mean .hwe-valuation-value {
        font-size: 32px;
    }

    .hwe-valuation-disclaimer {
        padding: 15px 20px 25px;
    }
}

/* ===========================
   Branding Color Overrides
   =========================== */

/* Form styling with branded colors (default WordPress blue) */
.hwe-step h3 {
    border-bottom-color: #0073aa;
    color: #23282d;
}

.hwe-step input:focus,
.hwe-step select:focus,
.hwe-step textarea:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 1px #0073aa;
}

.hwe-step button {
    background: #0073aa;
}

.hwe-step button:hover {
    background: #005a87;
}

.hwe-step input:focus,
.hwe-step select:focus,
.hwe-step textarea:focus,
.hwe-step button:focus {
    outline-color: #0073aa;
}

.hwe-progress-step.active {
    color: #0073aa;
}

/* Required field indicator */
.required {
    color: #dc3232;
}
