/* ============================================
   KOMPAKTOWY PROFESJONALNY KALKULATOR
   ============================================ */

:root {
    --calc-primary: #0066cc;
    --calc-primary-hover: #0052a3;
    --calc-success: #10b981;
    --calc-success-dark: #059669;
    --calc-text: #1f2937;
    --calc-text-light: #6b7280;
    --calc-text-muted: #9ca3af;
    --calc-border: #e5e7eb;
    --calc-border-light: #f3f4f6;
    --calc-bg: #f9fafb;
    --calc-bg-white: #ffffff;
    --calc-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --calc-shadow-md: 0 4px 6px rgba(0, 0, 0, 0.05);
    --calc-radius: 8px;
    --calc-radius-sm: 6px;
}

/* PODSTAWOWY KONTENER - KOMPAKTOWY */
.calc-container {
    margin: 0;
    margin-bottom: -10px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background: #fefefe;
    border: 1px solid #ddd;
}

/* NAGŁÓWEK - ZMNIEJSZONY */
.calc-header {
    padding: 10px 14px;
    text-align: left;
}

.calc-title {
    font-size: 1.8em;
    margin-bottom: 20px;
    font-weight: 600;
    color: #2c3e50;
    border-bottom: 2px solid #3498db;
    padding-bottom: 8px;
}

/* SELEKTOR PRODUKTÓW - KOMPAKTOWY */
.calc-selector-section {
    padding: 20px 24px;
    background: #fafafa;
    border-bottom: 1px solid var(--calc-border-light);
}

.calc-label {
    display: block;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--calc-text);
    text-align: center;
}

/* PRZYCISKI PRODUKTÓW - RESPONSYWNY GRID */
.calc-product-buttons {
    display: grid;
    gap: 8px;
    width: 100%;
}

.calc-product-buttons[data-product-count="1"] {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin: 0 auto;
}

.calc-product-buttons[data-product-count="2"] {
    grid-template-columns: 1fr 1fr;
    max-width: 500px;
    margin: 0 auto;
}

.calc-product-buttons[data-product-count="3"] {
    grid-template-columns: repeat(3, 1fr);
}

.calc-product-buttons[data-product-count="4"] {
    grid-template-columns: repeat(4, 1fr);
}

.calc-product-buttons:not([data-product-count="1"]):not([data-product-count="2"]):not([data-product-count="3"]):not([data-product-count="4"]) {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

/* STYL PRZYCISKÓW - KOMPAKTOWY */
.calc-product-btn {
    padding: 12px 16px;
    font-size: 14px;
    font-weight: 500;
    color: var(--calc-text);
    background: var(--calc-bg-white);
    border: 2px solid var(--calc-border);
    border-radius: var(--calc-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calc-product-btn:hover {
    border-color: var(--calc-primary);
    color: var(--calc-primary);
    transform: translateY(-1px);
    box-shadow: var(--calc-shadow);
}

.calc-product-btn.active {
    background: var(--calc-primary);
    border-color: var(--calc-primary);
    color: white;
    transform: none;
    box-shadow: 0 2px 4px rgba(0, 102, 204, 0.2);
}

/* LOADER */
.calc-loader {
    padding: 30px;
    text-align: center;
    background: var(--calc-bg);
}

.calc-loader-spinner {
    width: 24px;
    height: 24px;
    margin: 0 auto 12px;
    border: 2px solid var(--calc-border);
    border-top-color: var(--calc-primary);
    border-radius: 50%;
    animation: calcSpinner 1s linear infinite;
}

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

.calc-loader p {
    margin: 0;
    color: var(--calc-text-light);
    font-size: 13px;
}

/* GŁÓWNY CONTENT */
.calc-content {
    background: var(--calc-bg-white);
}

/* INFORMACJE O PRODUKCIE - KOMPAKTOWE */
.calc-product-info {
    display: flex;
    gap: 20px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--calc-border-light);
}

.calc-product-image {
    flex: 0 0 120px;
}

.calc-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    border-radius: var(--calc-radius-sm);
    border: 1px solid var(--calc-border);
}

.calc-product-description {
    flex: 1;
    font-size: 14px;
    line-height: 1.5;
    color: var(--calc-text-light);
}

.calc-product-description-full {
    padding: 20px 24px;
    border-bottom: 1px solid var(--calc-border-light);
    font-size: 14px;
    line-height: 1.5;
    color: var(--calc-text-light);
}

/* ============================================
   KALKULATOR - BARDZO KOMPAKTOWY
   ============================================ */

.calc-calculator-section {
    padding: 24px;
    background: var(--calc-bg-white);
}

.calc-section-title {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--calc-text);
    text-align: center;
}

/* NOWY KOMPAKTOWY UKŁAD */
.calc-form {
    max-width: 800px;
    margin: 0 auto;
}

/* NOWY UKŁAD KALKULATORA - WYMIARY × ILOŚĆ = CENA */
.calc-dimensions {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 20px;
    padding: 32px;
    background: var(--calc-bg);
    border: 1px solid var(--calc-border);
    border-radius: 12px;
    flex-wrap: wrap;
}

