/* Ask Norma Dialog - Prefixed CSS to avoid conflicts */

/* Dialog Container */
.ask-norma-dialog-container {
    width: 95vw;
    max-width: 1400px;
    min-width: 1000px;
    height: 90vh;
    max-height: 850px;
    background-color: #f8f9fa;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.ask-norma-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    /*background: linear-gradient(135deg, #1a5d3a 0%, #2d7a4e 100%);*/
    background-color: #f8f9fa;
    color: black;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.ask-norma-header-left {
    display: flex;
    flex-direction: column;
    /*align-items: center;*/
    /*gap: 12px;*/
    gap:8px;
}

.ask-norma-header-icon {
    width: 20px;
    height: 20px;
    background: rgba(255,255,255,0.2);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-inline-end:6px;
}

.ask-norma-header-icon img {
    width: 20px;
    height: 20px;
    /*filter: brightness(0) invert(1);*/
}

.ask-norma-header-title {
    display: flex;
    flex-direction: column;
}

.ask-norma-title-text {
    font-size: 16px;
    font-weight: 600;
}

.ask-norma-subtitle-text {
    font-size: 12px;
    opacity: 0.85;
}

.ask-norma-close-btn {
    background: none;
    border: none;
    color: #7e7f7f;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.ask-norma-close-btn:hover {
    opacity: 1;
}

/* Zone Plan Bar */
.ask-norma-zone-plan-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.ask-norma-zone-plan-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ask-norma-zone-icon {
    color: #6c757d;
    font-size: 14px;
}

.ask-norma-zone-label {
    color: #6c757d;
    font-size: 13px;
}

.ask-norma-zone-name {
    font-weight: 600;
    font-size: 13px;
    color: #212529;
}

.ask-norma-zone-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-left: 16px;
}

.ask-norma-btn-zone-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: 12px;
    color: #495057;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.ask-norma-btn-zone-action:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.ask-norma-btn-zone-action i {
    font-size: 11px;
}

.ask-norma-btn-zone-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.ask-norma-btn-zone-action:disabled:hover {
    background: white;
    border-color: #dee2e6;
}

.ask-norma-btn-zone-action.ask-norma-btn-apply {
    background: #2e7d32;
    color: white;
    border-color: #2e7d32;
}

.ask-norma-btn-zone-action.ask-norma-btn-apply:hover {
    background: #1b5e20;
    border-color: #1b5e20;
}

.ask-norma-zone-plan-right {
    display: flex;
    align-items: center;
}

.ask-norma-orders-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: #e8f5e9;
    border-radius: 4px;
    font-size: 12px;
    color: #2e7d32;
}

.ask-norma-orders-badge i {
    font-size: 8px;
}

.ask-norma-orders-badge .ask-norma-count {
    font-weight: 600;
}

/* Info Bar */
.ask-norma-info-bar {
    display: flex;
    flex-direction: column;
    padding: 8px 16px;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
    flex-shrink: 0;
    gap: 4px;
}

.ask-norma-info-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ask-norma-info-right {
    color: #28a745;
    font-size: 12px;
}

.ask-norma-info-text {
    color: #6c757d;
    font-style: italic;
}

.ask-norma-order-summary {
    color: #495057;
}

.ask-norma-branch-count {
    color: #6c757d;
}

.ask-norma-ungrouped-badge {
    display: inline-flex;
    padding: 3px 10px;
    background: #fff3cd;
    color: #856404;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.ask-norma-zone-plan-info {
    color: #28a745;
}

/* Main Content */
.ask-norma-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Map Panel */
.ask-norma-map-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    border-right: 1px solid #e9ecef;
    min-width: 500px;
    position: relative;
}

.ask-norma-map-panel.ask-norma-hidden {
    display: none;
}

.ask-norma-empty-map {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #adb5bd;
}

.ask-norma-empty-map i {
    font-size: 48px;
    margin-bottom: 16px;
}

.ask-norma-map-legend {
    flex-shrink: 0;
    border-top: 1px solid #e9ecef;
}

