/**
 * Konfigurator Shishy - Style CSS
 */

/* === Reset i zmienne === */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #4804a4;
    --accent-color: #4804a4;
    --hover-color: #f65853;
    --success-color: #27ae60;
    --border-color: #dfe6e9;
    --text-color: #2d3436;
    --text-light: #636e72;
    --bg-light: #f8f9fa;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    --shadow-hover: 0 4px 12px rgba(0, 0, 0, 0.15);
    --transition: all 0.3s ease;
}

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

.shisha-configurator {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    color: var(--text-color);
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* === Wskaźnik postępu === */
.configurator-progress {
    background: white;
    padding: 20px;
    border-radius: 8px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--secondary-color), var(--success-color));
    transition: width 0.4s ease;
}

.progress-text {
    text-align: center;
    font-size: 14px;
    color: var(--text-light);
    font-weight: 500;
}

/* === Kontener główny === */
.configurator-container {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 30px;
    align-items: start;
}

/* === Główna zawartość === */
.configurator-main {
    background: white;
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    transition: opacity 0.3s ease;
}

.step-header {
    margin-bottom: 30px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.step-title {
    font-size: 28px;
    font-weight: 700;
    margin: 0 0 10px 0;
    color: var(--primary-color);
}

.step-description {
    font-size: 16px;
    color: var(--text-light);
    margin: 0;
}

/* === Filtry === */
.configurator-filters {
    margin-bottom: 30px;
}

.filters-wrapper {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 15px;
}

.filter-group {
    display: flex;
    flex-direction: column;
}

.filter-group label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-color);
}

.filter-group select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    transition: var(--transition);
}

.filter-group select:hover {
    border-color: var(--secondary-color);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(52, 152, 219, 0.1);
}

.btn-reset-filters {
    padding: 8px 16px;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    color: var(--text-color);
    cursor: pointer;
    transition: var(--transition);
}

.btn-reset-filters:hover {
    background: var(--border-color);
}

/* === Komunikat opcjonalny === */
.optional-step-notice {
    padding: 15px 20px;
    background: #e8f5e9;
    border: 2px solid #4caf50;
    border-radius: 8px;
    margin-bottom: 25px;
    font-size: 15px;
    color: #2e7d32;
    font-weight: 500;
    text-align: center;
}

/* === Wyszukiwarka produktów === */
.product-search-wrapper {
    position: relative;
    margin-bottom: 25px;
}

.product-search-input {
    width: 100%;
    padding: 12px 40px 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    font-family: inherit;
    transition: var(--transition);
    background: white;
}

.product-search-input:focus {
    outline: none;
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(72, 4, 164, 0.1);
}

.product-search-input::placeholder {
    color: #999;
}

.search-clear {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    color: #666;
    transition: var(--transition);
    user-select: none;
}

.search-clear:hover {
    background: #ccc;
    color: var(--text-color);
}

/* === Produkty === */
.configurator-products {
    margin-bottom: 30px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
    margin-bottom: 20px;
}

.product-card {
    background: white;
    border: 1px solid #f0f0f0;
    border-radius: 12px;
    padding: 0;
    transition: var(--transition);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.product-card:hover {
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    transform: translateY(-3px);
}

.product-card.selected {
    box-shadow: 0 0 0 3px var(--success-color);
}

.product-card.selected::after {
    content: '✓';
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    background: var(--success-color);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 18px;
    z-index: 10;
}

.product-image-wrapper {
    width: 100%;
    height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px;
    background: white;
    margin-bottom: 0;
    overflow: visible;
    position: relative;
}

/* Badge: zgodny kolor */
.badge-color-match {
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--primary-color);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 12px;
    z-index: 2;
    white-space: nowrap;
}

.badge-recommended {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #f6a623 0%, #e8830e 100%);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 12px;
    z-index: 2;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(230, 126, 34, 0.4);
}

.product-card.recommended {
    border-color: #f6a623;
}

.product-image {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-info {
    padding: 20px 20px 10px 20px;
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-bottom: 0;
}

.product-name {
    font-size: 16px;
    font-weight: 600;
    margin: 0 0 12px 0;
    color: var(--text-color);
    line-height: 1.4;
    min-height: auto;
}

.product-price {
    font-size: 22px;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0 0 15px 0;
}

.product-card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 20px 20px 20px;
}

