/* =============================================
   Materials Hive Calculator – Frontend Styles
   Prefixed with .mhc- to avoid any conflicts
   with Elementor or other WP plugins.
   ============================================= */

/* ---- Reset scoped to our wrapper ---- */
.mhc-wrapper,
.mhc-wrapper *,
.mhc-wrapper *::before,
.mhc-wrapper *::after {
    box-sizing: border-box;
}

/* ---- Root wrapper ---- */
.mhc-wrapper {
    font-family: 'Inter', 'Segoe UI', Arial, sans-serif;
    color: #1a1a2e;
    max-width: 860px;
    margin: 0 auto;
    padding: 0;
}

/* ---- Section panels ---- */
.mhc-selector,
.mhc-order-panel,
.mhc-contact-form,
.mhc-success {
    background: #ffffff;
    border: 1px solid #e5e9f0;
    border-radius: 12px;
    padding: 36px 40px;
    margin-bottom: 24px;
    box-shadow: 0 2px 16px rgba(0,0,0,.06);
}

/* ---- Headings ---- */
.mhc-section-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 6px 0;
    line-height: 1.3;
}

.mhc-subtitle {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 28px 0;
}

/* ---- Form grid ---- */
.mhc-form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px 24px;
}

.mhc-form-grid--contact {
    grid-template-columns: repeat(2, 1fr);
}

.mhc-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.mhc-field--full {
    grid-column: 1 / -1;
}

/* ---- Labels ---- */
.mhc-label {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    letter-spacing: 0.3px;
}

.mhc-required { color: #e84040; margin-left: 2px; }
.mhc-optional { color: #9ca3af; font-weight: 400; }

/* ---- Inputs & selects ---- */
.mhc-input,
.mhc-select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #1a1a2e;
    background: #fafafa;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
}

.mhc-input:focus,
.mhc-select:focus {
    border-color: #1a1a2e;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(26,26,46,.08);
}

.mhc-input::placeholder { color: #9ca3af; }

.mhc-textarea {
    resize: vertical;
    min-height: 90px;
}

.mhc-select-wrap {
    position: relative;
}

.mhc-select-wrap::after {
    content: '';
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 0;
    height: 0;
    border-left: 5px solid transparent;
    border-right: 5px solid transparent;
    border-top: 6px solid #6b7280;
    pointer-events: none;
}

.mhc-select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ---- Buttons ---- */
.mhc-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    border: 2px solid transparent;
    transition: all .2s;
    text-decoration: none;
    white-space: nowrap;
}

.mhc-btn--primary {
    background: #1a1a2e;
    color: #ffffff;
    border-color: #1a1a2e;
}

.mhc-btn--primary:hover {
    background: #2d2d4e;
    border-color: #2d2d4e;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(26,26,46,.25);
}

.mhc-btn--outline {
    background: transparent;
    color: #1a1a2e;
    border-color: #1a1a2e;
}

.mhc-btn--outline:hover {
    background: #1a1a2e;
    color: #ffffff;
}

.mhc-btn--large {
    padding: 14px 32px;
    font-size: 16px;
}

.mhc-btn--sm {
    padding: 9px 18px;
    font-size: 13px;
}

.mhc-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

/* ---- Price preview ---- */
.mhc-preview {
    margin-top: 20px;
    background: linear-gradient(135deg, #1a1a2e 0%, #2d3561 100%);
    border-radius: 10px;
    padding: 20px 24px;
    color: #fff;
}

.mhc-preview-inner {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.mhc-preview-label {
    font-size: 13px;
    opacity: 0.7;
    font-weight: 500;
}

.mhc-preview-price {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.mhc-preview-weight {
    font-size: 13px;
    opacity: 0.65;
    margin-left: auto;
}

/* ---- Actions ---- */
.mhc-actions {
    margin-top: 24px;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---- Error / info ---- */
.mhc-error {
    margin-top: 12px;
    background: #fff1f1;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 12px 16px;
    color: #b91c1c;
    font-size: 13.5px;
    font-weight: 500;
}

/* ---- Order panel ---- */
.mhc-order-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.mhc-order-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

.mhc-item-count {
    font-size: 12px;
    background: #e5e9f0;
    color: #374151;
    padding: 4px 10px;
    border-radius: 20px;
    font-weight: 600;
}

/* ---- Line items ---- */
.mhc-items-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 24px;
}

.mhc-item-card {
    background: #f8f9fb;
    border: 1px solid #e5e9f0;
    border-radius: 10px;
    padding: 16px 18px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
    align-items: start;
    animation: mhcFadeIn .25s ease;
}

.mhc-item-details {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 20px;
}

.mhc-item-tag {
    font-size: 13px;
    color: #374151;
}

.mhc-item-tag strong {
    color: #1a1a2e;
}

.mhc-item-price {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    margin-top: 8px;
}

.mhc-item-weight {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
}

.mhc-remove-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: #9ca3af;
    padding: 4px;
    border-radius: 4px;
    line-height: 1;
    transition: color .15s;
}

.mhc-remove-btn:hover { color: #e84040; }

/* ---- Totals ---- */
.mhc-totals {
    border-top: 1px solid #e5e9f0;
    padding-top: 18px;
    margin-bottom: 24px;
}

.mhc-totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 14px;
    color: #374151;
    border-bottom: 1px solid #f3f4f6;
}

.mhc-totals-row--price {
    font-size: 15px;
    font-weight: 700;
    color: #1a1a2e;
    border-bottom: none;
    padding-top: 12px;
}

.mhc-totals-value {
    font-weight: 600;
    color: #1a1a2e;
}

.mhc-totals-price {
    font-size: 28px;
    font-weight: 800;
    color: #1a1a2e;
    letter-spacing: -0.5px;
}

.mhc-totals-note {
    font-size: 12px;
    color: #9ca3af;
    margin: 10px 0 0 0;
    font-style: italic;
}

/* ---- Order actions ---- */
.mhc-order-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

/* ---- Form note ---- */
.mhc-form-note {
    font-size: 12.5px;
    color: #9ca3af;
    margin: 14px 0 0 0;
    text-align: center;
}

/* ---- Success state ---- */
.mhc-success {
    text-align: center;
    padding: 56px 40px;
}

.mhc-success-icon {
    width: 80px;
    height: 80px;
    background: #ecfdf5;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    color: #16a34a;
}

.mhc-success-title {
    font-size: 22px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0 0 10px;
}

.mhc-success-msg {
    font-size: 15px;
    color: #6b7280;
    margin: 0 0 28px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

/* ---- Spinner ---- */
.mhc-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: mhcSpin .6s linear infinite;
}

/* ---- Animations ---- */
@keyframes mhcSpin {
    to { transform: rotate(360deg); }
}

@keyframes mhcFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
    .mhc-selector,
    .mhc-order-panel,
    .mhc-contact-form,
    .mhc-success {
        padding: 24px 20px;
    }

    .mhc-form-grid,
    .mhc-form-grid--contact {
        grid-template-columns: 1fr;
    }

    .mhc-field--full {
        grid-column: 1;
    }

    .mhc-preview-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .mhc-preview-weight { margin-left: 0; }

    .mhc-totals-price {
        font-size: 22px;
    }

    .mhc-order-actions,
    .mhc-actions {
        flex-direction: column;
    }

    .mhc-btn {
        width: 100%;
        justify-content: center;
    }
}