/* Zone Editor Panel */
.ask-norma-zone-editor-panel {
    flex: 1;
    overflow: auto;
}

/* Orders Panel (Right Side) */
.ask-norma-orders-panel {
    width: 340px;
    min-width: 320px;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    background: #f8f9fa;
}

.ask-norma-orders-panel.ask-norma-hidden {
    display: none;
}

/* Order Scope Styles */
.ask-norma-order-scope {
    display: flex;
    flex-direction: column;
}

/* Orders Header */
.ask-norma-orders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.ask-norma-orders-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .ask-norma-orders-header-left i {
        color: #6c757d;
        font-size: 15px;
    }

.ask-norma-orders-title {
    font-weight: 600;
    font-size: 14px;
    color: #212529;
}

.ask-norma-orders-count-badge {
    background: #e8f5e9;
    color: #2e7d32;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.ask-norma-orders-header-right {
    display: flex;
    align-items: center;
    gap: 4px;
}

.ask-norma-view-btn {
    padding: 6px 8px;
    background: none;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    color: #6c757d;
    font-size: 12px;
}

.ask-norma-view-btn.ask-norma-active {
    background: #e9ecef;
    color: #212529;
}

.ask-norma-view-btn:hover {
    background: #f8f9fa;
}

/* Filter Row */
.ask-norma-filter-row {
    display: flex;
    align-items: center;
    padding: 8px 16px;
    border-bottom: 1px solid #e9ecef;
    font-size: 12px;
    flex-shrink: 0;
}

.ask-norma-filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    background: rgba(40, 167, 69, 0.1);
    color: #212529;
    border-radius: 12px;
    font-size: 11px;
    margin-right: 8px;
}

.ask-norma-filter-badge i {
    font-size: 10px;
}

.ask-norma-filter-count {
    font-weight: 600;
    margin-left: 4px;
}

/* Search Box */
.ask-norma-search-box {
    padding: 8px 16px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0;
}

.ask-norma-search-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
}

.ask-norma-search-input:focus {
    border-color: #80bdff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.1);
}

.ask-norma-search-input::placeholder {
    color: #adb5bd;
}

/* Expand/Collapse Links */
.ask-norma-expand-collapse-row {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    padding: 6px 16px;
    font-size: 12px;
    flex-shrink: 0;
}

.ask-norma-expand-collapse-row a {
    color: #007bff;
    text-decoration: none;
    cursor: pointer;
}

.ask-norma-expand-collapse-row a:hover {
    text-decoration: underline;
}

.ask-norma-expand-collapse-row span {
    color: #adb5bd;
}

/* Order List Container */
.ask-norma-order-list-container {
    flex: 0 1 auto;
    min-height: 50px;
}

/* Group Section */
.ask-norma-group-section {
    border-bottom: 1px solid #f1f5f9;
}

/* Zone Section (under groups) */
.ask-norma-zone-section {
    margin-left: 16px;
    border-left: 1px solid #e9ecef;
}

.ask-norma-zone-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
    color: #495057;
    transition: background-color 0.15s;
}

.ask-norma-zone-header:hover {
    background-color: #f8f9fa;
}

.ask-norma-zone-chevron {
    font-size: 10px;
    color: #adb5bd;
    width: 12px;
}

.ask-norma-zone-icon {
    font-size: 12px;
    color: #6c757d;
}

.ask-norma-zone-name {
    flex: 1;
    font-weight: 500;
}

.ask-norma-zone-count {
    font-size: 11px;
    color: #6c757d;
    background: #f1f5f9;
    padding: 1px 6px;
    border-radius: 8px;
}

.ask-norma-group-header {
    display: flex;
    align-items: center;
    padding: 10px 16px;
    cursor: pointer;
    transition: background-color 0.15s;
}

    .ask-norma-group-header:hover {
        background-color: rgba(40, 167, 69, 0.1);
    }

.ask-norma-group-chevron {
    color: #6c757d;
    font-size: 10px;
    margin-right: 8px;
    width: 12px;
}