.btn-select-product {
    flex: 1;
    padding: 12px;
    background: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-select-product:hover {
    background: var(--hover-color);
    transform: translateY(-1px);
}

.product-card.selected .btn-select-product {
    background: var(--success-color);
}

.product-card.selected .btn-select-product:hover {
    background: #229954;
}

/* Flash "Wybrano" — pulsujący zielony */
.btn-select-product.btn-selected-flash {
    background: var(--success-color);
    animation: flash-selected 0.6s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

@keyframes flash-selected {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.04); }
    60%  { transform: scale(1); }
    100% { transform: scale(1); }
}

.btn-product-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: white;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    color: #666;
    text-decoration: none;
    transition: var(--transition);
    flex-shrink: 0;
}

.btn-product-link:hover {
    border-color: var(--secondary-color);
    color: var(--secondary-color);
    background: #f8f8f8;
}

.btn-product-link svg {
    display: block;
}

/* === Loader === */
.products-loader {
    text-align: center;
    padding: 40px;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid var(--border-color);
    border-top-color: var(--secondary-color);
    border-radius: 50%;
    margin: 0 auto 15px;
    animation: spin 1s linear infinite;
}

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

.no-products-message {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
    font-size: 16px;
}

/* === Load More === */
.load-more-wrapper {
    text-align: center;
    margin-bottom: 20px;
}

.btn-load-more {
    padding: 12px 30px;
    background: white;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-load-more:hover {
    background: var(--hover-color);
    border-color: var(--hover-color);
    color: white;
}

/* === Nawigacja === */
.configurator-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    padding-top: 20px;
    border-top: 2px solid var(--border-color);
}

.configurator-navigation button {
    padding: 12px 24px;
    border: none;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-back {
    background: var(--bg-light);
    color: var(--text-color);
}

.btn-back:hover:not(:disabled) {
    background: var(--border-color);
}

.btn-skip {
    background: white;
    color: var(--text-light);
    border: 2px solid var(--border-color);
}

.btn-skip:hover {
    background: var(--bg-light);
}

.btn-next {
    background: var(--secondary-color);
    color: white;
}

.btn-next:hover:not(:disabled) {
    background: var(--hover-color);
}

.configurator-navigation button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* === Sidebar === */
.configurator-sidebar {
    position: relative;
}

.sidebar-sticky {
    position: sticky;
    top: 20px;
    background: white;
    padding: 25px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.sidebar-title {
    font-size: 20px;
    font-weight: 700;
    margin: 0 0 20px 0;
    color: var(--primary-color);
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}

.configuration-summary {
    margin-bottom: 20px;
}

.summary-item {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    transition: background 0.3s ease;
}

.summary-item:last-child {
    border-bottom: none;
}

/* Aktywny krok — zielone podświetlenie */
.summary-item.active {
    background: rgba(39, 174, 96, 0.08);
    border-left: 4px solid var(--success-color);
    padding-left: 12px;
    margin-left: -16px;
    padding-right: 4px;
    padding-top: 20px; /* Dodany padding-top */
}

/* Pokaż wszystkie kroki - ukryj tylko content bez produktu */
.summary-item {
    display: block;
}

.summary-item:not(.has-selection) .summary-content {
    display: none;
}

.summary-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 0; /* Usunięty margin-bottom */
}

/* Wyrównanie dla aktywnego kroku */
.summary-item.active .summary-header {
    padding-left: 4px; /* Kompensuje border-left 4px */
}

.summary-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    background: var(--secondary-color);
    color: white;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 700;
}

/* Krok bez wyboru - jaśniejszy numer */
.summary-item:not(.has-selection) .summary-step-number {
    background: #ddd;
    color: #999;
}

.summary-step-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-color);
}

/* Krok bez wyboru - jaśniejszy tytuł */
.summary-item:not(.has-selection) .summary-step-title {
    color: #999;
}

.summary-content {
    margin-bottom: 10px;
}

