@font-face {
    font-family: 'Kumbh Sans';
    src: url('assets/fonts/KumbhSans-Light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Kumbh Sans';
    src: url('assets/fonts/KumbhSans-Regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Kumbh Sans';
    src: url('assets/fonts/KumbhSans-Bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;
    font-family: 'Kumbh Sans', 'Segoe UI', Tahoma, sans-serif;
    --bg: #eef3fb;
    --panel: #ffffff;
    --primary: #1d3e74;
    --primary-dark: #17335f;
    --accent: #2f5ca2;
    --text: #1f2b3a;
    --muted: #607286;
    --border: #d2deec;
    --shadow: 0 20px 45px rgba(29, 62, 116, 0.16);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: linear-gradient(135deg, rgba(245, 247, 255, 0.96), rgba(226, 230, 248, 0.96)),
        url('https://plexiland.nazwa.pl/page/wp-content/uploads/2025/01/Zadaszenie.jpg') center/cover fixed;
    color: var(--text);
    min-height: 100vh;
}

[hidden] {
    display: none !important;
}

.app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(4px);
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    padding: 24px clamp(24px, 5vw, 64px);
    background: rgba(255, 255, 255, 0.92);
    border-bottom: 1px solid rgba(45, 33, 99, 0.08);
    box-shadow: 0 18px 40px rgba(58, 45, 125, 0.12);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
}

.brand__logo {
    width: clamp(110px, 12vw, 150px);
    height: auto;
    background: linear-gradient(135deg, #ffffff, #f1f6fd);
    border: 1px solid rgba(29, 62, 116, 0.15);
    border-radius: 7px;
    padding: 2px 4px;
    box-shadow: 0 4px 10px rgba(29, 62, 116, 0.08);
}

.auth-logo {
    width: min(190px, 70%);
    height: auto;
    display: block;
    margin: 0 auto 12px;
    background: linear-gradient(135deg, #ffffff, #f1f6fd);
    border: 1px solid rgba(29, 62, 116, 0.18);
    border-radius: 7px;
    padding: 3px 5px;
    box-shadow: 0 5px 12px rgba(29, 62, 116, 0.09);
}

.brand__title {
    font-size: clamp(1.2rem, 2vw, 1.6rem);
    font-weight: 700;
}

.brand__text {
    min-width: 0;
}

.brand__subtitle {
    display: block;
    font-size: clamp(0.85rem, 1.2vw, 1rem);
    color: var(--muted);
    font-weight: 500;
}

.topbar__logout {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 999px;
    border: none;
    font-weight: 600;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    cursor: pointer;
    box-shadow: 0 12px 20px rgba(58, 45, 125, 0.25);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.topbar__logout:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 28px rgba(58, 45, 125, 0.28);
}

.workspace {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: clamp(24px, 4vw, 48px);
}

.app[data-view="auth"] #app-view {
    display: none;
}

.app[data-view="auth"] .workspace {
    place-items: center;
}

.app[data-view="app"] #auth-view {
    display: none;
}

.app[data-view="app"] .workspace {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(24px, 3vw, 36px);
}

.auth-card {
    width: min(420px, 100%);
    background: rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    padding: clamp(24px, 5vw, 42px);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
}

.tabs {
    display: none;
}

.tabs__tab {
    display: none;
}

.tabs__tab--active {
    display: none;
}

.auth-form h1 {
    margin: 0 0 8px;
    font-size: 1.8rem;
}

.auth-form__hint {
    margin: 0 0 24px;
    color: var(--muted);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 18px;
}

.field__label {
    font-weight: 600;
    font-size: 0.95rem;
}

.field__input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.85);
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field__input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(58, 45, 125, 0.15);
}

input.field__input[readonly] {
    -moz-appearance: textfield;
}

input.field__input[readonly]::-webkit-outer-spin-button,
input.field__input[readonly]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.field__input--textarea {
    resize: vertical;
    min-height: 120px;
}

