/* Standards Selector Styles */

.or-standards-container {
    width: 100%;
}

.or-standards-intro {
    margin: 0 0 15px 0;
    color: #646970;
    font-size: 14px;
}

/* Search */
.or-standards-search {
    margin-bottom: 15px;
    position: relative;
}

.or-standards-search-input {
    width: 100%;
    padding: 8px 40px 8px 12px;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 4px;
}

.or-standards-search-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.or-standards-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    background: #999;
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    padding: 0;
}

.or-standards-search-clear:hover {
    background: #666;
}

.or-standards-search-clear.visible {
    display: flex;
}

/* Tabs */
.or-standards-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    border-bottom: 2px solid #e0e0e0;
}

.or-standards-tab {
    padding: 10px 15px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
    color: #646970;
}

.or-standards-tab:hover {
    background: #f7f7f7;
    color: #2271b1;
}

.or-standards-tab.active {
    border-bottom-color: #2271b1;
    color: #2271b1;
    font-weight: 600;
}

/* Standards List */
.or-standards-list {
    max-height: 400px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    background: #fafafa;
    margin-bottom: 20px;
}

.or-standard-item {
    display: flex;
    align-items: flex-start;
    padding: 8px;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.or-standard-item:hover {
    border-color: #2271b1;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.or-standard-item.hidden {
    display: none;
}

.or-standard-checkbox {
    margin-right: 12px;
    margin-top: 4px;
    cursor: pointer;
    flex-shrink: 0;
}

/* Obowiązkowy checkbox (tylko dla zaawansowanych) */
.or-standard-checkbox.or-advanced-field:not(.or-advanced-editable) {
    pointer-events: none;
    opacity: 0.6;
}

body.or-advanced-mode .or-standard-checkbox.or-advanced-field {
    pointer-events: auto;
    opacity: 1;
}

.or-standard-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    flex: 1;
}

.or-standard-type-badge {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    flex-shrink: 0;
}

.or-standard-type-a {
    background: #e8f5e9;
    color: #2e7d32;
}

.or-standard-type-b {
    background: #e3f2fd;
    color: #1565c0;
}

.or-standard-type-c {
    background: #fff3e0;
    color: #e65100;
}

.or-standard-reference {
    font-weight: 600;
    color: #2271b1;
    flex-shrink: 0;
    width: 250px;
    min-width: 250px;
}

.or-standard-title {
    color: #50575e;
    flex: 1;
    min-width: 200px;
}

.or-standard-withdrawn-badge {
    background: #fff3cd;
    color: #856404;
    padding: 3px 8px;
    border-radius: 3px;
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
}

/* Empty state */
.or-standards-empty {
    text-align: center;
    padding: 40px 20px;
    color: #646970;
}

.or-standards-empty p {
    margin: 5px 0;
}

/* Selected Standards */
.or-standards-selected {
    background: #f7f7f7;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 15px;
}

.or-standards-selected h4 {
    margin: 0 0 15px 0;
    font-size: 16px;
    color: #2271b1;
}

.or-standards-count {
    font-weight: 600;
}

.or-standards-selected-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.or-standard-selected-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
}

.or-standard-selected-item .or-standard-reference {
    font-weight: 600;
    color: #2271b1;
}

.or-standard-selected-item .or-standard-title {
    flex: 1;
    color: #50575e;
}

/* Przyciski akcji w wybranych normach */
.or-standard-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

.or-standard-edit {
    background: #2271b1;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}

.or-standard-edit:hover {
    background: #135e96;
    transform: scale(1.1);
}

/* Pokaż przycisk edycji tylko w trybie zaawansowanym */
body.or-advanced-mode .or-standard-edit {
    display: flex;
}

/* Inline Edit Form */
.or-standard-edit-form {
    display: none;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    background: #f9f9f9;
    border: 1px solid #2271b1;
    border-radius: 4px;
    margin-top: 8px;
    width: 100%;
}

.or-standard-selected-item.editing .or-standard-edit-form {
    display: flex;
}

.or-standard-selected-item.editing .or-standard-info {
    display: none;
}

.or-standard-selected-item.editing .or-standard-actions {
    display: none;
}

.or-standard-edit-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.or-standard-edit-row label {
    font-size: 12px;
    font-weight: 600;
    color: #646970;
}

.or-standard-edit-row input {
    font-family: inherit;
    font-size: 14px;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 6px 10px;
    outline: none;
    transition: border-color 0.2s;
}

.or-standard-edit-row input:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
}

.or-standard-edit-buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 4px;
}

.or-standard-edit-save,
.or-standard-edit-cancel {
    padding: 6px 12px;
    border-radius: 3px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.or-standard-edit-save {
    background: #2271b1;
    color: #fff;
    border: none;
}

.or-standard-edit-save:hover {
    background: #135e96;
}

.or-standard-edit-cancel {
    background: #fff;
    color: #646970;
    border: 1px solid #ddd;
}

.or-standard-edit-cancel:hover {
    background: #f0f0f0;
    border-color: #999;
}

/* Info container */
.or-standard-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}

.or-standard-remove {
    background: #d63638;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    transition: all 0.2s;
    flex-shrink: 0;
}

.or-standard-remove:hover {
    background: #b32d2e;
    transform: scale(1.1);
}

/* Ukryj przycisk usuwania dla obowiązkowych norm w trybie zwykłym */
.or-standard-selected-item[data-mandatory="1"] .or-standard-remove {
    display: none;
}

body.or-advanced-mode .or-standard-selected-item[data-mandatory="1"] .or-standard-remove {
    display: flex;
}

.or-standards-selected-empty {
    color: #646970;
    font-style: italic;
    text-align: center;
    padding: 20px;
}

/* Scrollbar styling */
.or-standards-list::-webkit-scrollbar {
    width: 8px;
}

.or-standards-list::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.or-standards-list::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.or-standards-list::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Responsive */
@media (max-width: 782px) {
    .or-standard-content {
        flex-direction: column;
        align-items: flex-start;
    }

    .or-standards-tabs {
        flex-wrap: wrap;
    }

    .or-standards-tab {
        font-size: 12px;
        padding: 8px 10px;
    }

    .or-standard-selected-item {
        flex-wrap: wrap;
    }
}
