* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, sans-serif;
    background-color: #f5f5f5;
    padding: 20px;
}

.container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 1600px;
    margin: 0 auto;
}

/* Form Section */
.form-section {
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-title {
    font-size: 24px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 30px;
    color: #333;
}

.form-group {
    margin-bottom: 25px;
    padding: 15px;
    background: #f9f9f9;
    border-radius: 8px;
}

.section-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 15px;
    color: #333;
}

.form-input {
    width: 100%;
    padding: 14px;
    margin-bottom: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 16px;
    transition: border-color 0.3s;
    -webkit-appearance: none;
    appearance: none;
    touch-action: manipulation;
}

.form-input:focus {
    outline: none;
    border-color: #333;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.1);
}


.form-input.small {
    width: 100%;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}

.form-row .form-input {
    margin-bottom: 0;
}

.wheel-row, .tyre-row {
    display: grid;
    grid-template-columns: 60px 1fr 1fr 80px 80px 1fr 80px;
    gap: 8px;
    margin-bottom: 10px;
}

.tyre-row {
    grid-template-columns: 60px 1fr 1fr;
}

.add-row-btn {
    padding: 8px 16px;
    background: #333;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    margin-top: 10px;
}

.add-row-btn:hover {
    background: #555;
}

.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 16px;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.print-btn {
    width: 100%;
    padding: 15px;
    background: #000;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 18px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 20px;
}

.print-btn:hover {
    background: #333;
}

/* Preview Card Section */
.preview-section {
    position: sticky;
    top: 20px;
    height: fit-content;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
}

.preview-card {
    background: white;
    padding: 30px;
    border: 2px solid #000;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    font-size: 14px;
    line-height: 1.6;
}