.btn {
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn--primary {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: #fff;
    box-shadow: 0 12px 24px rgba(58, 45, 125, 0.25);
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 32px rgba(58, 45, 125, 0.32);
}

.btn--secondary {
    background: rgba(58, 45, 125, 0.08);
    color: var(--primary);
    border: 1px solid rgba(58, 45, 125, 0.2);
}

.btn--ghost {
    background: transparent;
    color: var(--muted);
    border: 1px dashed rgba(108, 111, 133, 0.6);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.form-message {
    margin: 12px 0 0;
    font-weight: 600;
    font-size: 0.95rem;
}

.form-message--error {
    color: #d13c4f;
}

.form-message--success {
    color: #1b8a5b;
}

.sidebar {
    background: rgba(255, 255, 255, 0.92);
    border-radius: 24px;
    padding: clamp(20px, 3vw, 28px);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.7);
    display: flex;
    flex-direction: column;
    gap: 18px;
    min-width: 0;
}

.app-view {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    grid-template-areas:
        "sidebar editor"
        "sidebar preview";
    gap: clamp(24px, 3vw, 36px);
    align-items: start;
}

.sidebar {
    grid-area: sidebar;
}

.sidebar__header {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sidebar__actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.offer-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow-y: auto;
    max-height: calc(100vh - 320px);
}

.offer-list__item {
    padding: 14px;
    border-radius: 14px;
    border: 1px solid rgba(58, 45, 125, 0.08);
    background: rgba(248, 248, 255, 0.7);
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.offer-list__item:hover,
.offer-list__item--active {
    transform: translateY(-2px);
    box-shadow: 0 14px 24px rgba(58, 45, 125, 0.15);
    border-color: rgba(58, 45, 125, 0.35);
    background: #fff;
}

.offer-list__title {
    margin: 0 0 6px;
    font-weight: 600;
}

.offer-list__meta {
    margin: 0;
    font-size: 0.85rem;
    color: var(--muted);
}

.editor {
    grid-area: editor;
    background: rgba(255, 255, 255, 0.94);
    border-radius: 24px;
    padding: clamp(24px, 4vw, 40px);
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.7);
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
    min-width: 0;
}

.section h2 {
    margin: 0 0 12px;
}

.section {
    min-width: 0;
}

.grid {
    display: grid;
    gap: 18px;
}

.grid--two {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.grid--three {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.price-box {
    margin-top: 18px;
    padding: 24px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(58, 45, 125, 0.95), rgba(93, 75, 161, 0.95));
    color: #fff;
    text-align: center;
    box-shadow: 0 25px 45px rgba(58, 45, 125, 0.35);
}

.price-box__material {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
    opacity: 0.92;
}

.price-box__dimensions {
    margin: 8px 0;
    font-weight: 500;
    opacity: 0.8;
}

.price-box__price {
    margin: 10px 0 16px;
    font-size: clamp(2rem, 4vw, 2.8rem);
    font-weight: 700;
}

.price-box__note {
    margin: 0;
    font-size: 0.9rem;
    opacity: 0.85;
}

.radio-group {
    display: grid;
    gap: 6px;
    font-weight: 600;
    color: var(--muted);
}

.radio-group label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
}

.section-note {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.95rem;
}

.checkbox-inline {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    color: var(--muted);
}

.addon-wall-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 18px;
    margin: 0 0 14px;
    color: var(--muted);
    font-weight: 600;
}

.wall-select {
    margin: 0;
    border: 1px solid rgba(58, 45, 125, 0.16);
    border-radius: 12px;
    background: rgba(58, 45, 125, 0.03);
    padding: 12px;
    display: grid;
    gap: 8px;
}

.wall-select legend {
    font-weight: 700;
    color: var(--primary);
    padding: 0 4px;
}

.wall-select label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    font-weight: 600;
}

.wall-select--extras {
    margin-top: 12px;
    background: rgba(58, 45, 125, 0.06);
}

.addon-info-btn {
    margin-top: 6px;
    justify-self: start;
    padding: 8px 12px;
    font-size: 0.85rem;
}

.addon-summary {
    margin-top: 10px;
    padding: 14px;
    border-radius: 12px;
    border: 1px solid rgba(58, 45, 125, 0.16);
    background: rgba(58, 45, 125, 0.05);
    display: grid;
    gap: 6px;
}

.addon-summary p {
    margin: 0;
    font-size: 0.93rem;
}

.product-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.product-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 14, 29, 0.56);
    backdrop-filter: blur(2px);
}

.product-modal__dialog {
    position: relative;
    width: min(980px, calc(100vw - 30px));
    margin: 22px auto;
    background: #fff;
    border-radius: 16px;
    border: 1px solid rgba(15, 23, 42, 0.08);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.3);
    max-height: calc(100vh - 44px);
    overflow: auto;
}