.summary-cleared-notice {
    padding: 10px;
    background: #fff3cd;
    border: 1px solid #ffc107;
    border-radius: 6px;
    margin-bottom: 10px;
}

.cleared-notice-text {
    margin: 0;
    font-size: 12px;
    color: #856404;
    line-height: 1.4;
}

.summary-product {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.summary-product-image {
    width: 60px;
    height: 60px;
    object-fit: contain;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.summary-product-info {
    flex: 1;
}

.summary-product-name {
    font-size: 13px;
    font-weight: 600;
    margin: 0 0 5px 0;
    color: var(--text-color);
    line-height: 1.3;
}

.summary-product-price {
    font-size: 14px;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0;
}

.btn-change-choice {
    width: 100%;
    padding: 8px;
    background: white;
    color: var(--secondary-color);
    border: 1px solid var(--secondary-color);
    border-radius: 4px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-change-choice:hover {
    background: var(--hover-color);
    border-color: var(--hover-color);
    color: white;
}

/* === Suma całkowita === */
.configuration-total {
    padding: 20px 0;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 20px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.total-label {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-color);
}

.total-price {
    font-size: 24px;
    font-weight: 700;
    color: var(--success-color);
}

/* === Akcje sidebara === */
.sidebar-actions {
    margin-top: 20px;
}

.btn-finalize {
    width: 100%;
    padding: 14px;
    background: var(--success-color);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
}

.btn-finalize:hover:not(:disabled) {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

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

/* === Ekran podsumowania === */
.configurator-summary-screen {
    background: white;
    padding: 40px;
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.summary-screen-content h2 {
    font-size: 32px;
    font-weight: 700;
    margin: 0 0 30px 0;
    color: var(--primary-color);
    text-align: center;
}

.final-summary-list {
    margin-bottom: 30px;
}

.final-summary-item {
    display: flex;
    gap: 20px;
    padding: 20px;
    margin-bottom: 15px;
    background: var(--bg-light);
    border-radius: 8px;
    align-items: center;
}

.final-summary-item img {
    width: 100px;
    height: 100px;
    object-fit: contain;
    border-radius: 6px;
    border: 1px solid var(--border-color);
}

.final-summary-item .item-info {
    flex: 1;
}

.final-summary-item h4 {
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: var(--text-color);
}

.final-summary-item p {
    font-size: 18px;
    font-weight: 700;
    color: var(--secondary-color);
    margin: 0;
}

.final-total {
    text-align: center;
    padding: 30px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 30px;
}

.final-total h3 {
    font-size: 20px;
    font-weight: 600;
    margin: 0 0 10px 0;
    color: var(--text-color);
}

.final-total-price {
    font-size: 36px;
    font-weight: 700;
    color: var(--success-color);
    margin: 0;
}

.summary-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.summary-actions button {
    padding: 14px 30px;
    border: none;
    border-radius: 6px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.btn-edit-config {
    background: white;
    color: var(--text-color);
    border: 2px solid var(--border-color);
}

.btn-edit-config:hover {
    background: var(--bg-light);
}

.btn-add-to-cart {
    background: var(--success-color);
    color: white;
}

.btn-add-to-cart:hover {
    background: #229954;
    transform: translateY(-2px);
    box-shadow: var(--shadow-hover);
}

/* === Responsywność === */
@media (max-width: 1024px) {
    .configurator-container {
        grid-template-columns: 1fr;
    }
    
    .configurator-sidebar {
        order: -1;
    }
    
    .sidebar-sticky {
        position: relative;
        top: 0;
    }
}

@media (max-width: 768px) {
    .shisha-configurator {
        padding: 10px;
    }
    
    .configurator-main {
        padding: 20px;
    }
    
    .step-title {
        font-size: 22px;
    }
    
    .filters-wrapper {
        grid-template-columns: 1fr;
    }
    
    .products-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .configurator-navigation {
        flex-direction: column;
    }
    
    .configurator-navigation button {
        width: 100%;
    }
    
    .summary-actions {
        flex-direction: column;
    }
    
    .summary-actions button {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .products-grid {
        grid-template-columns: 1fr;
    }
    
    .product-image-wrapper {
        height: 150px;
    }
}