.ask-norma-group-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 8px;
    flex-shrink: 0;
}

.ask-norma-group-name {
    flex: 1;
    font-size: 13px;
    color: #212529;
}

.ask-norma-group-count {
    background: #e9ecef;
    color: #495057;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
}

/* Zone Section */
.ask-norma-zone-section {
    margin-left: 24px;
    border-left: 2px solid #e9ecef;
}

.ask-norma-zone-header {
    display: flex;
    align-items: center;
    padding: 6px 12px;
    cursor: pointer;
    font-size: 12px;
}

.ask-norma-zone-header:hover {
    background-color: #f8f9fa;
}

/* Order Row */
.ask-norma-order-row {
    padding: 8px 16px 8px 40px;
    border-bottom: 1px solid #f8f9fa;
    transition: background-color 0.15s;
}

.ask-norma-order-row:hover {
    background-color: #f8f9fa;
}

.ask-norma-order-reference {
    font-family: monospace;
    font-size: 12px;
    color: #212529;
}

.ask-norma-order-details {
    font-size: 11px;
    color: #6c757d;
    margin-top: 2px;
    display: flex;
    gap: 8px;
}

.ask-norma-order-zone {
    color: #adb5bd;
}

/* Compact View */
.ask-norma-compact-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 16px;
}

.ask-norma-compact-item {
    padding: 4px 8px;
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.ask-norma-compact-item:hover {
    background: #e9ecef;
    border-color: #dee2e6;
}

.ask-norma-compact-code {
    font-family: monospace;
    font-size: 11px;
    color: #212529;
}

/* Highlight Styles */
.ask-norma-highlight-primary {
    background-color: rgba(40, 167, 69, 0.1) !important;
}

.ask-norma-highlight-related {
    background-color: rgba(40, 167, 69, 0.05) !important;
}

/* Working Sets Section */
.ask-norma-working-sets-section {
    border-top: 1px solid #e9ecef;
}

.ask-norma-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    cursor: pointer;
}

.ask-norma-section-header:hover {
    background-color: #f8f9fa;
}

.ask-norma-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 13px;
}

.ask-norma-section-title i {
    color: #6c757d;
    font-size: 14px;
}

.ask-norma-section-chevron {
    color: #6c757d;
    font-size: 12px;
}

.ask-norma-section-content {
    padding: 12px 16px;
    background-color: #fff;
    border-radius: 6px;
    border: 1px solid #ccc;
    margin-inline: 1.0rem;
}

.ask-norma-empty-section-text {
    color: #adb5bd;
    font-size: 12px;
    padding: 8px 0;
}

/* Planning Parameters Section */
.ask-norma-planning-params-section {
    border-top: 1px solid #e9ecef;
    padding-bottom: 16px;
}

.ask-norma-params-subtitle {
    font-size: 11px;
    color: #6c757d;
    padding: 0 16px 8px;
}

.ask-norma-param-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 16px;
}

.ask-norma-param-label {
    font-size: 12px;
    color: #495057;
}

.ask-norma-param-label.ask-norma-disabled {
    color: #adb5bd;
}

.ask-norma-param-value {
    font-size: 12px;
}

.ask-norma-param-select {
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    min-width: 140px;
}

.ask-norma-param-toggle {
    display: flex;
    align-items: center;
}

.ask-norma-param-input {
    padding: 4px 8px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 12px;
    background: white;
}

.ask-norma-datetime-picker {
    display: flex;
    gap: 8px;
}

.ask-norma-section-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ask-norma-modified-badge {
    font-size: 10px;
    color: #e67e22;
    background: #fef5e7;
    padding: 2px 8px;
    border-radius: 10px;
    border: 1px solid #f5d7a8;
    font-weight: 500;
}

.ask-norma-param-actions-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px 4px;
}

.ask-norma-param-action {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #6c757d;
    cursor: pointer;
    text-decoration: none;
}

.ask-norma-param-action:hover {
    color: #495057;
    text-decoration: none;
}