.product-modal__grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: 20px;
    padding: 20px;
}

.product-modal__close {
    position: absolute;
    top: 10px;
    right: 12px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: rgba(58, 45, 125, 0.1);
    color: var(--primary);
    font-size: 1.45rem;
    line-height: 1;
    cursor: pointer;
}

.product-modal__main-image {
    width: 100%;
    height: 290px;
    object-fit: contain;
    object-position: center;
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #f6f8fc;
    cursor: zoom-in;
}

.product-modal__thumbs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.product-modal__thumb {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    border: 2px solid transparent;
    padding: 0;
    overflow: hidden;
    background: #fff;
    cursor: pointer;
}

.product-modal__thumb.is-active {
    border-color: var(--primary);
}

.product-modal__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.product-modal__content h3 {
    margin: 0 0 8px;
    color: var(--primary);
}

.product-modal__content h4 {
    margin: 14px 0 8px;
    color: var(--text);
}

.product-modal__description {
    margin: 0;
    color: var(--muted);
}

.product-modal__list {
    margin: 0;
    padding-left: 20px;
    display: grid;
    gap: 6px;
}

.product-modal__actions {
    margin-top: 16px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.image-zoom {
    position: fixed;
    inset: 0;
    z-index: 1400;
}

.image-zoom__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 12, 25, 0.82);
}

.image-zoom__dialog {
    position: relative;
    width: min(96vw, 1500px);
    height: min(92vh, 980px);
    margin: 4vh auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-zoom__image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.45);
    background: #fff;
}

.image-zoom__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.7rem;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 900px) {
    .product-modal__grid {
        grid-template-columns: 1fr;
    }

    .product-modal__main-image {
        height: 220px;
    }
}

.loan-box {
    margin-top: 16px;
    padding: 18px;
    border-radius: 16px;
    border: 1px solid rgba(58, 45, 125, 0.2);
    background: rgba(58, 45, 125, 0.05);
    display: grid;
    gap: 8px;
    font-weight: 600;
}

.finance-disclaimer {
    margin: 10px 0 0;
    font-size: 0.82rem;
    color: var(--muted);
    line-height: 1.45;
}

.pricing-matrix {
    margin-top: 16px;
}

.pricing-matrix .preview__table input {
    min-width: 100px;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
}

.section .btn {
    max-width: 100%;
}

/* Podgląd oferty / wydruk */
.preview {
    position: relative;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(240, 242, 255, 0.94));
    border-radius: 18px;
    padding: clamp(20px, 3vw, 32px);
    box-shadow: 0 18px 36px rgba(58, 45, 125, 0.16);
    border: 1px solid rgba(58, 45, 125, 0.08);
    width: 100%;
    display: grid;
    gap: 16px;
    margin-top: 20px;
    overflow: hidden;
}

.preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(58, 45, 125, 0.08), transparent 45%),
        url("https://plexiland.nazwa.pl/page/wp-content/uploads/2025/01/PlastifyLogoPelne.png") no-repeat 96% 6%;
    background-size: 220px;
    opacity: 0.35;
    pointer-events: none;
}

.preview > * {
    position: relative;
    z-index: 1;
}

.preview-wrapper {
    grid-area: preview;
    display: none;
    width: 100%;
}

.preview-wrapper.show {
    display: block;
}
.preview__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding-bottom: 10px;
    border-bottom: 1px solid rgba(58, 45, 125, 0.1);
}

.preview__section {
    background: linear-gradient(135deg, rgba(248, 248, 255, 0.95), rgba(232, 236, 250, 0.9));
    border: 1px solid rgba(58, 45, 125, 0.1);
    border-radius: 16px;
    padding: 14px 16px;
}

.preview__section h3 {
    margin: 0 0 10px;
    font-size: 1.05rem;
    color: var(--primary);
}

.preview__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 12px;
    overflow: hidden;
}

.preview__table th,
.preview__table td {
    padding: 10px 12px;
    border-bottom: 1px solid rgba(58, 45, 125, 0.06);
    text-align: left;
}

.preview__table tr:last-child td {
    border-bottom: none;
}

.preview__table th {
    background: rgba(58, 45, 125, 0.06);
    font-weight: 700;
    color: var(--primary);
}

