/* ==================== MAIN APP STYLES ==================== */
* { 
    margin: 0; 
    padding: 0; 
    box-sizing: border-box; 
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; 
}
body { 
    background: #f4f6f9; 
    padding: 20px; 
    min-height: 100vh; 
    color: #333; 
}
.container { 
    max-width: 1200px; 
    margin: auto; 
    background: white; 
    border-radius: 16px; 
    overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.1); 
}
nav { 
    background: #1a3e72; 
    padding: 15px; 
    display: flex; 
    flex-wrap: wrap; 
    gap: 10px; 
    justify-content: center; 
}
nav button { 
    background: #2c5aa0; 
    color: white; 
    border: none; 
    padding: 12px 20px; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: bold; 
    transition: 0.3s; 
    font-size: 14px; 
}
nav button:hover, nav button.active { 
    background: #3b7dd8; 
    transform: translateY(-2px); 
}
.section { 
    display: none; 
    padding: 30px; 
}
.section.active { 
    display: block; 
}

/* Modal */
.modal { 
    display: none; 
    position: fixed; 
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%; 
    background: rgba(0,0,0,0.75); 
    z-index: 999; 
    justify-content: center; 
    align-items: center; 
}
.modal.active { 
    display: flex; 
}
.modal-content { 
    background: white; 
    width: 90%; 
    max-width: 700px; 
    max-height: 90vh; 
    border-radius: 16px; 
    overflow: hidden; 
    box-shadow: 0 20px 40px rgba(0,0,0,0.3); 
    overflow-y: auto; 
}
.modal-header { 
    background: #1a3e72; 
    color: white; 
    padding: 15px 20px; 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
}
.close { 
    background: none; 
    border: none; 
    color: white; 
    font-size: 28px; 
    cursor: pointer; 
}
.modal-body { 
    padding: 20px; 
}
.modal-body input, .modal-body select { 
    width: 100%; 
    padding: 12px; 
    margin: 8px 0; 
    border: 1px solid #ddd; 
    border-radius: 8px; 
    font-size: 15px; 
}
.modal-body button { 
    width: 100%; 
    padding: 12px; 
    background: #28a745; 
    color: white; 
    border: none; 
    border-radius: 8px; 
    font-weight: bold; 
    cursor: pointer; 
    margin-top: 10px; 
}

.item-row { 
    display: grid; 
    grid-template-columns: 2fr 1fr 1fr 1fr auto; 
    gap: 8px; 
    align-items: center; 
    padding: 10px; 
    background: #f8f9fa; 
    border-radius: 8px; 
    margin: 8px 0; 
}
.total-box { 
    background: #e3f2fd; 
    padding: 15px; 
    border-radius: 10px; 
    text-align: right; 
    font-weight: bold; 
    font-size: 18px; 
    margin: 15px 0; 
}

table { 
    width: 100%; 
    border-collapse: collapse; 
    margin: 20px 0; 
    font-size: 14px; 
}
th, td { 
    border: 1px solid #eee; 
    padding: 12px; 
    text-align: left; 
}
th { 
    background: #f8f9fa; 
    font-weight: 600; 
}
tr:hover { 
    background: #f1f3f5; 
}
.low-stock { 
    background: #ffebee !important; 
    color: #c62828; 
    font-weight: bold; 
}

.btn { 
    padding: 8px 14px; 
    border: none; 
    border-radius: 8px; 
    cursor: pointer; 
    font-weight: bold; 
    margin: 3px; 
    font-size: 13px; 
}
.btn-primary { 
    background: #007bff; 
    color: white; 
}
.btn-danger { 
    background: #dc3545; 
    color: white; 
}

.search-box { 
    margin: 15px 0; 
    display: flex; 
    gap: 10px; 
}
.search-box input, .search-box select { 
    flex: 1; 
    padding: 12px; 
    border: 1px solid #ddd; 
    border-radius: 8px; 
}

.stats-grid { 
    display: grid; 
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); 
    gap: 15px; 
    margin: 20px 0; 
}
.stat-box { 
    background: #e3f2fd; 
    padding: 20px; 
    border-radius: 12px; 
    text-align: center; 
}

.tables-grid { 
    display: flex; 
    gap: 20px; 
    margin-top: 30px; 
}
.tables-grid > div { 
    flex: 1; 
}

.firm-header { 
    text-align: center; 
    margin-bottom: 20px; 
    padding: 15px; 
    background: #1a3e72; 
    color: white; 
    border-radius: 12px; 
}
.firm-header img { 
    height: 60px; 
    margin-bottom: 10px; 
}
.firm-header h2 { 
    margin: 5px 0; 
    font-size: 22px; 
}
.firm-header button { 
    float: right; 
    margin-top: -50px; 
}

/* ==================== PRINT STYLES (80mm Thermal) ==================== */
#bill, #reportBill { 
    visibility: visible !important; 
    font-family: 'Courier New', monospace, sans-serif;
}

/* --- सिर्फ प्रिंट के लिए --- */
@media print {
    @page { 
        margin: 0; 
        size: 80mm auto; 
    }

    body > * { 
        visibility: hidden !important; 
    }

    #bill, #bill * { 
        visibility: visible !important; 
    }

    #bill {
        position: fixed !important;
        left: 0 !important;
        top: 0 !important;
        width: 80mm !important;
        max-width: 80mm !important;
        margin: 0 !important;
        padding: 10px !important;
        background: white !important;
        color: black !important;
        font-size: 11px !important;
        line-height: 1.4 !important;
        z-index: 99999 !important;
        display: block !important;
    }

    #bill img { 
        height: 40px; 
        display: block; 
        margin: 0 auto 8px; 
    }

    #bill h1 { 
        font-size: 18px; 
        margin: 0 0 4px; 
        color: #28a745; 
        font-weight: bold; 
        text-align: center; 
    }

    #bill table { 
        width: 100%; 
        margin: 10px 0; 
        font-size: 10px; 
        border-collapse: collapse; 
    }
    #bill th { 
        background: #e9ecef; 
        padding: 5px 3px; 
        text-align: center; 
        font-weight: bold; 
        border-bottom: 1px solid #28a745; 
    }
    #bill td { 
        padding: 5px 3px; 
        border-bottom: 1px dashed #ccc; 
    }
    #bill td:nth-child(2), #bill td:nth-child(3), #bill td:nth-child(4) { 
        text-align: right; 
    }

    .deduction-row { 
        display: flex; 
        justify-content: space-between; 
        font-size: 10px; 
        margin: 2px 0; 
    }
    .deduction-total { 
        border-top: 1px dashed #000; 
        padding-top: 4px; 
        font-weight: bold; 
        margin-top: 4px; 
    }

    .net-amount {
        background: #d4edda !important;
        color: #155724 !important;
        padding: 8px;
        border-radius: 6px;
        text-align: right;
        font-weight: bold;
        font-size: 14px;
        margin: 10px 0;
    }

    .signature-line {
        border-top: 1px solid #000;
        width: 45%;
        text-align: center;
        padding-top: 6px;
        font-size: 9px;
    }

    .thank-you { 
        text-align: center; 
        margin-top: 15px; 
        font-size: 9px; 
        font-style: italic; 
    }

    nav, .container, .modal, button, input, .section { 
        display: none !important; 
    }
}
