/**
 * Forankra Strap Configurator - Frontend Styles
 */

:root {
    --strap-primary: #164091;
    --strap-primary-hover: #67AAE1;
    --strap-primary-light: rgba(27, 54, 93, 0.08);
    --strap-accent: #F7941D;
    --strap-dark: #333333;
    --strap-light: #f5f5f5;
    --strap-border: #dddddd;
    --strap-success: #28a745;
    --strap-error: #dc3545;
}

/* Main Container */
.strap-configurator {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background-color: #EAEAEA;
    border-radius: 8px;
}

.strap-configurator * {
    box-sizing: border-box;
}

/* Page Title */
.strap-configurator-title {
    display: block;
    text-align: center;
    font-size: 28px;
    font-weight: 700;
    color: var(--strap-primary);
    margin: 0 0 30px 0;
}

/* Two Column Layout */
.strap-configurator-layout {
    display: grid;
    grid-template-columns: 55fr 45fr;
    gap: 30px;
}

@media (max-width: 992px) {
    .strap-configurator-layout {
        grid-template-columns: 1fr;
    }

    .strap-visualization {
        order: -1;
    }
}

/* Accordion Column */
.strap-accordion {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

/* Accordion Items */
.strap-accordion-item {
    border-bottom: 1px solid var(--strap-border);
}
.strap-accordion-item:last-of-type {
    border-bottom: none;
}

.strap-accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 30px;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s ease;
    background-color: #164091;
}
.strap-accordion-header:hover {
    background-color: #1b4fa8;
}

/* Active step - expanded */
.strap-accordion-item.active .strap-accordion-header {
    background-color: #69a9dd;
    border-left: 3px solid var(--strap-primary);
}

.strap-accordion-header-title {
    font-size: 16px;
    font-weight: 600;
    color: #ffffff;
}

/* Checkmark round green */
.strap-accordion-header-status .checkmark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-color: var(--strap-success);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
}

.strap-accordion-header-status .checkmark.checkmark-pending {
    background-color: #c4c4c4;
    color: #fff;
}

/* Accordion body */
.strap-accordion-body {
    display: none;
    padding: 0 30px 25px 30px;
}
.strap-accordion-item.active .strap-accordion-body {
    display: block;
}

/* Future steps not accessible */
.strap-accordion-item:not(.active):not(.completed):not(.accessible) .strap-accordion-header {
    cursor: default;
}
.strap-accordion-item.completed .strap-accordion-header {
    cursor: pointer;
}

/* Accessible (frontier) step - next step that can be reached */
.strap-accordion-item.accessible .strap-accordion-header {
    opacity: 1;
    cursor: pointer;
}
.strap-accordion-item.accessible .strap-accordion-header-title {
    color: #ffffff;
}

/* Step Description */
.strap-step-description {
    color: #666;
    margin-bottom: 25px;
    line-height: 1.5;
}

/* Options Grid */
.strap-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
}

.strap-option {
    border: 2px solid var(--strap-border);
    border-radius: 8px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #fff;
}

.strap-option:hover {
    border-color: var(--strap-primary);
    box-shadow: 0 2px 8px rgba(27, 54, 93, 0.1);
}

.strap-option.selected {
    border-color: var(--strap-primary);
    background: rgba(27, 54, 93, 0.05);
}

.strap-option-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.strap-option-icon svg {
    max-width: 100%;
    max-height: 100%;
}

.strap-option-name {
    font-weight: 600;
    color: var(--strap-dark);
    margin-bottom: 5px;
}

.strap-option-code {
    font-size: 12px;
    color: #999;
}

.strap-option-size {
    font-size: 12px;
    color: #666;
    margin-top: 2px;
}

.strap-color-note {
    font-size: 12px;
    font-style: italic;
    color: #888;
    margin-top: 10px;
}

/* Color Options */
.strap-color-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.strap-color-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.strap-color-option:hover {
    transform: scale(1.1);
}

.strap-color-option.selected {
    border-color: var(--strap-dark);
}

.strap-color-option.selected::after {
    content: '\2713';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 20px;
    text-shadow: 0 0 3px rgba(0,0,0,0.5);
}

.strap-color-name {
    display: none;
    position: absolute;
    bottom: -25px;
    left: 50%;
    transform: translateX(-50%);
    white-space: nowrap;
    font-size: 12px;
    background: var(--strap-dark);
    color: #fff;
    padding: 2px 8px;
    border-radius: 4px;
}