.preview__footer {
    text-align: right;
    color: var(--muted);
    font-weight: 600;
}

.print-preview {
    padding: clamp(24px, 4vw, 40px);
    border-radius: 24px;
    background: #fff;
    border: 1px solid rgba(58, 45, 125, 0.1);
    box-shadow: 0 20px 38px rgba(58, 45, 125, 0.18);
}

.print-header {
    display: flex;
    align-items: center;
    gap: 22px;
    margin-bottom: 24px;
}

.print-header__logo {
    width: clamp(90px, 10vw, 130px);
    height: auto;
}

.print-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 22px;
    margin-bottom: 24px;
}

.print-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 6px;
    font-size: 0.95rem;
}

.print-notes {
    margin-bottom: 24px;
}

.print-footer {
    font-size: 0.85rem;
    color: var(--muted);
    display: grid;
    gap: 6px;
}

@media (max-width: 1024px) {
    .topbar {
        padding: 18px 20px;
    }

    .brand {
        gap: 14px;
    }

    .brand__logo {
        width: clamp(90px, 18vw, 130px);
    }

    .app[data-view="app"] .workspace {
        grid-template-columns: minmax(0, 1fr);
        padding: 20px;
    }

    .app-view {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "editor"
            "sidebar"
            "preview";
        gap: 20px;
    }

    .sidebar {
        max-height: none;
    }
}

@media (max-width: 820px) {
    body {
        background-attachment: scroll;
    }

    .topbar {
        position: static;
    }

    .brand {
        width: 100%;
    }

    .topbar__logout {
        width: 100%;
        justify-content: center;
    }

    .workspace {
        padding: 16px;
    }

    .auth-card,
    .sidebar,
    .editor,
    .preview {
        border-radius: 18px;
    }

    .editor {
        padding: 20px;
        gap: 24px;
    }

    .sidebar__actions {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .offer-list {
        max-height: 320px;
    }

    .price-box {
        padding: 18px;
    }

    .price-box__price {
        font-size: clamp(1.8rem, 8vw, 2.3rem);
    }

    .preview__header,
    .print-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .preview__table,
    .preview__table tbody,
    .preview__table tr,
    .preview__table th,
    .preview__table td {
        display: block;
        width: 100%;
    }

    .preview__table tr {
        padding: 10px 0;
        border-bottom: 1px solid rgba(58, 45, 125, 0.06);
    }

    .preview__table tr:last-child {
        border-bottom: none;
    }

    .preview__table th {
        padding-bottom: 4px;
        border-bottom: none;
        background: transparent;
    }

    .preview__table td {
        padding-top: 0;
        border-bottom: none;
    }

    .product-modal__dialog {
        width: min(100vw - 16px, 980px);
        margin: 8px auto;
        max-height: calc(100vh - 16px);
    }

    .product-modal__grid {
        padding: 16px;
        gap: 14px;
    }
}

@media (max-width: 640px) {
    .brand {
        align-items: flex-start;
    }

    .brand__subtitle {
        line-height: 1.35;
    }

    .sidebar__actions {
        grid-template-columns: 1fr;
    }

    .grid--two,
    .grid--three {
        grid-template-columns: 1fr;
    }

    .addon-wall-meta {
        flex-direction: column;
        gap: 8px;
    }

    .wall-select {
        padding: 10px;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn,
    .sidebar__actions .btn,
    .product-modal__actions .btn,
    .btn {
        width: 100%;
    }

    .field__input {
        padding: 13px 14px;
        font-size: 16px;
    }

    .offer-list__item {
        padding: 12px;
    }

    .loan-box,
    .addon-summary,
    .preview__section {
        padding: 12px;
    }

    .preview {
        padding: 16px;
    }
}

@media print {
    @page {
        size: A4;
        margin: 5mm 10mm 10mm;
    }

    body {
        background: #fff;
    }

    .topbar,
    .sidebar,
    .editor,
    .form-actions,
    .price-box__note,
        #offer-success,
        #offer-error {
        display: none !important;
    }

    .preview-wrapper {
        display: block !important;
        grid-column: 1 / -1;
    }

    .preview {
        box-shadow: none;
        border: 1px solid #ddd;
        padding: 0;
        max-width: 100%;
        background: #fff;
        display: grid !important;
    }
}
