/* client\style\css\ribbon.css */

#ribbon {
    grid-area: ribbon;
    background: #3a3a3a;
    padding: 0;
    display: flex;
    flex-direction: column;
    height: 11.875rem;
    overflow: hidden;
}

#ribbon-tabs {
    display: flex;
    background: #2d2d2d;
    border-bottom: 1px solid #555;
    flex-shrink: 0;
    height: 2.5rem;
}

.ribbon-tab {
    padding: 0 1rem;
    display: flex;
    align-items: center;
    color: #ccc;
    cursor: pointer;
    font-size: 0.875rem;
    user-select: none;
    transition: background 0.2s;
}

.ribbon-tab:hover {
    background: #3a3a3a;
}

.ribbon-tab.active {
    background: #444;
    color: #fff;
    border-bottom: 3px solid #0078d7;
}

#ribbon-content {
    flex: 1 1 auto;
    padding: 0.625rem;
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #555 #3a3a3a;
}

#ribbon-content::-webkit-scrollbar {
    height: 8px;
}

#ribbon-content::-webkit-scrollbar-track {
    background: #3a3a3a;
}

#ribbon-content::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

.ribbon-tab-content {
    display: none;
    width: 100%;
    height: 100%;
    gap: 0.5rem;
    flex-shrink: 0;
}

.ribbon-tab-content.active {
    display: flex;
}

.ribbon-panel {
    background: #444;
    border-radius: 0.375rem;
    padding: 0.625rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    height: 100%;
}

.ribbon-columns {
    display: flex;
    gap: 0.375rem;
    flex: 1 1 auto;
    overflow: hidden;
    margin-bottom: 0.375rem;
}

.ribbon-tools {
    flex: 1 1 auto;
    gap: 0.375rem;
    overflow: hidden;
}

.grid-1row {
    display: flex;
    flex-direction: row;
    gap: 0.375rem;
    align-items: stretch;
}

.grid-2row,
.grid-3row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: max-content;
    justify-items: start;
}

.grid-2row { grid-template-rows: repeat(2, 1fr); }
.grid-3row { grid-template-rows: repeat(3, 1fr); }

.ribbon-tool {
    display: flex;
    background: #4a4a4a;
    border-radius: 0.25rem;
    cursor: pointer;
    padding: 0.25rem;
    overflow: hidden;
    transition: background 0.2s, transform 0.1s;
}

.ribbon-tool:hover { 
    background: #5a5a5a; 
}

.ribbon-tool.active {
    background: #0078d7;
    transform: scale(1.05);
    box-shadow: 0 0 0.5rem rgba(0, 120, 215, 0.6);
}

.ribbon-tool.active:hover {
    background: #0068c7;
}

.grid-1row .ribbon-tool {
    flex: 0 1 auto;
    min-width: 3.75rem;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.grid-2row .ribbon-tool,
.grid-3row .ribbon-tool {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    width: 100%;     /* На всю ширину текст*/
}

.ribbon-tool img {
    width: 100%;
    height: 100%;
    max-width: 2rem;
    max-height: 2rem;
    object-fit: contain;
    flex: 0 0 auto;
}

.grid-1row .ribbon-tool img { 
    margin-bottom: 0.25rem; 
}

.grid-2row .ribbon-tool img,
.grid-3row .ribbon-tool img {
    width: 1.5rem;
    height: 1.5rem;
    max-width: 1.5rem;
    max-height: 1.5rem;
    margin-right: 0.5rem;
}

.ribbon-tool span {
    /* убран flex для теста иконок в ленте */
    /* flex: 1 1 auto; */ 
    font-size: 0.6875rem;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #eee;
}

.grid-1row .ribbon-tool span { 
    text-align: center; 
    width: 100%; 
}

.grid-2row .ribbon-tool span,
.grid-3row .ribbon-tool span { 
    text-align: left; 
}

.ribbon-panel-label {
    flex-shrink: 0;
    padding-top: 0.375rem;
    border-top: 1px solid #555;
    font-size: 0.75rem;
    color: #ccc;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ribbon-dropdown */

.ribbon-tool select.ribbon-dropdown {
    -webkit-appearance: menulist;
    -moz-appearance: menulist;
    appearance: menulist;
    background: #4a4a4a;
    color: #eee;
    border: 1px solid #555;
    border-radius: 0.25rem;
    padding: 0.25rem 1.5rem 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    cursor: pointer;
    outline: none;
    min-width: 8rem;
}

.ribbon-tool input.ribbon-dropdown {
    background: #4a4a4a;
    color: #eee;
    border: 1px solid #555;
    border-radius: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1.2;
    outline: none;
    min-width: 7rem;
}

.ribbon-tool select.ribbon-dropdown:focus {
    border-color: #0078d7;
    background: #5a5a5a;
}

.ribbon-tool input.ribbon-dropdown:focus {
    border-color: #0078d7;
    background: #5a5a5a;
}

/* Badge внутри ribbon-tool */
.ribbon-badge {
    display: inline-block;
    background-color: #3a3a3a;
    padding: 0.125rem 0.375rem;
    border-radius: 0.25rem;
    margin-bottom: 1rem;
}

.grid-2row .ribbon-badge {
    box-sizing: border-box;
    margin-right: 0.375rem;
    margin-bottom: 0;
    text-align: center;
}

.ribbon-field-grid {
    grid-auto-flow: row;
    grid-auto-columns: unset;
    grid-template-columns: max-content minmax(8rem, 1fr);
    justify-items: stretch;
}

.ribbon-field-grid.grid-2row {
    grid-template-rows: repeat(2, 1fr);
}

.ribbon-field-grid .ribbon-tool {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: subgrid;
    align-items: center;
}

.grid-2row.ribbon-field-grid .ribbon-tool .ribbon-badge {
    text-align: center;
}

.ribbon-field-grid .ribbon-dropdown {
    width: 100%;
}

