/* ModernRibbon - новая система стилей */

.modern-ribbon {
    display: flex;
    align-items: center;
    /*gap: 8px;*/
    /*padding: 8px 16px;*/
    background: linear-gradient(to bottom, #f8f8f8, #e8e8e8);
    /*border: 1px solid #ccc;*/
    /*border-radius: 4px;*/
    border-left: 1px solid #999;
    min-height: 60px;
    box-sizing: border-box;
}

/* Базовые стили кнопок */
.ribbon-button {
    position: relative;
    border: 1px solid transparent;
    /*background: linear-gradient(to bottom, #f5f5f5, #e5e5e5);*/
    cursor: pointer;
    outline: none;
    user-select: none;
    flex-flow: wrap;
    display: flex;
    align-self: center;
    border-radius: 3px;
    transition: all 0.15s ease;
    align-items: center;
    justify-content: center;    
}

.ribbon-button:hover {
    background: linear-gradient(to bottom, #e8f4fd, #d0e8f7);
    border-color: #92c5f7;
}

.ribbon-button:active {
    background: linear-gradient(to bottom, #cce4f7, #b8d6f0);
    transform: translateY(1px);
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.ribbon-button:disabled {
    filter: brightness(1) grayscale(1.0);
    cursor: not-allowed;          /* показывает «запрещённый» курсор */
    pointer-events: none;         /* полностью отключает все события мыши */
    opacity: 0.6;                /* опционально: лёгкая прозрачность для наглядности */    
    }

/* Размеры кнопок */
.ribbon-btn-normal {
    width: 48px;
    height: 48px;
    /*padding: 2px;*/
    margin-bottom: 2px;
}

.ribbon-btn-small {
    width: 32px;
    height: 32px;
    /*padding: 2px;*/
}

.ribbon-btn-vsmall {
    width: 16px;
    height: 16px;
}

/* Иконки */
.ribbon-icon {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: brightness(1) grayscale(0.7);
    transition: filter 0.15s ease;
}

.ribbon-button:hover .ribbon-icon {
    filter: brightness(1) grayscale(0);
}

/* Чек-кнопки */
.ribbon-check-button.checked {
    background: linear-gradient(45deg, #e8f2f9, #ddf2ff);
    border-color: #66b3ff;
    box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
}

.ribbon-check-button.checked:hover {
    /*background: linear-gradient(to bottom, #ffe135, #ffd700);*/
}

/* Выпадающие меню */
.ribbon-dropdown {
    position: relative;
    display: inline-block;
}

.ribbon-caret {
    position: absolute;
    left: 13px;
    bottom: -10px;
    font-size: 18px;
    color: #000;
    pointer-events: none;
    line-height: 1;
}

.ribbon-btn-small .ribbon-caret {
    font-size: 6px;
    right: 1px;
    top: 1px;
}

.ribbon-dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 180px;
    background: white;
    border: 1px solid #ccc;
    border-radius: 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    display: none;
    z-index: 1000;
    padding: 4px 0;
    margin-top: 2px;
}

.ribbon-dropdown-menu.show {
    display: block;
}

.ribbon-dropdown-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    cursor: pointer;
    transition: background-color 0.15s ease;
}

.ribbon-dropdown-item:hover {
    background-color: #f0f8ff;
}

.ribbon-menu-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Edit-box */
.ribbon-editbox {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s ease;
    background: white;
}

.ribbon-editbox:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

.ribbon-edit-normal {
    height: 24px;
}

.ribbon-edit-small {
    height: 20px;
    font-size: 12px;
    padding: 2px 6px;
}

/* Number Range (слайдер + число) */
.ribbon-number-range {
    display: flex;
    align-items: center;
    /*gap: 4px;*/
    /*border: 1px solid #ccc;*/
    /*border-radius: 3px;*/
    /*padding: 2px 4px;*/
    /*background: white;*/
}

.ribbon-range-normal {
    /*height: 28px;*/
}

.ribbon-range-small {
    /*height: 26px;*/
}

.ribbon-slider {
    flex: 1;
    min-width: 60px;
    height: 18px;
    outline: none;
    background: transparent;
    cursor: pointer;
}

.ribbon-number-input {
    border: 1px solid #999;
    outline: none;
    text-align: center;
    font-size: 1em;
    background: transparent;
    height: 26px;
}

/* Color Picker */
.ribbon-color-picker {
    border: 1px solid #ccc;
    border-radius: 3px;
    cursor: pointer;
    outline: none;
    background: none;
    padding: 0;
}

.ribbon-color-normal {
    width: 32px;
    height: 24px;
}

.ribbon-color-small {
    width: 24px;
    height: 20px;
}

/* Select/List */
.ribbon-select {
    border: 1px solid #ccc;
    border-radius: 3px;
    padding: 4px 8px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    background: white;
    cursor: pointer;
}

.ribbon-select:focus {
    border-color: #0078d4;
    box-shadow: 0 0 0 1px #0078d4;
}

.ribbon-select-normal {
    height: 24px;
}

.ribbon-select-small {
    height: 20px;
    font-size: 12px;
    padding: 2px 6px;
}

/* Группы */
.ribbon-group {
    display: flex;
    align-items: center;
    justify-content: space-around;
    align-content: space-around;
    flex-wrap: wrap;
    padding: 16px 2px 1px 2px;
    height: 100%;    
    /*padding: 4px;*/
    border-radius: 2px;
    /*background: rgba(255,255,255,0.3);*/
    border: none;
    /*border-bottom: none;*/
    /*border-top: none;*/
    /*border-left: none;*/
    border-right: 1px solid #999;
    position: relative;
}

.ribbon-group[data-group-title]::after {
    content: attr(data-group-title);
    position: absolute;
    top: -1px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
    background: inherit;
    padding: 0 4px;
}

/* Разделители */
.ribbon-separator {
    width: 1px;
    height: 40px;
    background: linear-gradient(to bottom, transparent, #ccc 20%, #ccc 80%, transparent);
    margin: 0 4px;
}

/* Тултипы */
.ribbon-button[data-title]:hover::before,
.ribbon-editbox[data-title]:hover::before {
    content: attr(data-title);
    position: absolute;
    bottom: -28px;
    left: 80%;
    /*margin-left: 4px;*/
    /*transform: translateX(-20%);*/
    background: #F0F0F0;
    color: #000;
    padding: 4px 8px;
    border: 0.5px solid #999;
    border-radius: 1px;
    font-size: 0.8em;
    white-space: nowrap;
    z-index: 1001;
    pointer-events: none;
    /*opacity: 0;*/
    /*transition: opacity 0.5s ease;*/
}

/*.ribbon-button[data-title]:hover::after,
.ribbon-editbox[data-title]:hover::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border: 4px solid transparent;
    border-bottom-color: #333;
    z-index: 1001;
    pointer-events: none;
}
*/
/* Адаптивность */
@media (max-width: 768px) {
    .modern-ribbon {
        /*flex-wrap: wrap;*/
        gap: 4px;
        padding: 4px 8px;
    }
    
    .ribbon-btn-normal {
        width: 40px;
        height: 40px;
    }
    
    .ribbon-btn-small {
        width: 28px;
        height: 28px;
    }
}
