/* KD Fastener Calculator */
.kdfc-shell {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 24px;
    box-sizing: border-box;
}

.kdfc-shell--loading,
.kdfc-shell--error {
    min-height: 180px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.kdfc-loader {
    text-align: center;
    font-size: 16px;
    color: #666666;
}

.kdfc-header {
    margin-bottom: 24px;
}

.kdfc-title {
    margin: 0 0 6px;
    font-size: 26px;
    line-height: 1.2;
    color: #2c5f2d;
    font-weight: 700;
}

.kdfc-subtitle {
    color: #666666;
    font-size: 14px;
}

.kdfc-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.kdfc-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kdfc-label {
    font-size: 14px;
    font-weight: 600;
    color: #333333;
}

.kdfc-input-wrap {
    position: relative;
}

.kdfc-input {
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 14px 56px 14px 16px;
    font-size: 16px;
    line-height: 1.3;
    background: #ffffff;
    color: #333333;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

select.kdfc-input {
    padding-right: 16px;
}

.kdfc-input:focus {
    outline: none;
    border-color: #2c5f2d;
    box-shadow: 0 0 0 3px rgba(44, 95, 45, 0.12);
}


.kdfc-readonly {
    width: 100%;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 14px 16px;
    font-size: 16px;
    line-height: 1.3;
    background: #f8f9fa;
    color: #333333;
    box-sizing: border-box;
}

.kdfc-input-wrap.has-error .kdfc-input {
    border-color: #dc3545;
}

.kdfc-suffix {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: #666666;
    font-size: 14px;
    pointer-events: none;
}

.kdfc-hint {
    font-size: 12px;
    color: #666666;
    min-height: 16px;
}

.kdfc-hint--error {
    color: #dc3545;
}

.kdfc-actions {
    margin-top: 20px;
}

.kdfc-inline-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
}

.kdfc-button {
    border: none;
    border-radius: 8px;
    padding: 14px 24px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.kdfc-button:disabled {
    cursor: not-allowed;
    opacity: 0.6;
    transform: none;
}

.kdfc-button--primary {
    background: #2c5f2d;
    color: #ffffff;
}

.kdfc-button--primary:hover:not(:disabled) {
    box-shadow: 0 8px 16px rgba(44, 95, 45, 0.2);
    transform: translateY(-1px);
}

.kdfc-button--secondary {
    background: transparent;
    color: #2c5f2d;
    border: 2px solid #2c5f2d;
}

.kdfc-message {
    border-radius: 10px;
    padding: 14px 16px;
    margin: 18px 0;
}

.kdfc-message--warning {
    background: #fff8e6;
    border: 1px solid #ffd78f;
    color: #664d03;
}

.kdfc-message--error {
    background: #fff5f5;
    border: 1px solid #f1b0b7;
    color: #842029;
}

.kdfc-message__title {
    font-weight: 700;
    margin-bottom: 6px;
}

.kdfc-message__text {
    font-size: 14px;
    line-height: 1.45;
}

.kdfc-result {
    margin-top: 28px;
    border-top: 1px solid #dee2e6;
    padding-top: 24px;
}

.kdfc-result__title {
    margin: 0 0 8px;
    font-size: 20px;
    color: #333333;
}

.kdfc-result__params {
    color: #666666;
    font-size: 14px;
    margin-bottom: 18px;
}

.kdfc-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}

.kdfc-card {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 18px;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 18px;
    background: #ffffff;
}

.kdfc-card__image-wrap {
    width: 120px;
    height: 120px;
    border-radius: 10px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.kdfc-card__image {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.kdfc-card__placeholder {
    color: #999999;
    font-size: 12px;
}

.kdfc-card__title-row {
    display: flex;
    gap: 10px;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 6px;
}

.kdfc-card__title {
    margin: 0;
    font-size: 18px;
    line-height: 1.3;
    color: #333333;
}

.kdfc-card__sku {
    color: #666666;
    font-size: 13px;
    margin-bottom: 14px;
}

.kdfc-card__meta {
    display: grid;
    gap: 8px;
    font-size: 14px;
    color: #333333;
    margin-bottom: 14px;
}

.kdfc-checkbox {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #333333;
    cursor: pointer;
    margin-bottom: 14px;
}

.kdfc-checkbox input {
    width: 18px;
    height: 18px;
    accent-color: #2c5f2d;
}

.kdfc-card__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #2c5f2d;
    font-size: 14px;
    text-decoration: none;
    font-weight: 600;
}

.kdfc-summary {
    border: 1px solid #dee2e6;
    border-radius: 12px;
    padding: 18px;
    margin-top: 18px;
    background: #f8f9fa;
}

.kdfc-summary__line {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    font-size: 18px;
    color: #333333;
    margin-bottom: 8px;
}

.kdfc-summary__line strong {
    color: #2c5f2d;
}

.kdfc-summary__hint {
    font-size: 13px;
    color: #666666;
    margin-bottom: 14px;
}

.kdfc-formula-toggle {
    appearance: none;
    background: transparent;
    border: none;
    color: #2c5f2d;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    padding: 12px 0 0;
}

.kdfc-formula {
    border: 1px dashed #97bc62;
    border-radius: 12px;
    padding: 16px;
    margin-top: 12px;
    background: #fbfdf8;
}

.kdfc-formula__list {
    margin: 0;
    padding-left: 18px;
    color: #333333;
    font-size: 14px;
    line-height: 1.6;
}

.kdfc-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.kdfc-badge--danger {
    background: #f8d7da;
    color: #842029;
}

.kdfc-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    min-width: 280px;
    max-width: 380px;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15);
    padding: 16px;
    border-left: 4px solid #28a745;
    animation: kdfc-slide-in 0.25s ease-out;
}