.calc-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 120px;
}

.calc-input-label {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--calc-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.calc-input {
    width: 100px;
    padding: 12px 16px;
    text-align: center;
    font-size: 16px;
    font-weight: 600;
    color: var(--calc-text);
    background: var(--calc-white);
    border: 2px solid var(--calc-border);
    border-radius: 8px;
    transition: all 0.2s ease;
}

.calc-unit {
    margin-top: 4px;
    font-size: 11px;
    color: var(--calc-text-muted);
    font-weight: 500;
}

.calc-operator {
    font-size: 24px;
    font-weight: 300;
    color: var(--calc-text-muted);
    align-self: center;
    margin: 0 4px;
    line-height: 1;
}

/* WYNIK - ZINTEGROWANY W LINII */
.calc-result-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 200px;
    background: var(--calc-success);
    padding: 16px;
    border-radius: 8px;
}

.calc-result-label {
    margin-bottom: 8px;
    font-size: 11px;
    font-weight: 500;
    color: var(--calc-white);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.9;
}

.calc-price-result {
    text-align: center;
    color: var(--calc-white);
}

.calc-price-result #final-price {
    font-size: 20px;
    font-weight: 700;
    display: block;
    margin-bottom: 4px;
    line-height: 1;
}

.calc-currency {
    font-size: 12px;
    font-weight: 500;
    opacity: 0.9;
    display: block;
    margin-bottom: 8px;
}

/* NOWY ELEMENT - Informacja o powierzchni */
.calc-surface-note {
    font-size: 11px;
    color: var(--calc-white);
    opacity: 0.8;
    font-style: italic;
    margin-bottom: 4px;
}

.calc-vat-note {
    font-size: 10px;
    color: var(--calc-white);
    opacity: 0.7;
    line-height: 1.2;
}

/* RESPONSYWNOŚĆ */
@media screen and (max-width: 1024px) {
    .calc-dimensions {
        gap: 16px;
        padding: 24px;
    }
    
    .calc-input-group {
        min-width: 100px;
    }
    
    .calc-input {
        width: 90px;
        font-size: 14px;
    }
    
    .calc-result-group {
        min-width: 180px;
    }
    
    .calc-price-result #final-price {
        font-size: 18px;
    }
}

@media screen and (max-width: 768px) {
    /* KALKULATOR - 2 LINIE NA MOBILE */
    .calc-dimensions {
        flex-direction: column;
        gap: 20px;
        padding: 24px;
    }
    
    /* PIERWSZA LINIA - WYMIARY + ILOŚĆ */
    .calc-dimensions-line {
        display: flex;
        align-items: end;
        justify-content: center;
        gap: 16px;
        flex-wrap: wrap;
    }
    
    /* DRUGA LINIA - WYNIK */
    .calc-result-line {
        display: flex;
        justify-content: center;
    }

    .calc-operator {
        transform: rotate(90deg);
        margin: 8px 0;
        font-size: 20px;
    }

    .calc-input-group {
        min-width: 120px;
    }

    .calc-input {
        width: 100px;
        font-size: 14px;
    }

    .calc-result-group {
        min-width: 200px;
    }

    .calc-price-result #final-price {
        font-size: 18px;
    }
}

@media screen and (max-width: 480px) {
    .calc-input-group {
        min-width: 100px;
    }

    .calc-input {
        width: 80px;
        font-size: 13px;
        padding: 10px 12px;
    }

    .calc-result-group {
        min-width: 160px;
    }

    .calc-price-result #final-price {
        font-size: 16px;
    }
}


/* TABS - KOMPAKTOWE */
.calc-tabs-section {
    padding: 20px 24px;
    background: var(--calc-bg-white);
    border-top: 1px solid var(--calc-border-light);
}

.calc-tabs {
    max-width: 600px;
    margin: 0 auto;
}

.calc-tabs-nav {
    display: flex;
    background: var(--calc-bg);
    border: 1px solid var(--calc-border);
    border-radius: var(--calc-radius-sm);
    padding: 4px;
    margin-bottom: 16px;
}

.calc-tab-btn {
    flex: 1;
    padding: 8px 12px;
    background: transparent;
    border: none;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    color: var(--calc-text-light);
    cursor: pointer;
    transition: all 0.2s ease;
}

.calc-tab-btn:hover {
    color: var(--calc-text);
    background: rgba(255, 255, 255, 0.5);
}

.calc-tab-btn.active {
    background: var(--calc-bg-white);
    color: var(--calc-text);
    box-shadow: var(--calc-shadow);
}

.calc-tabs-content {
    padding: 16px;
    background: var(--calc-bg);
    border: 1px solid var(--calc-border);
    border-radius: var(--calc-radius-sm);
    min-height: 60px;
}

.calc-tab-content {
    display: none;
    font-size: 13px;
    line-height: 1.5;
    color: var(--calc-text-light);
}

.calc-tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

.calc-delivery-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.calc-delivery-icon {
    font-size: 14px;
}

