/*
 * BME Bundler - Clean Flat UI
 * Matches bmeairsoft.com Flatsome theme
 */

/* ===== Variables ===== */
:root {
    --bme-primary: #192f60;
    --bme-primary-hover: #101d3b;
    --bme-text: #333;
    --bme-text-muted: #888;
    --bme-border: #e5e5e5;
    --bme-bg-light: #f7f7f7;
    --bme-radius: 0;
    --bme-transition: all 0.2s ease;
}

/* ===== Container ===== */
.bme-bundler-container {
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 0;
    color: var(--bme-text);
    font-size: 14px;
    line-height: 1.6;
    overflow: hidden;
}

.bme-bundler-container *,
.bme-bundler-container *::before,
.bme-bundler-container *::after {
    box-sizing: border-box;
}

/* ===== Header ===== */
.bme-header {
    text-align: center;
    padding: 20px 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--bme-border);
}

.bme-header h2 {
    margin: 0 0 15px 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: var(--bme-text);
}

/* ===== Progress Steps ===== */
.bme-progress-bar {
    display: inline-flex;
    align-items: center;
    gap: 0;
}

.bme-progress-bar::before {
    display: none;
}

.bme-progress-step {
    padding: 8px 20px;
    font-size: 13px;
    font-weight: 600;
    color: var(--bme-text-muted);
    background: #fff;
    border: 1px solid var(--bme-border);
    cursor: default;
    position: relative;
}

.bme-progress-step:first-child {
    border-radius: 3px 0 0 3px;
}

.bme-progress-step:last-child {
    border-radius: 0 3px 3px 0;
}

.bme-progress-step + .bme-progress-step {
    border-left: none;
}

.bme-progress-step.active {
    background: var(--bme-primary);
    border-color: var(--bme-primary);
    color: #fff;
}

/* ===== Step Sections ===== */
.bme-step-content {
    width: 100%;
    overflow: hidden;
}

/* ===== Tabs (Platform filters / Category tabs) ===== */
.bme-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
    padding: 0;
}

.bme-tab-btn {
    display: inline-block;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    color: var(--bme-text);
    background: #fff;
    border: 1px solid var(--bme-border);
    border-radius: 3px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--bme-transition);
}

.bme-tab-btn:hover {
    background: var(--bme-bg-light);
    border-color: #ccc;
}

.bme-tab-btn.active {
    background: var(--bme-primary);
    border-color: var(--bme-primary);
    color: #fff;
}

/* ===== Search ===== */
.bme-search-bar input {
    width: 100%;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--bme-text);
    background: #fff;
    border: 1px solid var(--bme-border);
    border-radius: 3px;
    margin-bottom: 15px;
    outline: none;
    transition: var(--bme-transition);
}

.bme-search-bar input:focus {
    border-color: var(--bme-primary);
}

/* ===== Product Grid ===== */
.bme-product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 15px;
    width: 100%;
}

.bme-small-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

/* ===== Product Cards ===== */
.bme-card {
    background: #fff;
    border: 1px solid var(--bme-border);
    padding: 12px;
    cursor: pointer;
    transition: var(--bme-transition);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
}

.bme-card:hover {
    border-color: var(--bme-primary);
}

.bme-card.selected {
    border: 2px solid var(--bme-primary);
    padding: 11px;
}

.bme-card.selected::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 6px;
    background: var(--bme-primary);
    color: #fff;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.bme-card img {
    width: 100%;
    height: 100px;
    object-fit: contain;
    margin-bottom: 10px;
}

.bme-card h4 {
    margin: 0 0 6px 0;
    font-size: 12px;
    font-weight: 500;
    color: var(--bme-text);
    flex-grow: 1;
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

.bme-card .bme-price {
    color: var(--bme-primary);
    font-weight: 700;
    font-size: 14px;
    margin-top: auto;
}

.bme-card .bme-platform-tag {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--bme-bg-light);
    color: var(--bme-text-muted);
    font-size: 10px;
    padding: 1px 5px;
    border: 1px solid var(--bme-border);
    text-transform: uppercase;
}

/* ===== Layout Split (Step 2 & 3) ===== */
.bme-layout-split {
    display: flex;
    gap: 20px;
    align-items: flex-start;
    width: 100%;
    overflow: hidden;
}

.bme-accessories-panel {
    flex: 1 1 0%;
    min-width: 0;
    overflow: hidden;
}