.kdfc-toast--error {
    border-left-color: #dc3545;
}

.kdfc-toast__title {
    font-size: 15px;
    font-weight: 700;
    color: #333333;
    margin-bottom: 6px;
}

.kdfc-toast__message {
    font-size: 14px;
    color: #666666;
    margin-bottom: 12px;
}

.kdfc-toast__actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

.kdfc-toast__button,
.kdfc-toast__close {
    appearance: none;
    border: none;
    background: transparent;
    color: #2c5f2d;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.kdfc-toast.is-leaving {
    opacity: 0;
    transform: translateX(20px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.kdfc-launch {
    margin-top: 12px;
}

.kdfc-launch__button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 280px;
    background: #2c5f2d;
    color: #ffffff;
    border-radius: 8px;
    padding: 14px 20px;
    text-decoration: none;
    font-weight: 700;
}


.kdfc-launch--portal-inline {
    margin-top: 16px;
}

.kdfc-launch-portal {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    max-width: min(360px, calc(100vw - 32px));
}

.kdfc-launch-portal .kdfc-launch {
    margin-top: 0;
    padding: 0;
    box-shadow: 0 14px 32px rgba(0, 0, 0, 0.18);
    border-radius: 12px;
}

.kdfc-launch-portal .kdfc-launch__button {
    max-width: none;
}

@keyframes kdfc-slide-in {
    from {
        opacity: 0;
        transform: translateX(24px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (min-width: 768px) {
    .kdfc-grid {
        grid-template-columns: repeat(3, 1fr);
    }

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

@media (max-width: 767px) {
    .kdfc-shell {
        padding: 18px;
    }

    .kdfc-card {
        grid-template-columns: 1fr;
    }

    .kdfc-card__image-wrap {
        width: 100%;
        height: 180px;
    }

    .kdfc-button,
    .kdfc-launch__button {
        width: 100%;
    }

    .kdfc-launch-portal {
        left: 16px;
        right: 16px;
        bottom: 16px;
        max-width: none;
    }

    .kdfc-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        min-width: auto;
        max-width: none;
    }
}

.kdfc-shell--picker {
    margin-bottom: 18px;
}

.kdfc-shell--empty {
    margin-top: 0;
}

.kdfc-picker__row {
    display: grid;
    gap: 16px;
    align-items: end;
}

.kdfc-actions--picker {
    margin-top: 0;
}

@media (min-width: 768px) {
    .kdfc-picker__row {
        grid-template-columns: 1fr auto;
    }
}
