/* HPW Service Products Frontend Styles */

.hpw-service-wrapper {
    margin: 2em 0;
    padding: 1.5em;
    background: #f9f9f9;
    border-radius: 8px;
    border: 1px solid #e5e5e5;
}

.hpw-service-header {
    margin-bottom: 1.5em;
}

.hpw-service-title {
    font-size: 1.25em;
    margin: 0 0 0.25em;
    font-weight: 600;
    color: #333;
}

.hpw-service-description {
    margin: 0;
    color: #666;
    font-size: 0.95em;
}

.hpw-service-grid {
    display: grid;
    gap: 1.5em;
    margin-top: 1.5em;
}

.hpw-service-grid.grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.hpw-service-grid.list {
    grid-template-columns: 1fr;
}

/* Card Styles - Clean Horizontal Layout */
.hpw-service-card {
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.hpw-service-card:hover {
    box-shadow: 0 2px 12px rgba(0,0,0,0.08);
    border-color: #ccc;
}

.hpw-service-card.selected {
    border-color: #7f54b3;
    box-shadow: 0 0 0 2px rgba(127, 84, 179, 0.15);
}

.hpw-service-card-inner {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    padding: 12px;
    gap: 12px;
}

/* Checkbox - Left */
.hpw-service-checkbox-wrap {
    flex: 0 0 36px;
    width: 36px;
    min-height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 4px;
}

.hpw-service-select {
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    width: 100%;
    height: 100%;
}

.hpw-service-checkbox {
    margin: 0;
    width: 20px;
    height: 20px;
    cursor: pointer;
    flex-shrink: 0;
    accent-color: #7f54b3;
}

.hpw-service-checkbox:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

/* Image Section - Fixed Size */
.hpw-service-image {
    flex: 0 0 90px;
    width: 90px;
    height: 90px;
    min-height: 90px;
    background: #f5f5f5;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
}

.hpw-service-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.hpw-service-image .hpw-service-stock-status {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    padding: 2px 6px;
    font-size: 9px;
    font-weight: 600;
    text-align: center;
    border-radius: 3px;
    background: rgba(0,0,0,0.7);
    color: #fff;
}

.hpw-service-image .out-of-stock {
    background: rgba(214, 54, 56, 0.85);
}

.hpw-service-image .on-backorder {
    background: rgba(240, 173, 78, 0.85);
}

/* Content Section - Right Side (Expands) */
.hpw-service-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.hpw-service-heading {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1em;
    flex-wrap: wrap;
}

.hpw-service-name {
    font-size: 1em;
    line-height: 1.3;
    font-weight: 600;
    color: #222;
}

.hpw-service-price {
    color: #7f54b3;
    font-weight: 600;
    font-size: 1.05em;
    white-space: nowrap;
    flex-shrink: 0;
}

.hpw-service-description {
    color: #666;
    font-size: 0.85em;
    margin: 4px 0 6px 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Service Body / Addons Section - Slides down smoothly */
.hpw-service-body {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
    margin-top: 0;
}

.hpw-service-body.open {
    max-height: 2000px;
    opacity: 1;
    margin-top: 10px;
    padding-top: 12px;
    border-top: 1px solid #eee;
}

/* Service Addons */
.hpw-service-addons-container {
    margin-top: 0;
}

.hpw-addon-fields {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.hpw-addon-item {
    padding: 8px 12px;
    background: #f8f8f8;
    border-radius: 6px;
    border: 1px solid #eee;
}

.hpw-addon-section-title {
    font-size: 0.9em;
    margin: 0 0 4px 0;
    color: #333;
    font-weight: 600;
}

.hpw-addon-section-description {
    color: #666;
    font-size: 0.8em;
    margin: 0 0 4px 0;
}

.hpw-addon-field {
    margin-top: 4px;
}

.hpw-addon-field:first-child {
    margin-top: 0;
}

.hpw-addon-field label {
    display: block;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: 0.85em;
}

.hpw-addon-field .required {
    color: #d63638;
    margin-left: 2px;
}

.hpw-addon-field input[type="text"],
.hpw-addon-field input[type="number"],
.hpw-addon-field input[type="email"],
.hpw-addon-field input[type="tel"],
.hpw-addon-field input[type="url"],
.hpw-addon-field select,
.hpw-addon-field textarea {
    width: 100%;
    max-width: 300px;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 0.85em;
    transition: border-color 0.2s;
}

.hpw-addon-field input:focus,
.hpw-addon-field select:focus,
.hpw-addon-field textarea:focus {
    border-color: #7f54b3;
    outline: none;
    box-shadow: 0 0 0 2px rgba(127, 84, 179, 0.1);
}

.hpw-addon-field textarea {
    min-height: 50px;
    resize: vertical;
}

.hpw-addon-field input[type="file"] {
    display: block;
    margin-top: 4px;
}

.hpw-addon-field .description {
    color: #666;
    font-size: 0.75em;
    margin-top: 2px;
}

.hpw-addon-field-checkbox label,
.hpw-addon-field-radio label {
    display: flex;
    align-items: center;
    gap: 0.5em;
    font-weight: normal;
    cursor: pointer;
}

.hpw-addon-field-checkbox input[type="checkbox"],
.hpw-addon-field-radio input[type="radio"] {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.hpw-addon-field .hpw-error {
    border-color: #d63638 !important;
}

.hpw-addon-field .hpw-error:focus {
    box-shadow: 0 0 0 2px rgba(214, 54, 56, 0.1) !important;
}

/* Validation */
.hpw-validation-error {
    color: #d63638;
    font-size: 0.75em;
    margin-top: 2px;
    display: block;
}

.hpw-no-addons {
    color: #999;
    font-style: italic;
    font-size: 0.85em;
    margin: 0;
    padding: 4px 0;
}

/* Unavailable state */
.hpw-service-unavailable {
    margin-top: 4px;
}

.hpw-service-unavailable-text {
    font-size: 0.8em;
    color: #999;
    font-style: italic;
}

/* Selected state - highlight card */
.hpw-service-card.selected {
    border-color: #7f54b3;
    box-shadow: 0 0 0 2px rgba(127, 84, 179, 0.15);
}

.hpw-service-card.selected .hpw-service-checkbox {
    accent-color: #7f54b3;
}

/* Responsive */
@media (max-width: 768px) {
    .hpw-service-wrapper {
        padding: 1em;
        margin: 1em 0;
    }
    
    .hpw-service-grid.grid {
        grid-template-columns: 1fr;
    }
    
    .hpw-service-card-inner {
        flex-wrap: wrap;
        padding: 10px;
        gap: 8px;
    }
    
    .hpw-service-checkbox-wrap {
        flex: 0 0 30px;
        width: 30px;
        min-height: 30px;
        padding-top: 0;
    }
    
    .hpw-service-image {
        flex: 0 0 70px;
        width: 70px;
        height: 70px;
        min-height: 70px;
    }
    
    .hpw-service-content {
        flex: 1 1 100%;
        min-width: 0;
    }
    
    .hpw-service-heading {
        flex-wrap: wrap;
    }
    
    .hpw-service-price {
        font-size: 0.95em;
    }
    
    .hpw-addon-field input[type="text"],
    .hpw-addon-field input[type="number"],
    .hpw-addon-field select,
    .hpw-addon-field textarea {
        max-width: 100%;
    }
}

/* Loading states */
.hpw-service-addons-loading {
    opacity: 0.6;
    pointer-events: none;
    position: relative;
    min-height: 30px;
}

.hpw-service-addons-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #7f54b3;
    border-radius: 50%;
    animation: hpw-spin 0.8s linear infinite;
}

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

/* Make the entire card clickable with pointer cursor */
.hpw-service-card {
    cursor: pointer;
}

/* But keep interactive elements with default cursor */
.hpw-service-card .hpw-service-checkbox,
.hpw-service-card select,
.hpw-service-card input,
.hpw-service-card textarea,
.hpw-service-card button,
.hpw-service-card .hpw-service-toggle {
    cursor: default;
}

/* Hover effect for clickable card */
.hpw-service-card:not(.selected):hover {
    border-color: #7f54b3;
    background: #fafafa;
}

/* Selected state with hover */
.hpw-service-card.selected:hover {
    border-color: #7f54b3;
    box-shadow: 0 0 0 2px rgba(127, 84, 179, 0.2);
}
.hpw-standalone-wrapper{margin:28px 0}.hpw-standalone-service-card{margin:0}.hpw-standalone-actions{display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-top:16px}.hpw-standalone-actions input[type=number]{width:76px}.hpw-standalone-notice{margin-top:10px;font-size:14px}.hpw-standalone-notice.success{color:#157347}.hpw-standalone-notice.error{color:#b42318}.hpw-standalone-service-card .hpw-service-addons-container{margin-top:14px}

/* Standalone cart/checkout services: preserve product-page card interaction */
.hpw-standalone-wrapper .hpw-standalone-service-card { margin: 0; }
.hpw-standalone-wrapper .hpw-service-body[hidden] { display: none !important; }
.hpw-standalone-wrapper .hpw-service-body { width: 100%; margin-top: 12px; }
.hpw-standalone-wrapper .hpw-standalone-actions { display:flex; align-items:flex-end; gap:12px; flex-wrap:wrap; margin-top:16px; }
.hpw-standalone-wrapper .hpw-standalone-quantity-label { display:flex; flex-direction:column; gap:5px; }
.hpw-standalone-wrapper .hpw-standalone-qty { width:84px; }
.hpw-standalone-wrapper .hpw-add-service-button { margin:0; }
.hpw-standalone-wrapper .hpw-standalone-notice.success { color:#167a3f; margin-top:10px; }
.hpw-standalone-wrapper .hpw-standalone-notice.error { color:#b42318; margin-top:10px; }

/* ===== HPW 2026-07 cart/checkout interaction consistency fix ===== */
.hpw-standalone-wrapper .hpw-service-grid { gap: 16px; }
.hpw-standalone-wrapper .hpw-standalone-service-card {
    display: block;
    width: 100%;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: none;
    overflow: hidden;
    transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}
.hpw-standalone-wrapper .hpw-standalone-service-card:hover {
    border-color: #ccc;
    background: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.hpw-standalone-wrapper .hpw-standalone-service-card.selected,
.hpw-standalone-wrapper .hpw-standalone-service-card.is-expanded {
    border-color: #7f54b3;
    background: #fff;
    box-shadow: 0 0 0 2px rgba(127,84,179,.15);
}
.hpw-standalone-wrapper .hpw-standalone-service-card .hpw-service-card-inner { width:100%; box-sizing:border-box; }
.hpw-standalone-wrapper .hpw-service-body { cursor: default; }
.hpw-standalone-wrapper .hpw-service-body[hidden] { display:none !important; }
.hpw-standalone-wrapper .hpw-service-body:not([hidden]) { display:block !important; }

/* Standalone cart/checkout cards: identical base and selected appearance. */
.hpw-standalone-service-card{display:block;width:100%;margin:0;border:1px solid #e1e1e1;border-radius:10px;background:#fff;box-shadow:none;transition:border-color .2s ease,box-shadow .2s ease}
.hpw-standalone-service-card:hover{border-color:#d4d4d4;box-shadow:0 6px 18px rgba(0,0,0,.06)}
.hpw-standalone-service-card.selected,.hpw-standalone-service-card.is-expanded{border-color:#7c5ce7;box-shadow:0 8px 22px rgba(80,55,170,.12)}
body.hpw-flyout-open{overflow:hidden!important}
.hpw-standalone-wrapper .hpw-add-service-button.button.alt{background:var(--wp--preset--color--primary,#1473a8)!important;background-color:var(--wp--preset--color--primary,#1473a8)!important;color:#fff!important;border-color:transparent!important}
.hpw-standalone-wrapper .hpw-add-service-button.button.alt:hover{filter:brightness(.92)}

/* ===== HPW v2.0.8 modern theme-aligned card design ===== */
.hpw-service-wrapper {
    --hpw-accent: #0d69a0;
    --hpw-accent-soft: rgba(13, 105, 160, .12);
    box-sizing: border-box;
    margin: 2em 0;
    padding: 1.35em;
    background: #fff;
    border: 0;
    border-radius: 18px;
    box-shadow: 0 10px 34px rgba(15, 34, 48, .09);
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.hpw-service-wrapper *,
.hpw-service-wrapper *::before,
.hpw-service-wrapper *::after {
    box-sizing: border-box;
}

.hpw-service-wrapper button,
.hpw-service-wrapper input,
.hpw-service-wrapper select,
.hpw-service-wrapper textarea {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.hpw-service-wrapper .hpw-service-title,
.hpw-service-wrapper .hpw-service-name,
.hpw-service-wrapper .hpw-addon-section-title {
    color: inherit;
    font-family: inherit;
}

.hpw-service-wrapper .hpw-service-description,
.hpw-service-wrapper .hpw-addon-section-description {
    color: inherit;
    opacity: .76;
}

.hpw-service-wrapper .hpw-service-grid {
    gap: 1em;
}

.hpw-service-wrapper .hpw-service-card,
.hpw-service-wrapper .hpw-standalone-service-card {
    background: #fff;
    border: 1px solid rgba(13, 105, 160, .24);
    border-radius: 14px;
    box-shadow: 0 3px 12px rgba(15, 34, 48, .055);
    overflow: hidden;
    transform: translateY(0);
    transition: border-color .22s ease, box-shadow .22s ease, transform .22s ease;
}

.hpw-service-wrapper .hpw-service-card:not(.selected):hover,
.hpw-service-wrapper .hpw-standalone-service-card:hover {
    background: #fff;
    border-color: rgba(13, 105, 160, .55);
    box-shadow: 0 8px 22px rgba(15, 34, 48, .09);
    transform: translateY(-1px);
}

.hpw-service-wrapper .hpw-service-card.selected,
.hpw-service-wrapper .hpw-service-card.selected:hover,
.hpw-service-wrapper .hpw-standalone-service-card.selected,
.hpw-service-wrapper .hpw-standalone-service-card.is-expanded {
    background: #fff;
    border-color: var(--hpw-accent);
    box-shadow: 0 0 0 2px var(--hpw-accent-soft), 0 8px 24px rgba(13, 105, 160, .11);
}

.hpw-service-wrapper .hpw-service-card-inner {
    padding: 14px;
    gap: 14px;
}

.hpw-service-wrapper .hpw-service-checkbox,
.hpw-service-wrapper .hpw-addon-field input[type="checkbox"],
.hpw-service-wrapper .hpw-addon-field input[type="radio"] {
    accent-color: var(--hpw-accent) !important;
}

.hpw-service-wrapper .hpw-service-checkbox:focus-visible,
.hpw-service-wrapper .hpw-addon-field input[type="checkbox"]:focus-visible,
.hpw-service-wrapper .hpw-addon-field input[type="radio"]:focus-visible {
    outline: 3px solid var(--hpw-accent-soft);
    outline-offset: 3px;
}

.hpw-service-wrapper .hpw-service-image {
    background: transparent;
    border: 0;
    border-radius: 10px;
}

.hpw-service-wrapper .hpw-service-price {
    color: var(--hpw-accent);
}

.hpw-service-wrapper .hpw-service-addons-loading::after {
    border-top-color: var(--hpw-accent);
}

/* Attribute groups stay open; only their actual form controls keep a boundary. */
.hpw-service-wrapper .hpw-service-body.open {
    border-top: 0;
}

.hpw-service-wrapper .hpw-addon-fields {
    gap: 14px;
}

.hpw-service-wrapper .hpw-addon-item {
    padding: 0 0 12px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.hpw-service-wrapper .hpw-addon-item:last-child {
    padding-bottom: 0;
}

.hpw-service-wrapper .hpw-addon-field input[type="text"],
.hpw-service-wrapper .hpw-addon-field input[type="number"],
.hpw-service-wrapper .hpw-addon-field input[type="email"],
.hpw-service-wrapper .hpw-addon-field input[type="tel"],
.hpw-service-wrapper .hpw-addon-field input[type="url"],
.hpw-service-wrapper .hpw-addon-field select,
.hpw-service-wrapper .hpw-addon-field textarea,
.hpw-service-wrapper .hpw-standalone-qty {
    background: #fff;
    border: 1px solid rgba(13, 105, 160, .28);
    border-radius: 8px;
}

.hpw-service-wrapper .hpw-addon-field input:focus,
.hpw-service-wrapper .hpw-addon-field select:focus,
.hpw-service-wrapper .hpw-addon-field textarea:focus,
.hpw-service-wrapper .hpw-standalone-qty:focus {
    border-color: var(--hpw-accent);
    outline: none;
    box-shadow: 0 0 0 3px var(--hpw-accent-soft);
}

.hpw-service-wrapper .hpw-standalone-notice {
    font-size: .9em;
}

.hpw-service-wrapper .hpw-add-service-button.button.alt {
    background: var(--hpw-accent) !important;
    background-color: var(--hpw-accent) !important;
    border-color: var(--hpw-accent) !important;
    border-radius: 9px;
    font-family: inherit;
}

@media (max-width: 768px) {
    .hpw-service-wrapper {
        padding: 1em;
        border-radius: 14px;
    }

    .hpw-service-wrapper .hpw-service-card-inner {
        padding: 12px;
        gap: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hpw-service-wrapper .hpw-service-card,
    .hpw-service-wrapper .hpw-standalone-service-card {
        transition: none;
    }
}
