/**
 * iCompose Server Configurator - Frontend CSS
 */

/* Main Container */
.icompose-configurator {
    margin: 10px auto;
}

.icompose-configurator__title {
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #333;
}

.icompose-configurator__wrapper {
    display: grid;
    grid-template-columns: 1fr 350px;
    gap: 30px;
    align-items: start;
}

.icompose-configurator__sidebar {
    position: sticky;
    top: 100px;
}

@media (max-width: 991px) {
    .icompose-configurator__wrapper {
        grid-template-columns: 1fr;
    }
}

/* Sections */
.icompose-section {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    margin-bottom: 15px;
}

.icompose-section__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    cursor: pointer;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
}

.icompose-section__header:hover {
    background: #f0f1f2;
}

.icompose-section__title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #333;
}

.icompose-section__toggle {
    transition: transform 0.2s;
}

.icompose-section__toggle--open {
    transform: rotate(180deg);
}

.icompose-section__content {
    padding: 0;
}

/* Product Rows */
.icompose-product {
    display: grid;
    grid-template-columns: 40px 1fr auto auto;
    align-items: center;
    gap: 15px;
    padding: 12px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.icompose-product:last-child {
    border-bottom: none;
}

.icompose-product:hover {
    background: #fafbfc;
}

.icompose-product__select {
    display: flex;
    align-items: center;
    justify-content: center;
}

.icompose-product__checkbox {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ccc;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
}

.icompose-product__radio:checked+.icompose-product__checkbox,
.icompose-product__checkbox-input:checked+.icompose-product__checkbox {
    background: #0a71b4;
    border-color: #0a71b4;
}

.icompose-product__radio:checked+.icompose-product__checkbox::after,
.icompose-product__checkbox-input:checked+.icompose-product__checkbox::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 12px;
    font-weight: bold;
}

.icompose-product__radio,
.icompose-product__checkbox-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.icompose-product__info {
    flex: 1;
}

.icompose-product__name {
    color: #0a71b4;
    font-size: 14px;
}

.icompose-product__quantity {
    display: flex;
    align-items: center;
    gap: 5px;
}

.icompose-product__qty-input {
    width: 50px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
    text-align: center;
    font-size: 14px;
}

.icompose-product__qty-input:disabled {
    background: #f5f5f5;
    color: #999;
}

.icompose-product__qty-label {
    color: #666;
    font-size: 12px;
}

.icompose-product__price {
    text-align: right;
}

.icompose-product__price-value {
    font-weight: 600;
    color: #0a71b4;
}

.icompose-product__price-type {
    font-size: 12px;
    color: #999;
    margin-left: 4px;
}

/* Summary Sidebar */
.icompose-summary {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 20px;
    position: sticky;
    top: 20px;
}

.icompose-summary__title {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 20px 0;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
    color: #333;
}

.icompose-summary__items {
    margin-bottom: 20px;
    max-height: 300px;
    overflow-y: auto;
}

.icompose-summary__item {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 0;
    border-bottom: 1px solid #f0f0f0;
    font-size: 13px;
}

.icompose-summary__item:last-child {
    border-bottom: none;
}

.icompose-summary__item-name {
    font-weight: 600;
    color: #333;
}

.icompose-summary__item-value {
    color: #666;
    text-align: right;
}

.icompose-summary__empty {
    color: #999;
    font-style: italic;
    text-align: center;
    padding: 20px 0;
}

/* Totals */
.icompose-summary__totals {
    padding: 15px 0;
    border-top: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 20px;
}

.icompose-summary__row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    font-size: 14px;
}

.icompose-summary__row--total {
    font-weight: 600;
    font-size: 16px;
    color: #333;
}

.icompose-summary__label {
    color: #666;
}

.icompose-summary__value {
    color: #0a71b4;
    font-weight: 600;
}

/* Action Buttons */
.icompose-summary__actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.icompose-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.icompose-btn svg {
    width: 16px;
    height: 16px;
}

.icompose-btn--primary {
    background: #0a71b4;
    color: #fff;
}

.icompose-btn--secondary {
    background: #ff9800;
    color: #fff;
}

.icompose-btn--secondary:hover {
    background: #f57c00;
}

.icompose-btn--outline {
    background: transparent;
    color: #666;
    border: 1px solid #ddd;
}

.icompose-btn--outline:hover {
    background: #f5f5f5;
    border-color: #ccc;
}

/* Loading & Error States */
.icompose-loading {
    text-align: center;
    padding: 40px;
    color: #666;
}

.icompose-loading .spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid #ddd;
    border-top-color: #0a71b4;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 10px;
}

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

.icompose-error {
    color: #d32f2f;
    text-align: center;
    padding: 20px;
}

.icompose-placeholder {
    text-align: center;
    padding: 40px;
    color: #999;
}