* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #ddd;
    font-family: Arial, Helvetica, sans-serif;
}

.panel {
    width: 210mm;
    margin: 20px auto;
    background: white;
    padding: 15px;
    text-align: center;
    border-radius: 8px;
}

.panel button {
    padding: 10px 18px;
    font-size: 15px;
    font-weight: bold;
    cursor: pointer;
    margin: 3px;
}

.hint {
    margin-top: 8px;
    font-size: 13px;
    color: #555;
}

.a4-page {
    width: 210mm;
    height: 297mm;
    margin: 0 auto 30px auto;
    background: white;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-rows: repeat(4, 1fr);
    border: 2px solid blue;
    position: relative;
}

.fis-card {
    border: 1px solid #000;
    position: relative;
    overflow: visible;
    background: #fff;
}

.date-row {
    height: 5mm;
}

.date-row input {
    width: 100%;
    height: 5mm;
    border: none;
    text-align: center;
    font-size: 13px;
    font-weight: 900;
    padding: 0;
}

.title-row {
    height: 7mm;
    background: #ffff00;
    text-align: center;
    font-size: 18px;
    font-weight: 900;
    line-height: 7mm;
}

.name-row {
    height: 5mm;
    display: flex;
    border-bottom: 1px solid #000;
}

.name-row span {
    width: 18mm;
    border-right: 1px solid #000;
    font-size: 9px;
    font-weight: bold;
    padding: 1.3mm 1mm;
}

.name-row input {
    flex: 1;
    border: none;
    padding-left: 2mm;
    font-size: 13px;
    font-weight: bold;
}

.content-row {
    height: calc(100% - 17mm);
    display: flex;
    overflow: hidden;
}

.left-content {
    flex: 1;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.image-area {
    flex: 1;
    background: #fff;
    position: relative;
    overflow: hidden;
    cursor: move;
}

.image-area:focus,
.image-area.active-selected {
    outline: 2px solid #ff9900;
    outline-offset: -2px;
}

.image-area img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: none;
    position: absolute;
    left: 0;
    top: 0;
    transform-origin: center center;
    user-select: none;
    pointer-events: none;
}

.image-area img.has-image {
    display: block;
}

.note-row {
    height: 6mm;
    border-top: 1px solid #000;
    background: #fff;
}

.note-row input {
    width: 100%;
    height: 100%;
    border: none;
    padding: 0 2mm;
    font-size: 12px;
    font-weight: bold;
}

.price-area {
    width: 10mm;
    background: #ffff00;
    border-left: 1px solid #000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.price-area input {
    width: 58mm;
    border: none;
    background: #ffff00;
    transform: rotate(-90deg);
    text-align: center;
    font-size: 15px;
    font-weight: 900;
}

/* Her fişin kendi butonları */
.side-tools {
    position: absolute;
    top: 19mm;
    width: 22mm;
    display: flex;
    flex-direction: column;
    gap: 2mm;
    z-index: 20;
}

.left-card .side-tools {
    left: -25mm;
}

.right-card .side-tools {
    right: -25mm;
}

.side-tools button {
    width: 22mm;
    min-height: 8mm;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    border: 1px solid #222;
    background: #fff;
    border-radius: 4px;
}

.side-tools button:hover {
    background: #ffff00;
}

.product-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.product-modal.active {
    display: flex;
}

.product-modal-inner {
    width: 950px;
    max-width: 95vw;
    height: 82vh;
    background: white;
    border-radius: 10px;
    padding: 15px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

#productSearch {
    width: 100%;
    height: 42px;
    border: 1px solid #ccc;
    padding: 0 12px;
    font-size: 16px;
    margin-bottom: 12px;
}

.product-grid {
    flex: 1;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.product-item {
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 8px;
    cursor: pointer;
    background: #fff;
}

.product-item:hover {
    border-color: #000;
}

.product-item img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: contain;
    background: #f7f7f7;
    border-radius: 6px;
}

.product-item-title {
    font-size: 12px;
    line-height: 1.25;
    margin-top: 6px;
    height: 32px;
    overflow: hidden;
}

@media print {
    @page {
        size: A4;
        margin: 0;
    }

    body {
        background: white;
        margin: 0;
        padding: 0;
    }

    .no-print {
        display: none !important;
    }

    .a4-page {
        width: 210mm;
        height: 297mm;
        margin: 0;
        border: 2px solid blue;
    }

    .fis-card {
        overflow: hidden;
    }

    input {
        outline: none;
    }

    .image-area:focus,
    .image-area.active-selected {
        outline: none;
    }
}