:root {
    --primary-color: #667eea;
    --secondary-color: #764ba2;
    --accent-color: #e53e3e;
}

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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    min-height: 100vh;
    padding: 20px;
}

.main-container {
    max-width: 1000px;
    margin: 0 auto;
}

.header {
    text-align: center;
    color: white;
    margin-bottom: 20px;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.header p {
    font-size: 1.1rem;
    opacity: 0.9;
}

.control-panel, .product-list, .labels-preview {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.1);
}

.panel-title {
    font-size: 1.5rem;
    color: var(--primary-color);
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.form-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.form-row .form-group {
    flex: 1;
    min-width: 150px;
}

.form-row .form-group[style*="flex: 0.5"] {
    flex: 0 0 calc(12% - 10px);
    min-width: 70px;
}

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

label {
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 5px;
}

input, select {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.3s;
}

input:focus, select:focus {
    outline: none;
    border-color: var(--primary-color);
}

input.valid {
    border-color: #38a169;
    background-color: #f0fff4;
}

input.invalid {
    border-color: #e53e3e;
    background-color: #fff5f5;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    font-size: 14px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
    color: white;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
}

.btn-danger {
    background: var(--accent-color);
    color: white;
}

.btn-danger:hover {
    background: #c53030;
}

.product-item {
    background: #f7fafc;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.product-info {
    flex: 1;
}

.product-name {
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.product-details {
    font-size: 0.9rem;
    color: #718096;
}

.labels-table {
    width: 210mm;
    border-collapse: collapse;
    margin: 0 auto;
}

.labels-table td {
    border: 1px solid #e2e8f0;
    padding: 0;
    text-align: center;
    vertical-align: middle;
}

.label-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    font-size: 10px;
}

.label-header {
    flex: 1;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    padding: 3px;
    background: #f7fafc;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.product-name-bold {
    font-weight: bold;
    font-size: 1.4em;
}

.package-size-normal {
    font-weight: normal;
}

.label-row {
    flex: 3;
    display: flex;
}

.label-cell {
    padding: 2px;
    text-align: center;
    font-weight: bold;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    border-right: 1px solid #ccc;
}

.label-cell:last-child {
    border-right: none;
}

.price-wrapper {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.label-cell.discount-percent {
    flex: 0 0 20px;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    transform: rotate(180deg);
    font-size: 1.2em;
    color: #e53e3e;
    justify-content: center;
    align-items: center;
}

.label-cell.price-details {
    flex: 1;
}

.drs-text {
    text-align: center;
    font-size: 0.8em;
    padding: 2px 0;
    flex-shrink: 0;
    color: #000000;
}

.unit-rate-text {
    color: #000000;
    font-weight: bold;
    font-size: 0.9em;
}

/* Akcios cimke stilusok */
.promo-label-row {
    flex: 3;
    display: flex;
    gap: 5px;
}

.promo-price-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 5px;
    position: relative;
}

.promo-price-label {
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 5px;
    color: #000000;
}

.promo-unit-label {
    font-size: 0.7em;
    font-weight: 500;
    margin-top: 2px;
    color: #000000;
}

.promo-price-value {
    font-size: 3.5em;
    font-weight: bold;
    color: #000000;
}

.promo-new-price .promo-price-label {
    color: #000000;
}

.promo-new-price .promo-price-value {
    color: #000000;
    font-size: 3.8em;
}

.promo-old-price {
    position: relative;
}

.promo-old-price-strikethrough {
    position: relative;
    display: inline-block;
}

.promo-old-price-strikethrough::after {
    content: '';
    position: absolute;
    left: -10%;
    bottom: 0;
    width: 120%;
    height: 100%;
    border-bottom: 3px solid #e53e3e;
    transform: rotate(-15deg);
    transform-origin: left bottom;
}

.label-cell:first-child {
    background: white;
}

.columns-info {
    background: #e6fffa;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 15px;
    text-align: center;
    font-weight: 600;
    color: #234e52;
}

.vat-slider-left {
    left: 1px !important;
    right: auto !important;
}

.vat-slider-right {
    right: 1px !important;
    left: auto !important;
}

@media print {
    * {
        -webkit-print-color-adjust: exact !important;
        print-color-adjust: exact !important;
    }
    html, body {
        background: white !important;
        background-image: none !important;
        padding: 0;
        margin: 0;
    }
    .control-panel, .product-list, .header {
        display: none !important;
    }
    .labels-preview {
        background: white !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        padding: 0 !important;
    }
    .labels-preview .panel-title {
        display: none !important;
    }
    .labels-table {
        border: none;
        page-break-inside: avoid;
        width: 297mm;
        background: white !important;
    }
    .labels-table td {
        border: 2px dashed #999 !important;
        background: white !important;
    }
    .label-content {
        background: white !important;
    }
    .label-header {
        border-bottom: 1px solid #ccc !important;
        background: white !important;
    }
    .label-row {
        border-bottom: 1px solid #ccc !important;
        background: white !important;
    }
    .label-cell {
        border-right: 1px solid #ccc !important;
        background: white !important;
    }
    .label-cell:first-child {
        background: white !important;
    }
    .label-cell:last-child {
        border-right: none !important;
    }

    /* Fekvo tajolas */
    @page {
        size: A4 landscape;
        margin: 5mm;
    }
}

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

    .main-container { max-width: 100%; }

    .header h1 { font-size: 2rem; }
    .header p { font-size: 1rem; }

    .control-panel, .product-list, .labels-preview {
        padding: 15px;
        margin-bottom: 15px;
    }

    .form-row {
        flex-direction: column;
        gap: 10px;
    }

    .form-row .form-group {
        flex: 1 !important;
        min-width: auto !important;
    }

    .form-row .form-group[style*="flex: 0.5"] {
        flex: 1 !important;
        min-width: auto !important;
    }

    .product-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .product-actions {
        display: flex;
        gap: 5px;
        flex-wrap: wrap;
    }

    .labels-table {
        width: 100%;
        font-size: 8px;
        transform: scale(0.8);
        transform-origin: top left;
    }

    .btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .header h1 { font-size: 1.8rem; }

    .control-panel, .product-list, .labels-preview {
        padding: 10px;
        margin-bottom: 10px;
    }

    .panel-title { font-size: 1.3rem; }

    .labels-table {
        transform: scale(0.6);
    }
}

/* Calculator section styling */
.calculator-section {
    transition: all 0.3s ease;
}

.calculator-section h3 {
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

#toggleSecondDiscountBtn, #addDiscountBtn {
    transition: all 0.3s ease !important;
}

#toggleSecondDiscountBtn:hover, #addDiscountBtn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4) !important;
}

#removeDiscountBtn:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 20px rgba(229, 62, 62, 0.4) !important;
}

/* Mobile responsiveness for calculator sections */
@media (max-width: 768px) {
    .calculator-section {
        padding: 10px;
        margin-bottom: 10px;
    }

    .calculator-section div[style*="display: flex"] {
        flex-direction: column !important;
        gap: 10px !important;
    }
}
