:root {
    --primary-color: #007bff;
    --bg-color: #f4f6f9;
    --card-bg: #ffffff;
    --text-color: #333;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-color);
    margin: 0;
    padding: 0;
    color: var(--text-color);
    /* Prevent zoom on double tap */
    touch-action: manipulation;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 20px;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 220px;
    background: #15202b;
    color: #fff;
    padding: 20px 15px;
    box-sizing: border-box;
}

.sidebar-title {
    font-size: 18px;
    font-weight: bold;
    margin-bottom: 4px;
}

.sidebar-sub {
    font-size: 12px;
    color: #c0c7d1;
    margin-bottom: 15px;
}

.side-nav {
    list-style: none;
    padding: 0;
    margin: 0;
}

.side-nav li {
    margin-bottom: 6px;
}

.side-link {
    display: block;
    padding: 8px 10px;
    border-radius: 4px;
    color: #e1e5ea;
    text-decoration: none;
    font-size: 14px;
}

.side-link:hover {
    background: rgba(255,255,255,0.08);
}

.side-link.active {
    background: #007bff;
    color: #fff;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
}

.card {
    background: var(--card-bg);
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 25px; /* More padding */
    margin-bottom: 25px;
}

.header {
    margin-bottom: 20px;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 20px;
    background: #ffffff;
    border-radius: 8px;
    padding: 10px 15px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    width: 100%;
    box-sizing: border-box;
}

.page-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.page-header-title h2 {
    margin: 0;
}

.page-header-title p {
    margin: 4px 0 0 0;
    font-size: 0.95em;
    color: #555;
}

.page-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9em;
}

.sidebar-toggle-btn {
    border: none;
    background: transparent;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #333;
    padding: 0;
}

.sidebar-toggle-btn .icon {
    font-size: 20px;
    line-height: 1;
}

body.sidebar-hidden .sidebar {
    display: none;
}

.app-footer {
    text-align: center;
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #ddd;
    font-size: 12px;
    color: #666;
}

.receipt {
    font-size: var(--receipt-body-px, 14px);
}
.receipt-items th,
.receipt-items td {
    font-size: inherit;
    padding: 2px 4px !important;
}
.receipt-items tr {
    line-height: 1.2;
}
.receipt-header {
    margin-bottom: 3px;
}
.receipt-header h3 {
    font-size: var(--receipt-heading-px, 18px);
    margin: 0 0 2px 0;
}
.receipt-header p {
    margin: 0 0 1px 0 !important;
    line-height: 1.1;
}
.receipt-footer {
    margin-top: 3px;
}
.total-line {
    margin: 1px 0;
    line-height: 1.1;
}
.receipt-items {
    margin: 2px 0;
}
body.receipt-bold .receipt {
    font-weight: 700;
}
body.font-default .receipt {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
body.font-arial .receipt {
    font-family: Arial, Helvetica, sans-serif;
}
body.font-courier .receipt {
    font-family: "Courier New", Courier, monospace;
}

.btn {
    display: inline-block;
    padding: 8px 16px; /* Reduced from 12px 24px */
    background-color: var(--primary-color);
    color: white;
    text-decoration: none;
    border-radius: 4px; /* Reduced radius */
    border: none;
    cursor: pointer;
    font-size: 16px; /* Reduced from 18px */
    margin: 5px; /* Reduced margin */
    min-height: 36px; /* Reduced touch target size */
    box-sizing: border-box;
    transition: background-color 0.2s;
}

.btn:active {
    opacity: 0.8;
    transform: scale(0.98);
}

.btn-danger {
    background-color: #dc3545;
}

.btn-secondary {
    background-color: #6c757d;
}

.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
    font-size: 16px;
}

input[type="text"], input[type="number"], select {
    width: 100%;
    padding: 8px; /* Reduced padding */
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-size: 16px; /* Reduced font */
    min-height: 36px; /* Reduced height */
}

input:focus, select:focus {
    border-color: var(--primary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.25);
}

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

table, th, td {
    border: 1px solid #ddd;
}

th, td {
    padding: 8px; /* Reduced table cells */
    text-align: left;
    font-size: 14px; /* Reduced font */
}

th {
    background-color: #f8f9fa;
}

/* Side Floating Numpad */
.numpad-overlay {
    position: fixed;
    top: 50%;
    right: 10px;
    bottom: auto;
    left: auto;
    width: 260px; /* Fixed width for side panel */
    background: #fff;
    box-shadow: -2px 2px 10px rgba(0,0,0,0.2);
    z-index: 1000;
    transform: translateY(-50%) translateX(120%); /* Start hidden to right */
    transition: transform 0.3s ease-out;
    padding: 10px;
    border-radius: 8px;
    border: 1px solid #ddd;
}

.numpad-overlay.active {
    transform: translateY(-50%) translateX(0);
}

.numpad-header {
    padding: 5px 10px;
    margin-bottom: 5px;
    background: transparent;
    border-bottom: 1px solid #eee;
}

.numpad-grid {
    grid-template-columns: repeat(4, 1fr); /* 4 columns for calculator layout */
    gap: 5px;
    padding: 0;
    max-width: 100%;
}

.numpad-btn {
    padding: 10px; /* Smaller buttons */
    font-size: 18px;
    border-radius: 4px;
}

.numpad-btn:active {
    background: #eee;
}

.numpad-btn.confirm {
    background: var(--primary-color);
    color: white;
}

/* Floating Toggle Button */
.fab-btn {
    position: fixed;
    right: 20px;
    bottom: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    border: none;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    z-index: 999;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s;
}

.fab-btn:active {
    transform: scale(0.9);
}

.fab-btn.active {
    background: #28a745;
}

/* Customer Section */
.customer-section {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

@media print {
    body * {
        visibility: hidden;
    }
    #printableArea, #printableArea * {
        visibility: visible;
    }
    #printableArea {
        display: block !important;
        position: absolute;
        left: 0;
        top: 0;
        width: 100%;
    }
    .no-print {
        display: none !important;
    }
    body.print-80mm #printableArea .receipt {
        width: 80mm;
        margin: 0 auto;
    }
    body.print-58mm #printableArea .receipt {
        width: 58mm;
        margin: 0 auto;
    }
    .receipt-header {
        text-align: center;
    }
    #printableArea .receipt,
    #printableArea .receipt * {
        color: #000 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    body.show-lines .receipt-items,
    body.show-lines .receipt-items th,
    body.show-lines .receipt-items td {
        border: 1px solid #000 !important;
        border-collapse: collapse;
    }
    .receipt-items th,
    .receipt-items td {
        padding: 2px 4px !important;
        line-height: 1.2 !important;
    }
    .receipt-header p {
        margin: 0 0 2px 0 !important;
        line-height: 1.2 !important;
    }
    .receipt-header h3 {
        margin: 0 0 3px 0 !important;
    }
    .receipt-footer {
        margin-top: 5px !important;
    }
    .total-line {
        margin: 2px 0 !important;
        line-height: 1.2 !important;
    }
    #printableArea .receipt {
        border: 2px solid #000 !important;
        padding: 5px !important;
        box-sizing: border-box !important;
    }
}
