/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* Header and navigation */
.navbar {
    background-color: #2c3e50;
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.navbar h1 {
    display: inline-block;
    font-size: 1.5rem;
}

.nav-links {
    float: right;
    list-style: none;
    margin-top: 5px;
}

.nav-links li {
    display: inline;
    margin-left: 20px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s;
}

.nav-links a:hover {
    opacity: 0.8;
}

/* Dropdown menu styles */
.dropdown {
    position: relative;
}

.dropdown-toggle {
    cursor: pointer;
}

.dropdown-toggle::after {
    content: ' ▼';
    font-size: 0.8em;
}

.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #34495e;
    list-style: none;
    padding: 0;
    margin: 0;
    min-width: 150px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    border-radius: 4px;
    display: none;
    z-index: 1000;
}

.dropdown:hover .dropdown-menu {
    display: block;
}

.dropdown-menu li {
    display: block;
    margin: 0;
}

.dropdown-menu a {
    display: block;
    padding: 10px 15px;
    color: white;
    text-decoration: none;
    transition: background-color 0.3s;
}

.dropdown-menu a:hover {
    background-color: #2c3e50;
    opacity: 1;
}

/* User menu positioning */
.user-menu {
    margin-left: auto;
}

.user-menu .dropdown-menu {
    right: 0;
    left: auto;
}

/* Main content */
main {
    min-height: calc(100vh - 140px);
    padding: 2rem 0;
    overflow-x: hidden; /* Prevent horizontal overflow */
}

/* Alerts */
.alert {
    padding: 1rem;
    margin-bottom: 1rem;
    border-radius: 4px;
}

.alert-success {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Buttons */
.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #2980b9;
}

.btn-primary {
    background-color: #27ae60;
}

.btn-primary:hover {
    background-color: #229954;
}

.btn-secondary {
    background-color: #95a5a6;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-info {
    background-color: #3498db;
}

.btn-info:hover {
    background-color: #2980b9;
}

.btn-sm {
    padding: 0.25rem 0.5rem;
    font-size: 0.875rem;
}

/* Tables */
table {
    width: 100%;
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

th, td {
    padding: 1rem;
    text-align: left;
    border-bottom: 1px solid #e0e0e0;
}

th {
    background-color: #f8f9fa;
    font-weight: 600;
}

tr:last-child td {
    border-bottom: none;
}

.empty {
    text-align: center;
    color: #666;
    padding: 2rem;
}

/* Dashboard */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

.page-header h2 {
    font-size: 2rem;
}

.actions {
    white-space: nowrap;
}

.actions .btn {
    margin-left: 0.5rem;
}

/* Forms */
.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.form-group input.readonly {
    background-color: #f8f9fa;
}

.form-header {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
}

/* Form section */
.form-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.form-row {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

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

/* Batch section */
.batch-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.batch-controls {
    margin-bottom: 1rem;
}

.batch-controls .btn {
    margin-right: 0.5rem;
}

.batch-table-wrapper {
    overflow-x: auto;
}

.batch-table input,
.batch-table select {
    width: 100%;
    padding: 0.25rem;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.batch-table th {
    font-size: 0.875rem;
    white-space: nowrap;
}

/* Totals section */
.totals-section {
    background-color: white;
    padding: 1.5rem;
    border-radius: 8px;
    margin-bottom: 2rem;
}

.unit-totals {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.unit-total {
    background-color: #f8f9fa;
    padding: 0.75rem 1.5rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Form actions */
.form-actions {
    text-align: center;
    margin-top: 2rem;
}

.form-actions .btn {
    margin: 0 0.5rem;
}

/* Report view */
.report-view {
    background-color: white;
    padding: 2rem;
    border-radius: 8px;
}

.report-header {
    border-bottom: 2px solid #e0e0e0;
    padding-bottom: 1rem;
    margin-bottom: 2rem;
}

.report-info {
    margin-top: 1rem;
}

.report-info p {
    margin-bottom: 0.5rem;
}

.report-table .qr-code {
    width: 80px;
    height: 80px;
    display: block;
    margin: 0 auto;
}

.qr-code-large {
    width: 150px;
    height: 150px;
}

.report-header {
    position: relative;
    overflow: hidden;
    min-height: 180px;
}

.report-header h2 {
    margin-bottom: 20px;
}

.report-qr {
    float: right;
    text-align: center;
    margin: 0 0 20px 20px;
    width: 180px;
}

.report-qr h3 {
    font-size: 14px;
    margin-bottom: 10px;
}

.delivery-no {
    display: none; /* Hide since we show it in order field */
}

.totals-row {
    background-color: #f8f9fa;
    font-weight: bold;
}

.report-actions {
    margin-top: 2rem;
    text-align: center;
}

.report-actions .btn {
    margin: 0 0.5rem;
}

/* Print styles */
@media print {
    .navbar, .report-actions, footer, .alert {
        display: none !important;
    }
    
    main {
        padding: 0;
    }
    
    .report-view {
        box-shadow: none;
        padding: 0;
    }
}

/* Keyboard shortcuts guide */
.keyboard-shortcuts-guide {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    padding: 20px;
    max-width: 300px;
    z-index: 1100;
}

.keyboard-shortcuts-guide h5 {
    margin-top: 0;
    margin-bottom: 15px;
    color: #495057;
}

.keyboard-shortcuts-guide ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.keyboard-shortcuts-guide li {
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.keyboard-shortcuts-guide kbd {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 3px;
    padding: 2px 6px;
    font-family: monospace;
    font-size: 0.85em;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
}

.keyboard-shortcuts-guide .tip {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
    font-size: 0.9em;
    color: #6c757d;
}

.batch-dropdown-help {
    display: block;
    margin-top: 4px;
    color: #6c757d;
    font-size: 0.875rem;
}

.batch-dropdown-help i {
    margin-right: 4px;
}

/* Footer */
footer {
    background-color: #2c3e50;
    color: white;
    text-align: center;
    padding: 1rem 0;
    margin-top: 4rem;
}