/* Card Header */
.card-header {
    background: #000;
    padding: 20px 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

.header-top {
    text-align: center;
}

.company-name-small {
    font-size: 10px;
    margin-bottom: 8px;
    font-weight: normal;
    color: #bbb;
}

.header-title-row {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
}

.shop-name {
    font-size: 48px;
    font-weight: bold;
    letter-spacing: 4px;
    font-style: italic;
    transform: skewX(-8deg);
    display: inline-block;
    line-height: 1.2;
}

.shop-the {
    color: #444;
}

.shop-wheel {
    color: #ff3333;
    font-weight: 900;
}

.shop-shop {
    color: #444;
}

.location-name {
    font-size: 26px;
    font-style: italic;
    font-family: 'Brush Script MT', 'Lucida Handwriting', 'Segoe Script', cursive;
    font-weight: normal;
    color: #ff3333;
    text-align: right;
    padding-right: 30px;
    margin-top: -8px;
    position: relative;
}

.brands {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    font-size: 10px;
    margin-top: 12px;
}

.brands span {
    padding: 2px 6px;
    color: #fff;
}

/* Card Sections */
.card-section {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.card-section-flex {
    display: flex;
    gap: 30px;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #ddd;
}

.section-header {
    background: #000;
    color: white;
    padding: 8px 12px;
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 12px;
    text-align: center;
}

.info-row {
    display: flex;
    margin-bottom: 8px;
    padding: 4px 0;
}

.info-row.date-row {
    background: #f5f5f5;
    padding: 8px;
    border-radius: 4px;
    margin-bottom: 12px;
    font-weight: bold;
}

.date-value {
    font-weight: bold;
    color: #333;
}

.info-label {
    font-weight: bold;
    min-width: 120px;
    margin-right: 10px;
}

.info-value {
    flex: 1;
    border-bottom: 1px solid #000;
    min-height: 20px;
    padding-left: 5px;
}

/* Tables */
.table-container {
    margin-bottom: 20px;
}

.table-header {
    background: #000;
    color: white;
    padding: 6px 10px;
    font-weight: bold;
    font-size: 12px;
    margin-bottom: 8px;
    text-align: center;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 15px;
}

.preview-table thead {
    background: #000;
    color: white;
}

.preview-table th {
    padding: 8px 4px;
    font-size: 11px;
    font-weight: bold;
    text-align: center;
    border: 1px solid #000;
}

.preview-table td {
    padding: 6px 4px;
    font-size: 11px;
    text-align: center;
    border: 1px solid #000;
    min-height: 25px;
}

.preview-table tbody tr {
    min-height: 30px;
}

/* Wheel Alignment */
.alignment-section {
    flex: 1;
}

.alignment-options {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.alignment-label {
    font-weight: bold;
    font-size: 12px;
}

.checkbox-square {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid #000;
    text-align: center;
    line-height: 14px;
    font-size: 14px;
    font-weight: bold;
}

/* Car Diagram */
.car-diagram-section {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

.car-diagram {
    position: relative;
    width: 260px;
    height: 340px;
    margin: 0 auto;
}

.car-svg-container {
    position: relative;
    width: 260px;
    height: 340px;
    margin: 0 auto;
}

.car-front-label {
    text-align: center;
    font-size: 10px;
    font-weight: bold;
    margin-bottom: 8px;
}

.wheel-position {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: bold;
}

.wheel-lf {
    left: 10px;
    top: 60px;
}

.wheel-rf {
    right: 10px;
    top: 60px;
}

.wheel-lr {
    left: 10px;
    bottom: 80px;
}

.wheel-rr {
    right: 10px;
    bottom: 80px;
}

.wheel-spare {
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
}

/* Other Options */
.other-options {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
}

.other-option {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
}

.sales-person-section {
    margin-top: 20px;
    padding-top: 15px;
    border-top: 2px solid #000;
}

/* Responsive Design for iPad */
@media (max-width: 1024px) {
    .container {
        grid-template-columns: 1fr;
    }

    .preview-section {
        position: relative;
        top: 0;
        max-height: none;
    }

    .wheel-row {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .wheel-row .form-input.small {
        width: 100%;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .form-section, .preview-card {
        padding: 15px;
    }

    .shop-name {
        font-size: 28px;
    }

    .card-section-flex {
        flex-direction: column;
    }

    .car-diagram {
        width: 100%;
        max-width: 300px;
        margin: 0 auto;
    }
}

/* Print Styles */
@page {
    size: A4;
    margin: 5mm;
}

@media print {
    html, body {
        height: 100%;
        width: 100%;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }

    .form-section,
    .print-btn,
    .add-row-btn {
        display: none !important;
    }

    .container {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    .preview-section {
        position: static !important;
        max-height: none !important;
        overflow: visible !important;
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
    }

    .preview-card {
        zoom: 0.88;
        transform: none !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border: 2px solid #000;
        box-shadow: none !important;
        padding: 13px !important;
        box-sizing: border-box;
    }

    .card-header {
        padding: 8px;
        margin-bottom: 8px;
    }

    .shop-name {
        font-size: 35px;
    }

    .card-section,
    .card-section-flex {
        margin-bottom: 10px;
        padding-bottom: 6px;
        page-break-inside: avoid;
    }

    .card-section-flex {
        display: flex !important;
        flex-direction: row !important;
        align-items: flex-start !important;
        gap: 16px;
    }

    .alignment-section {
        flex: 1;
    }

    .car-diagram-section {
        flex: 1;
        display: flex;
        justify-content: center;
        align-items: flex-start;
        margin-top: 0;
    }

    .section-header {
        padding: 5px 8px;
        font-size: 12px;
        margin-bottom: 5px;
        background: #000 !important;
        color: #fff !important;
    }

    .info-row {
        margin-bottom: 3px;
        padding: 1px 0;
        font-size: 11px;
    }

    .info-value {
        min-height: 18px;
    }

    .table-container {
        margin-bottom: 8px;
    }

    .table-header {
        padding: 4px;
        font-size: 11px;
    }

    .preview-table th,
    .preview-table td {
        padding: 3px 2px;
        font-size: 10px;
        min-height: 18px;
    }

    .car-diagram-section {
        align-items: flex-start;
    }

    .car-diagram {
        transform: scale(0.96);
        transform-origin: top center;
        margin: 0 auto;
    }

    .other-options {
        gap: 13px;
    }

    .sales-person-section {
        margin-top: 11px;
        padding-top: 9px;
    }
}