.calc-additional-info-list {
    /* Kontener dla listy informacji */
}

.calc-info-item {
    padding: 4px 0;
    border-bottom: 1px solid var(--calc-border-light);
    font-size: 13px;
    line-height: 1.4;
}

.calc-info-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.calc-info-item strong {
    color: var(--calc-text);
    font-weight: 600;
}

/* EMPTY STATE */
.calc-empty-state {
    padding: 60px 24px;
    text-align: center;
    background: var(--calc-bg);
}

.calc-empty-content {
    max-width: 300px;
    margin: 0 auto;
}

.calc-empty-icon {
    font-size: 36px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.calc-empty-title {
    margin: 0 0 8px 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--calc-text);
}

.calc-empty-text {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--calc-text-light);
}

/* ERROR STATES */
.calc-error {
    padding: 16px;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: var(--calc-radius-sm);
    color: #dc2626;
    text-align: center;
    font-size: 13px;
}

/* ============================================
   RESPONSYWNOŚĆ - MOBILE FIRST
   ============================================ */

@media screen and (max-width: 768px) {
    .calc-container {
        margin: 10px;
    }

    .calc-header,
    .calc-selector-section,
    .calc-calculator-section,
    .calc-tabs-section {
        padding: 16px;
    }

    .calc-title {
        font-size: 18px;
    }

    /* PRZYCISKI ZAWSZE 1 KOLUMNA NA MOBILE */
    .calc-product-buttons,
    .calc-product-buttons[data-product-count="2"],
    .calc-product-buttons[data-product-count="3"],
    .calc-product-buttons[data-product-count="4"] {
        grid-template-columns: 1fr;
        max-width: none;
    }

    .calc-product-btn {
        padding: 10px 14px;
        font-size: 13px;
        min-height: 40px;
    }

    .calc-product-info {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .calc-product-image {
        flex: none;
        align-self: center;
    }

    .calc-image {
        width: 100px;
        height: 100px;
    }

    /* KALKULATOR - KOMPAKTOWY MOBILE */
    .calc-dimensions {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }

    .calc-dimensions-row {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 8px;
        width: 100%;
    }

    .calc-input-group {
        min-width: 70px;
    }

    .calc-input {
        width: 70px;
        font-size: 13px;
        padding: 6px 8px;
    }

    .calc-operator {
        font-size: 14px;
    }

    .calc-result-group {
        min-width: 90px;
    }

    .calc-surface,
    .calc-price-result {
        min-width: 90px;
        padding: 8px 10px;
    }

    .calc-price-result #final-price {
        font-size: 16px;
    }

    .calc-tabs-nav {
        flex-direction: column;
        padding: 0;
    }

    .calc-tab-btn {
        border-radius: 0;
        padding: 10px 16px;
        border-bottom: 1px solid var(--calc-border);
    }

    .calc-tab-btn:last-child {
        border-bottom: none;
    }

    .calc-tab-btn.active {
        border-left: 3px solid var(--calc-primary);
        background: var(--calc-bg-white);
    }
}

@media screen and (max-width: 480px) {
    .calc-header {
        padding: 12px;
    }

    .calc-title {
        font-size: 16px;
    }

    .calc-section-title {
        font-size: 16px;
    }

    .calc-product-btn {
        padding: 8px 12px;
        font-size: 12px;
        min-height: 36px;
    }

    .calc-input-group {
        min-width: 60px;
    }

    .calc-input {
        width: 60px;
        font-size: 12px;
        padding: 5px 6px;
    }

    .calc-result-group {
        min-width: 80px;
    }

    .calc-surface,
    .calc-price-result {
        min-width: 80px;
        font-size: 12px;
        padding: 6px 8px;
    }

    .calc-price-result #final-price {
        font-size: 14px;
    }

    .calc-empty-state {
        padding: 40px 16px;
    }

    .calc-empty-icon {
        font-size: 28px;
    }

    .calc-empty-title {
        font-size: 16px;
    }
}

/* SPECJALNA KOMPAKTOWA WERSJA DLA WIĘKSZYCH EKRANÓW */
@media screen and (min-width: 1200px) {
    .calc-dimensions {
        max-width: 700px;
        margin: 0 auto;
    }
    
    .calc-input-group {
        min-width: 90px;
    }
    
    .calc-input {
        width: 90px;
    }
    
    .calc-result-group {
        min-width: 110px;
    }
}

/* FOKUS I ANIMACJE */
.calc-input:focus,
.calc-product-btn:focus,
.calc-tab-btn:focus {
    outline: 2px solid var(--calc-primary);
    outline-offset: 2px;
}

.calc-input,
.calc-product-btn,
.calc-tab-btn {
    transition: all 0.15s ease;
}

/* UKRYCIE SPINNERÓW W INPUTACH */
.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.calc-input[type=number] {
    -moz-appearance: textfield;
}

/* ANIMACJE CENY */
#final-price {
    transition: all 0.2s ease;
}

.price-updating {
    opacity: 0.6;
    transform: scale(0.98);
}
