/* POS Order Editor Styles */

.pos-order-editor {
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #f8f9fa;
}

/* Header Bar - Sticky */
.pos-order-header-bar {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: white;
    border-bottom: 2px solid #e9ecef;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.order-number {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
}

.page-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #2c3e50;
}

.last-saved {
    font-size: 12px;
    color: #6c757d;
}

/* Editor Body */
.editor-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.editor-layout {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    margin-bottom: 20px;
}

.editor-main-area {
    min-height: 400px;
}

.editor-context-area {
    position: sticky;
    top: 20px;
    align-self: start;
}

/* Line Items Editor */
.line-items-editor {
    padding: 20px;
}

.line-items-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.line-items-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.empty-items {
    padding: 40px;
    text-align: center;
    color: #6c757d;
    border: 2px dashed #dee2e6;
    border-radius: 8px;
}

.line-items-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.line-item-card {
    padding: 15px;
    transition: box-shadow 0.2s;
}

.line-item-card:hover {
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.line-item-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.line-item-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.item-name-section {
    display: flex;
    align-items: center;
    gap: 10px;
}

.line-item-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.qty-price-controls {
    display: flex;
    align-items: center;
    gap: 15px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.line-total {
    font-size: 18px;
    font-weight: 600;
    color: #2c3e50;
    min-width: 100px;
    text-align: right;
}

.line-actions {
    display: flex;
    gap: 8px;
}

.line-notes {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    background-color: #f8f9fa;
    border-radius: 4px;
    font-size: 13px;
    color: #495057;
}

.notes-input {
    margin-top: 8px;
}

/* Context Panel */
.context-panel {
    padding: 20px;
}

.context-section {
    padding: 15px 0;
}

.context-section h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
}

.form-field {
    margin-bottom: 15px;
}

.flag-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

/* Totals Summary */
.totals-summary {
    padding: 20px;
    background-color: #f8f9fa;
    border: 1px solid #dee2e6;
}

.totals-summary h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    font-weight: 600;
}

.totals-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
}

.discount-row {
    color: #dc3545;
}

.total-final {
    border-top: 2px solid #dee2e6;
    padding-top: 12px;
    margin-top: 8px;
    font-size: 18px;
    font-weight: 600;
}

.total-label {
    font-size: 14px;
}

.total-value {
    font-weight: 500;
}

.totals-meta {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #dee2e6;
}

/* Actions Bar */
.actions-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background-color: white;
    border-top: 2px solid #e9ecef;
}

.actions-left,
.actions-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.validation-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background-color: #fff3cd;
    border-radius: 4px;
    color: #856404;
}

.validation-text {
    font-size: 14px;
}

/* Editor Footer */
.editor-footer {
    position: sticky;
    bottom: 0;
    z-index: 90;
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 20px;
    background-color: #f8f9fa;
    padding: 0 20px 20px 20px;
}

/* Confirm Dialog */
.pos-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pos-confirm-dialog {
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    min-width: 400px;
    max-width: 500px;
}

.confirm-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #dee2e6;
}

.confirm-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.confirm-body {
    padding: 20px;
}

.confirm-body p {
    margin: 0;
    color: #495057;
}

.confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #dee2e6;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .editor-layout {
        grid-template-columns: 1fr;
    }

    .editor-context-area {
        position: static;
    }

    .editor-footer {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .pos-order-header-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
    }

    .header-left,
    .header-right {
        justify-content: space-between;
    }

    .editor-body {
        padding: 10px;
    }

    .line-item-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .qty-price-controls {
        flex-wrap: wrap;
    }

    .actions-bar {
        flex-direction: column;
        gap: 10px;
    }

    .actions-left,
    .actions-right {
        width: 100%;
        justify-content: stretch;
    }
}