.bme-summary-panel,
.bme-checkout-panel {
    flex: 0 0 280px;
    width: 280px;
    min-width: 0;
    position: sticky;
    top: 20px;
    border: 1px solid var(--bme-border);
    background: #fff;
    padding: 20px;
}

.bme-summary-panel h3,
.bme-checkout-panel h2 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 700;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--bme-border);
}

.bme-image-panel {
    flex: 1 1 0%;
    min-width: 0;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--bme-border);
    background: var(--bme-bg-light);
    padding: 20px;
}

/* ===== Item Lists ===== */
#bme-selected-items-list,
#bme-final-items-list {
    list-style: none;
    padding: 0;
    margin: 0 0 15px 0;
    max-height: 300px;
    overflow-y: auto;
}

#bme-selected-items-list li,
#bme-final-items-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid var(--bme-border);
    font-size: 13px;
}

#bme-selected-items-list li:last-child,
#bme-final-items-list li:last-child {
    border-bottom: none;
}

.bme-item-name {
    color: var(--bme-text);
    max-width: 65%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bme-item-price {
    color: var(--bme-primary);
    font-weight: 600;
    white-space: nowrap;
}

/* ===== Totals ===== */
.bme-total-price,
.bme-final-total {
    font-size: 16px;
    font-weight: 700;
    margin: 10px 0;
    text-align: right;
    color: var(--bme-text);
    padding-top: 10px;
    border-top: 2px solid var(--bme-text);
}

/* ===== Buttons ===== */
button {
    font-family: inherit;
    cursor: pointer;
}

.bme-btn-primary {
    display: block;
    width: 100%;
    background: var(--bme-primary);
    color: #fff;
    border: none;
    padding: 12px 20px;
    font-weight: 600;
    font-size: 14px;
    text-align: center;
    cursor: pointer;
    transition: var(--bme-transition);
}

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

.bme-btn-accent {
    display: block;
    width: 100%;
    background: var(--bme-primary);
    color: #fff;
    border: none;
    padding: 14px 20px;
    font-weight: 700;
    font-size: 15px;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: var(--bme-transition);
}

.bme-btn-accent:hover {
    background: var(--bme-primary-hover);
}

.bme-btn-back {
    display: inline-block;
    background: transparent;
    color: var(--bme-text-muted);
    border: none;
    padding: 0;
    margin-bottom: 15px;
    font-size: 13px;
    cursor: pointer;
}

.bme-btn-back:hover {
    color: var(--bme-primary);
}

.bme-full-width {
    width: 100%;
}

/* ===== Loading ===== */
.bme-loader {
    width: 30px;
    height: 30px;
    border: 3px solid var(--bme-border);
    border-top-color: var(--bme-primary);
    border-radius: 50%;
    animation: bme-spin 0.8s linear infinite;
    margin: 30px auto;
}

.bme-ai-loader {
    text-align: center;
    color: var(--bme-text-muted);
}

.bme-ai-loader .spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--bme-border);
    border-top-color: var(--bme-primary);
    border-radius: 50%;
    animation: bme-spin 0.8s linear infinite;
    margin: 0 auto 15px auto;
}

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

#bme-ai-image-result {
    max-width: 100%;
    max-height: 450px;
    animation: bme-fade-in 0.4s ease-out;
}

@keyframes bme-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ===== Glass Panel Override (remove all effects) ===== */
.glass-panel {
    background: transparent;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: none;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
}

/* When glass-panel is used with summary/checkout, the
   .bme-summary-panel / .bme-checkout-panel rules above
   already provide the correct styling */

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .bme-layout-split {
        flex-direction: column;
    }

    .bme-summary-panel,
    .bme-checkout-panel {
        flex: none;
        width: 100%;
        position: static;
    }

    .bme-image-panel {
        min-height: 200px;
    }

    .bme-product-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 10px;
    }

    .bme-tabs {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .bme-progress-step {
        padding: 6px 12px;
        font-size: 11px;
    }
}

.bme-ai-error {
    color: #c0392b;
    padding: 20px;
    text-align: center;
    border: 1px dashed #e74c3c;
    background: #fdf2e9;
    width: 100%;
    max-height: 400px;
    overflow-y: auto;
    margin: 10px 0;
}
.bme-ai-error pre {
    white-space: pre-wrap;
    font-size: 12px;
    margin-top: 10px;
    text-align: left;
    background: #fff;
    padding: 10px;
    border: 1px solid #eaeaea;
    color: #333;
    max-height: 250px;
    overflow-y: auto;
}
