/* ===============================================
   BMS Rēķinu Sistēma - Galvenie Stili
=============================================== */

body { 
    background-color: #525659; 
    min-height: 100vh; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    padding-top: 20px; 
}

/* Augšējā rīkjosla (peldoša) */
.toolbar {
    position: fixed;
    top: 20px;
    background: rgba(255, 255, 255, 0.95);
    padding: 10px 20px;
    border-radius: 50px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    display: flex;
    gap: 10px;
    backdrop-filter: blur(5px);
}

/* A4 Lapas stils - Galvenais darba lauks */
.invoice-page {
    background: white;
    width: 210mm;
    min-height: 297mm;
    padding: 20mm;
    margin: 60px auto 40px;
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
    font-family: 'Arial', sans-serif;
    color: #333;
    position: relative;
    box-sizing: border-box;
    overflow: hidden;
}

/* Ūdenszīme Demo versijai */
.watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-45deg);
    font-size: 100px;
    color: rgba(255, 0, 0, 0.1);
    pointer-events: none;
    white-space: nowrap;
    z-index: 0;
    font-weight: bold;
    display: none;
}

/* Ievades lauki, kas izskatās kā teksts */
.editable-input {
    border: 1px dashed #ccc;
    background: transparent;
    padding: 2px 5px;
    border-radius: 3px;
    width: 100%;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
    transition: border 0.2s;
}

.editable-input:hover, 
.editable-input:focus {
    border: 1px solid #007bff;
    background: rgba(0, 123, 255, 0.05);
    outline: none;
}

/* Speciāli stili tabulai */
.items-table th { 
    background: #2c3e50; 
    color: white; 
    padding: 10px; 
    font-weight: normal; 
}

.items-table td { 
    padding: 5px; 
    border-bottom: 1px solid #eee; 
    vertical-align: middle; 
}

.items-table input { 
    border: none; 
    width: 100%; 
    padding: 5px; 
}

.items-table input:hover, 
.items-table input:focus { 
    background: #f8f9fa; 
}

/* Paslēptās pogas uz lapas (piem. dzēst rindu) */
.row-action { 
    opacity: 0; 
    transition: opacity 0.2s; 
}

.items-table tr:hover .row-action { 
    opacity: 1; 
}

/* Drukāšanas stili */
@media print {
    @page { 
        size: A4; 
        margin: 0; 
    }
    
    body { 
        background: white; 
        padding: 0; 
        margin: 0; 
        display: block; 
    }
    
    .toolbar, 
    .no-print, 
    .row-action, 
    .btn-add-row { 
        display: none !important; 
    }
    
    .invoice-page { 
        width: 210mm; 
        height: auto !important;
        min-height: 297mm; 
        margin: 0; 
        padding: 20mm 20mm 30mm 20mm;
        box-shadow: none; 
        box-sizing: border-box; 
        position: relative;
    }

    .invoice-footer {
        margin-top: 20px;
        text-align: center;
        color: #999;
        font-size: 11px;
        border-top: 1px solid #eee;
        padding-top: 10px;
    }

    .totals-section {
        page-break-inside: avoid;
        break-inside: avoid;
        margin-top: 20px;
    }

    thead { 
        display: table-header-group; 
    }
    
    tr { 
        page-break-inside: avoid; 
        break-inside: avoid; 
    }

    .editable-input { 
        border: none !important; 
        padding: 0; 
        background: transparent !important; 
    }
    
    input::placeholder { 
        color: transparent; 
    }
    
    select { 
        appearance: none; 
        border: none; 
        background: transparent; 
        padding: 0; 
    }
}

/* Mobilā pielāgošana */
@media screen and (max-width: 800px) {
    .toolbar {
        top: 0;
        left: 0;
        right: 0;
        border-radius: 0;
        flex-wrap: wrap;
        justify-content: center;
        padding: 10px;
        position: sticky;
    }
    
    body {
        padding-top: 0;
        align-items: flex-start;
    }

    .invoice-page {
        margin: 20px auto;
        transform-origin: top center;
    }
}
