/* ===== MAIN CONTAINER ===== */
.bcg-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 40px 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    font-family: 'Montserrat', sans-serif;
}

.bcg-title {
    text-align: center;
    color: white;
    font-size: 3rem;
    margin-bottom: 40px;
    font-family: 'Playfair Display', serif;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.bcg-grid {
    display: grid;
    grid-template-columns: 450px 1fr;
    gap: 30px;
    background: white;
    border-radius: 20px;
    padding: 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

/* ===== CONTROLS PANEL ===== */
.bcg-controls {
    background: #f7fafc;
    padding: 30px;
    border-radius: 15px;
    max-height: 90vh;
    overflow-y: auto;
}

.bcg-controls::-webkit-scrollbar {
    width: 8px;
}

.bcg-controls::-webkit-scrollbar-track {
    background: #e2e8f0;
    border-radius: 4px;
}

.bcg-controls::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 4px;
}

/* ===== ELEGANT SECTION HEADERS ===== */
.bcg-section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    margin: 30px 0 20px 0;
    border-radius: 12px;
    font-weight: 600;
    font-size: 1.05rem;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    transition: all 0.3s ease;
    cursor: pointer;
}

.bcg-section-header:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.12);
}

.bcg-section-icon {
    font-size: 1.4rem;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.bcg-section-label {
    flex: 1;
}

.bcg-section-hint {
    font-size: 0.85rem;
    font-weight: 400;
    opacity: 0.85;
    font-style: italic;
}

/* Section Color Themes */
.bcg-section-basic {
    background: linear-gradient(135deg, #4299e1 0%, #667eea 100%);
    color: white;
    border-left: 5px solid #2b6cb0;
}

.bcg-section-style {
    background: linear-gradient(135deg, #9f7aea 0%, #b794f6 100%);
    color: white;
    border-left: 5px solid #805ad5;
}

.bcg-section-typography {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: white;
    border-left: 5px solid #dd6b20;
}

.bcg-section-title {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-left: 5px solid #4c51bf;
}

.bcg-section-subheading {
    background: linear-gradient(135deg, #4fd3c5 0%, #38b2ac 100%);
    color: white;
    border-left: 5px solid #2c7a7b;
}

.bcg-section-author {
    background: linear-gradient(135deg, #f687b3 0%, #ed64a6 100%);
    color: white;
    border-left: 5px solid #d53f8c;
}

.bcg-section-badge {
    background: linear-gradient(135deg, #f6ad55 0%, #ed8936 100%);
    color: white;
    border-left: 5px solid #dd6b20;
}

/* Collapsed state */
.bcg-section-header.collapsed::after {
    content: '▼';
    font-size: 0.8rem;
}

/* ===== FORM GROUPS ===== */
.bcg-form-group {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 15px;
    border: 2px solid #f0f0f0;
    transition: all 0.3s ease;
}

.bcg-form-group:hover {
    border-color: #cbd5e0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.bcg-form-group:focus-within {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transform: scale(1.01);
}

.bcg-form-group.active-control {
    border-color: #667eea;
    background: #f7fafc;
    transform: scale(1.02);
}

.bcg-form-group label {
    display: block;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 10px;
    font-size: 0.95rem;
}

.bcg-form-group input[type="text"],
.bcg-form-group input[type="number"],
.bcg-form-group select {
    width: 100%;
    padding: 14px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    box-sizing: border-box;
    transition: all 0.3s;
}

.bcg-form-group input[type="text"]:focus,
.bcg-form-group input[type="number"]:focus,
.bcg-form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* ===== FIX SELECT DROPDOWNS ===== */
.bcg-form-group select {
    width: 100%;
    padding: 14px 45px 14px 16px !important;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 500;
    color: #2d3748;
    background-color: white;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23667eea' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 12px;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    line-height: 1.5 !important;
    height: auto !important;
    min-height: 50px;
    transition: all 0.3s;
    display: block;
}

.bcg-form-group select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.bcg-form-group select option {
    padding: 12px 16px;
    font-size: 1rem;
    color: #2d3748;
    background: white;
    line-height: 1.5;
}

.bcg-form-group select::-ms-value {
    background-color: white;
    color: #2d3748;
}

/* Ensure all form inputs have proper box-sizing */
.bcg-form-group *,
.bcg-form-group *::before,
.bcg-form-group *::after {
    box-sizing: border-box;
}

/* ===== BADGES ===== */
.bcg-badge-required {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #fed7d7;
    color: #c53030;
    margin-left: 8px;
}

.bcg-badge-optional {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    background: #e2e8f0;
    color: #4a5568;
    margin-left: 8px;
}

/* ===== COLOR PICKER ===== */
.bcg-color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 15px;
}

.bcg-color-picker-wrapper input[type="color"] {
    width: 60px;
    height: 45px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    cursor: pointer;
}

.bcg-color-value {
    font-family: monospace;
    font-weight: 600;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 6px;
    background: #f7fafc;
}

/* ===== RANGE SLIDERS ===== */
.bcg-form-group input[type="range"] {
    width: 100%;
    margin-top: 10px;
    -webkit-appearance: none;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
}

.bcg-form-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.4);
}

/* ===== STYLE GRID ===== */
.bcg-style-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.bcg-style-option {
    padding: 15px;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    text-align: center;
    cursor: pointer;
    font-weight: 600;
    background: white;
    transition: all 0.3s;
}

.bcg-style-option:hover {
    border-color: #667eea;
    transform: translateY(-2px);
}

.bcg-style-option.active {
    border-color: #667eea;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

/* ===== BUTTONS ===== */
.bcg-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.3s;
}

.bcg-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.bcg-btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.bcg-btn-secondary {
    background: #48bb78;
    color: white;
}

.bcg-btn-secondary:hover {
    background: #38a169;
    transform: translateY(-3px);
    box-shadow: 0 10px 25px rgba(72, 187, 120, 0.4);
}

/* ===== ERROR MESSAGE ===== */
.bcg-error {
    background: #fed7d7;
    color: #c53030;
    padding: 15px;
    border-radius: 8px;
    margin-top: 15px;
    display: none;
    border-left: 4px solid #c53030;
}

.bcg-error.active {
    display: block;
    animation: shake 0.5s;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* ===== PREVIEW PANEL ===== */
.bcg-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.bcg-canvas-wrapper {
    position: relative;
    box-shadow: 0 15px 50px rgba(0,0,0,0.2);
    border-radius: 10px;
    overflow: hidden;
    max-width: 100%;
}

#bcg-canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

.bcg-loading {
    display: none;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 40px 60px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.bcg-loading.active {
    display: block;
}

.bcg-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #e2e8f0;
    border-top-color: #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== IMAGE SELECTOR ===== */
.bcg-image-selector {
    margin-top: 30px;
    width: 100%;
    background: white;
    padding: 20px;
    border-radius: 15px;
    border: 2px solid #e2e8f0;
}

.bcg-thumbnails {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-height: 650px;
    overflow-y: scroll !important;
    overflow-x: hidden;
    padding: 10px;
    box-sizing: border-box;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
}

.bcg-thumbnails::-webkit-scrollbar {
    width: 14px !important;
    display: block !important;
}

.bcg-thumbnails::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 7px;
}

.bcg-thumbnails::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 7px;
    border: 2px solid #f1f1f1;
    min-height: 100px;
}

.bcg-thumbnail {
    cursor: pointer;
    border-radius: 8px;
    overflow: hidden;
    border: 3px solid transparent;
    transition: all 0.2s;
    aspect-ratio: 2/3;
    background: #e2e8f0;
}

.bcg-thumbnail:hover {
    transform: scale(1.03);
    border-color: #667eea;
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.bcg-thumbnail.active {
    border-color: #48bb78;
    box-shadow: 0 0 0 3px rgba(72, 187, 120, 0.3);
}

.bcg-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .bcg-grid {
        grid-template-columns: 1fr;
    }
    
    .bcg-title {
        font-size: 2rem;
    }
    
    .bcg-thumbnails {
        grid-template-columns: repeat(4, 1fr);
        max-height: 500px;
    }
}

@media (max-width: 768px) {
    .bcg-section-header {
        flex-direction: column;
        text-align: center;
        gap: 8px;
        padding: 14px;
    }
    
    .bcg-section-hint {
        font-size: 0.8rem;
    }
    
    .bcg-thumbnails {
        grid-template-columns: repeat(3, 1fr);
        max-height: 400px;
    }
    
    .bcg-style-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .bcg-thumbnails {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ===== DIVIDERS ===== */
.bcg-controls hr {
    border: none;
    border-top: 2px solid #e2e8f0;
    margin: 25px 0;
}

.bcg-controls h3 {
    color: #2d3748;
    font-size: 1.1rem;
    margin-bottom: 20px;
    font-weight: 600;
}