.strap-color-option:hover .strap-color-name {
    display: block;
}

/* Input Fields */
.strap-input-group {
    margin-bottom: 20px;
}

.strap-input-label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--strap-dark);
}

.strap-input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid var(--strap-border);
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.2s ease;
}

.strap-input:focus {
    outline: none;
    border-color: var(--strap-primary);
}

.strap-input-hint {
    font-size: 13px;
    color: #888;
    margin-top: 5px;
}

/* Checkbox / Marking - Custom visual checkbox */
.strap-checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 0;
    padding: 15px;
    background: var(--strap-light);
    border-radius: 8px;
    margin-bottom: 20px;
}

/* Hide native input accessibly (sr-only pattern) */
.strap-checkbox {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Label becomes grid container: visual checkbox + text */
.strap-checkbox-label {
    display: grid;
    grid-template-columns: 24px 1fr;
    gap: 2px 12px;
    cursor: pointer;
    flex: 1;
}

/* Visual checkbox indicator via ::before */
.strap-checkbox-label::before {
    content: '';
    grid-row: 1 / -1;
    grid-column: 1;
    width: 20px;
    height: 20px;
    border: 2px solid var(--strap-border);
    border-radius: 4px;
    background: #fff;
    transition: background-color 0.2s ease, border-color 0.2s ease;
    margin-top: 2px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Checked state */
.strap-checkbox:checked + .strap-checkbox-label::before {
    background-color: var(--strap-primary);
    border-color: var(--strap-primary);
    content: '\2713';
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Focus state (keyboard accessibility) */
.strap-checkbox:focus-visible + .strap-checkbox-label::before {
    outline: 2px solid var(--strap-primary);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(27, 54, 93, 0.25);
}

/* Hover */
.strap-checkbox-label:hover::before {
    border-color: var(--strap-primary);
}

/* Disabled state (for marking when threshold not met) */
.strap-checkbox:disabled + .strap-checkbox-label {
    opacity: 0.5;
    cursor: not-allowed;
}

.strap-checkbox:disabled + .strap-checkbox-label::before {
    background-color: var(--strap-light);
    border-color: var(--strap-border);
}

.strap-checkbox-title {
    grid-column: 2;
    font-weight: 600;
    color: var(--strap-dark);
    margin-bottom: 0;
    line-height: 1.4;
}

.strap-checkbox-description {
    grid-column: 2;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.strap-marking-input {
    margin-top: 15px;
    display: none;
}

.strap-marking-input.visible {
    display: block;
}

/* Navigation Buttons */
.strap-navigation {
    display: flex;
    justify-content: space-between;
    padding: 20px 30px;
    background: var(--strap-light);
    border-top: 1px solid var(--strap-border);
}

.strap-btn {
    padding: 12px 30px;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.strap-btn-back {
    background: #fff;
    border: 2px solid var(--strap-primary);
    color: var(--strap-primary);
}

.strap-btn-back:hover {
    background: var(--strap-primary-light);
}

.strap-btn-next {
    background: var(--strap-primary);
    color: #fff;
}

.strap-btn-next:hover {
    background: var(--strap-primary-hover);
}

.strap-navigation-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.strap-btn-restart {
    display: none;
    background: #fff;
    border: 2px solid var(--strap-danger, #dc3545);
    color: var(--strap-danger, #dc3545);
    padding: 12px 24px;
}

.strap-btn-restart:hover {
    background: var(--strap-danger, #dc3545);
    color: #fff;
}

.strap-btn-restart.visible {
    display: inline-block;
}

.strap-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Visualization Column */
.strap-visualization {
    position: sticky;
    top: 20px;
}

.strap-viz-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--strap-dark);
    margin: 0 0 15px 0;
    padding: 15px 30px;
}

.strap-visualization-block {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.strap-svg-container {
    padding: 30px;
}

.strap-svg-wrapper {
    width: 100%;
    aspect-ratio: 4 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.strap-svg-wrapper svg {
    width: 100%;
    height: auto;
    max-height: 200px;
}

/* Summary Panel */
.strap-summary {
    padding: 25px;
}

.strap-summary-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--strap-dark);
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--strap-light);
}

.strap-summary-item {
    display: flex;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--strap-light);
}

.strap-summary-label {
    color: #666;
}

.strap-summary-value {
    font-weight: 600;
    color: var(--strap-dark);
}

/* Action Buttons (right column) */
.strap-actions {
    display: flex;
    gap: 15px;
    padding: 15px 25px 25px;
    justify-content: space-between;
}

.strap-btn-save-config:disabled,
.strap-btn-ask-quote:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.strap-btn-save-config {
    padding: 10px 20px;
    border: 2px solid var(--strap-primary);
    background: #fff;
    color: var(--strap-primary);
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.strap-btn-save-config:hover {
    background: var(--strap-primary-light);
}

.strap-btn-ask-quote {
    padding: 10px 20px;
    border: 2px solid var(--strap-primary);
    background: var(--strap-primary);
    color: #fff;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}
.strap-btn-ask-quote:hover {
    background: var(--strap-primary-hover);
    border-color: var(--strap-primary-hover);
}

/* Modal */
.strap-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.strap-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.strap-modal {
    background: #fff;
    border-radius: 12px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: translateY(-20px);
    transition: transform 0.3s ease;
}

.strap-modal-overlay.visible .strap-modal {
    transform: translateY(0);
}

.strap-modal-header {
    padding: 25px 25px 0;
}

.strap-modal-title {
    font-size: 22px;
    font-weight: 600;
    color: var(--strap-dark);
    margin: 0;
}

.strap-modal-body {
    padding: 25px;
}

.strap-modal-footer {
    padding: 0 25px 25px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.strap-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
}

/* Form in Modal */
.strap-form-group {
    margin-bottom: 20px;
}

.strap-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

@media (max-width: 500px) {
    .strap-form-row {
        grid-template-columns: 1fr;
    }
}

/* Alerts */
.strap-alert {
    padding: 15px 20px;
    border-radius: 6px;
    margin-top: 15px;
    margin-bottom: 20px;
}

.strap-alert-success {
    background: rgba(40, 167, 69, 0.1);
    color: var(--strap-success);
    border: 1px solid var(--strap-success);
}

.strap-alert-error {
    background: rgba(220, 53, 69, 0.1);
    color: var(--strap-error);
    border: 1px solid var(--strap-error);
}

/* Loading Spinner */
.strap-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.strap-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid var(--strap-light);
    border-top-color: var(--strap-primary);
    border-radius: 50%;
    animation: strap-spin 1s linear infinite;
}

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

/* Quantity Selector */
.strap-quantity-selector {
    display: flex;
    align-items: center;
    gap: 15px;
}

.strap-quantity-btn {
    width: 40px;
    height: 40px;
    border: 2px solid var(--strap-border);
    border-radius: 6px;
    background: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.strap-quantity-btn:hover {
    border-color: var(--strap-primary);
    color: var(--strap-primary);
}

.strap-quantity-input {
    width: 80px;
    text-align: center;
    font-size: 18px;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .strap-configurator {
        padding: 10px;
    }

    .strap-accordion-header {
        padding: 15px 20px;
    }

    .strap-accordion-body {
        padding: 0 20px 20px 20px;
    }

    .strap-options {
        grid-template-columns: repeat(2, 1fr);
    }

    .strap-actions {
        flex-direction: column;
    }
}

/* Login modal */
.strap-login-message {
    color: #555;
    font-size: 14px;
    line-height: 1.6;
    margin-bottom: 20px;
}

.strap-login-separator {
    text-align: center;
    margin: 20px 0 15px;
    position: relative;
}

.strap-login-separator::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--strap-border);
}

.strap-login-separator span {
    background: #fff;
    padding: 0 15px;
    position: relative;
    color: #888;
    font-size: 13px;
}

.strap-login-register {
    text-align: center;
}

.strap-btn-register {
    display: inline-block;
    padding: 10px 24px;
    border: 2px solid var(--strap-primary);
    background: #fff;
    color: var(--strap-primary);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
}

.strap-btn-register:hover {
    background: var(--strap-primary-light);
}

/* Reference completion — green checkmark only */
.strap-summary-item-reference.complete .strap-summary-label {
    display: flex;
    align-items: center;
    gap: 8px;
}

.strap-summary-item-reference.complete .strap-summary-label::after {
    content: '\2713';
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background-color: var(--strap-success);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    flex-shrink: 0;
}