.ask-norma-param-action i {
    font-size: 11px;
}

/* Run Options Section */
.ask-norma-run-options-section {
    border-top: 1px solid #e9ecef;
    padding-bottom: 16px;
}

.ask-norma-run-option-group {
    padding: 8px 16px;
}

.ask-norma-run-option-label {
    font-size: 12px;
    color: #495057;
    margin-bottom: 6px;
}

.ask-norma-run-option-select {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    font-size: 13px;
    background: white;
    margin-bottom: 4px;
}

.ask-norma-run-option-description {
    font-size: 11px;
    color: #6c757d;
}

.ask-norma-run-option-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 10px 16px;
    gap: 12px;
}

.ask-norma-run-option-text {
    flex: 1;
}

.ask-norma-run-option-title {
    font-size: 12px;
    color: #212529;
    font-weight: 500;
    margin-bottom: 2px;
}

.ask-norma-run-option-subtitle {
    font-size: 11px;
    color: #6c757d;
    line-height: 1.3;
}

/* Footer */
.ask-norma-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
    flex-shrink: 0;
}

.ask-norma-footer-left {
    font-size: 13px;
    color: #495057;
}

.ask-norma-footer-right {
    display: flex;
    gap: 8px;
}

.ask-norma-btn-cancel {
    padding: 8px 20px;
    font-size: 13px;
    color: #495057;
    background: white;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.ask-norma-btn-cancel:hover {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.ask-norma-btn-run {
    padding: 8px 20px;
    font-size: 13px;
    color: white;
    background: linear-gradient(135deg, #28a745 0%, #218838 100%);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.15s;
}

.ask-norma-btn-run:hover:not(:disabled) {
    background: linear-gradient(135deg, #218838 0%, #1e7e34 100%);
}

.ask-norma-btn-run:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Map Component Styles */
.ask-norma-map-wrapper {
    flex: 1;
    position: relative;
    min-height: 300px;
}

.ask-norma-map-container {
    width: 100%;
    height: 100%;
}

.ask-norma-task-view-toggle {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    display: flex;
    background: white;
    border-radius: 4px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.15);
    overflow: hidden;
}

.ask-norma-task-toggle-btn {
    padding: 6px 12px;
    font-size: 11px;
    border: none;
    background: white;
    color: #495057;
    cursor: pointer;
    transition: all 0.15s;
}

.ask-norma-task-toggle-btn:first-child {
    border-right: 1px solid #e9ecef;
}

.ask-norma-task-toggle-btn.ask-norma-active {
    background: #28a745;
    color: white;
}

.ask-norma-task-toggle-btn:hover:not(.ask-norma-active) {
    background: #f8f9fa;
}

/* Legend Component */
.ask-norma-legend {
    padding: 8px 16px;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    gap: 16px;
    font-size: 12px;
}

.ask-norma-legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background-color 0.15s;
}

.ask-norma-legend-item:hover {
    background: #e9ecef;
}

.ask-norma-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.ask-norma-legend-text {
    color: #495057;
}

.ask-norma-legend-count {
    color: #6c757d;
}

/* Scrollbar */
.ask-norma-order-list-container::-webkit-scrollbar,
.ask-norma-orders-panel::-webkit-scrollbar {
    width: 6px;
}

.ask-norma-order-list-container::-webkit-scrollbar-track,
.ask-norma-orders-panel::-webkit-scrollbar-track {
    background: #f1f5f9;
}

.ask-norma-order-list-container::-webkit-scrollbar-thumb,
.ask-norma-orders-panel::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.ask-norma-order-list-container::-webkit-scrollbar-thumb:hover,
.ask-norma-orders-panel::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Leaflet overrides */
.ask-norma-map-container .leaflet-popup-content-wrapper {
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

.ask-norma-map-container .leaflet-popup-content {
    margin: 10px 12px;
    font-size: 12px;
}

/* Run Summary */
.ask-norma-run-summary {
    font-size: 13px;
    color: #495057;
}
