/* assets/css/style.css */

* {
    box-sizing: border-box;
}

body,
html {
    margin: 0;
    padding: 0;
    height: 100%;
    width: 100%;
    font-family: Arial, sans-serif;
    overflow: hidden;
    display: flex;
}

.header {
    width: 60px;
    height: 100vh;
    background: #333;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 10px 0;
    box-sizing: border-box;
    flex-shrink: 0;
}

.header a {
    color: white;
    text-decoration: none;
    font-size: 10px;
    text-align: center;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.logo {
    font-weight: bold;
    font-size: 14px !important;
    margin-bottom: 30px !important;
}

.nav {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.user-block {
    margin-top: auto;
    width: 100%;
    display: flex;
    flex-direction: column;
}

#main-container {
    flex-grow: 1;
    height: 100vh;
    overflow: auto;
    background: #f4f4f4;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background-color: white;
    padding: 20px;
    border-radius: 5px;
    width: 300px;
    position: relative;
}

.close-modal {
    position: absolute;
    right: 10px;
    top: 5px;
    cursor: pointer;
    font-size: 20px;
}

.form-group {
    margin-bottom: 10px;
}

/* Item Editor Styles */
.visual-card.editable {
    position: relative;
    cursor: pointer;
}

.visual-card.editable:hover .upload-overlay {
    opacity: 1;
}

.upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 12px;
    font-size: 0.9rem;
    pointer-events: none;
    /* Пропускаем клики к картинке (галерее) */
}

.upload-overlay span {
    pointer-events: auto;
    /* Но само слово "Изменить" кликабельно */
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 6px;
    cursor: pointer;
    backdrop-filter: blur(2px);
    transition: background 0.2s;
}

.upload-overlay span:hover {
    background: rgba(255, 255, 255, 0.4);
}

.upload-overlay i {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.item-title-input {
    width: 100%;
    font-size: 2.5rem;
    font-weight: bold;
    border: 1px dashed #ccc;
    background: transparent;
    color: #2c3e50;
    margin-bottom: 5px;
    padding: 5px;
}

.item-subtitle-input {
    width: 100%;
    font-size: 1.3rem;
    font-weight: normal;
    border: 1px dashed #ccc;
    background: transparent;
    color: #34495e;
    margin-bottom: 15px;
    padding: 5px;
}

.item-subtitle {
    font-size: 1.3rem;
    color: #34495e;
    margin-bottom: 15px;
    font-weight: 500;
}

.item-desc-textarea {
    width: 100%;
    font-size: 1.1rem;
    line-height: 1.6;
    border: 1px dashed #ccc;
    background: transparent;
    color: #7f8c8d;
    padding: 10px;
    min-height: 100px;
    resize: vertical;
}

.step-item.step-type-description {
    background: #eef2f7;
    border-left: 4px solid #2980b9;
    margin: 10px 0;
    padding: 10px;
}

.step-item.step-type-point {
    border-left: 4px solid #27ae60;
}

.step-item.step-type-drawing {
    border-left: 4px solid #f39c12;
}

.description-preview-icon {
    background: #fff;
    border: 1px solid #d5dbdb;
    border-radius: 4px;
}

.no-img-text {
    color: #ccc;
    font-size: 0.8rem;
    font-style: italic;
}

/* Build Formula Editor */
.build-formula-block {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 10px;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 4px;
}

.field-faded {
    opacity: 0.5;
    transition: opacity 0.3s;
}

.field-faded:hover {
    opacity: 1;
}

.step-type-drawing {
    border-left: 4px solid #e67e22 !important;
}

.step-type-point {
    border-left: 4px solid #3498db !important;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
}

.formula-hint {
    color: #444;
    background: #e8e8e8;
    border: 1px solid #ccc;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.8em;
    font-family: monospace;
    margin-left: 10px;
    vertical-align: middle;
    cursor: help;
    white-space: nowrap;
}

.formula-hint b {
    color: #d9534f;
}

/* Валидация мерок */
.cell-input.invalid {
    background-color: #ffd7d7 !important;
    border-color: #d9534f !important;
    color: #b94a48;
}

.cell-input.valid-formula {
    background-color: #e6ffed !important;
    border-color: #28a745 !important;
}

.btn-delete-measure {
    background: #ffeded;
    color: #d9534f;
    border: 1px solid #ffcccc;
    border-radius: 4px;
    padding: 2px 8px;
    cursor: pointer;
    font-size: 1.2em;
    line-height: 1;
    transition: all 0.2s;
}

.btn-delete-measure:hover {
    background: #d9534f;
    color: white;
    border-color: #d9534f;
}

.btn-danger {
    background: #d9534f;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.2s;
}

.btn-danger:hover {
    background: #c9302c;
}

/* Drag and Drop styles */
#measures-table tbody tr {
    cursor: default;
}

#measures-table tbody tr td:first-child {
    cursor: grab;
    user-select: none;
    color: #999;
}

#measures-table tbody tr td:first-child:active {
    cursor: grabbing;
}

#measures-table tbody tr.dragging {
    opacity: 0.5;
    background: #f0f0f0;
}

#measures-table tbody tr.drag-over {
    border-top: 2px solid #28a745;
}

.form-group input {
    width: 100%;
    box-sizing: border-box;
    padding: 5px;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
}

/* Products Grid */
.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.product-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #eee;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.product-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 15px rgba(0, 0, 0, 0.1);
}

.product-icon {
    font-size: 40px;
    margin-bottom: 15px;
}

.product-info h3 {
    margin: 0 0 5px 0;
    color: #333;
}

.product-info .category {
    font-size: 0.8em;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.product-info .desc {
    font-size: 0.9em;
    color: #444;
    line-height: 1.4;
    margin-bottom: 20px;
}

.view-recipe {
    margin-top: auto;
}

/* Modal Content Large */
.modal-content.large {
    width: 90%;
    max-width: 1000px;
}

.recipe-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.recipe-table th,
.recipe-table td {
    padding: 10px;
    border-bottom: 1px solid #eee;
    text-align: left;
}

.recipe-table th {
    background: #f9f9f9;
    font-size: 0.85em;
    color: #666;
}

.recipe-table code {
    background: #f0f0f0;
    padding: 2px 5px;
    border-radius: 4px;
    color: #d63384;
    font-family: monospace;
}

.tag {
    display: inline-block;
    background: #e1f5fe;
    color: #0288d1;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.85em;
    margin-right: 5px;
    border: 1px solid #b3e5fc;
}

.product-section {
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.product-actions {
    margin-top: 30px;
    text-align: right;
}

/* Кнопка "Наверх" */
#btn-scroll-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    background: #2c3e50;
    color: white;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9999;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
    opacity: 0.8;
}

#btn-scroll-top:hover {
    background: #1c84f2;
    opacity: 1;
    transform: translateY(-5px);
}
/* Admin Browser Styles */
.admin-item-actions {
    display: none;
    gap: 5px;
    margin-left: auto;
}

.folder-item:hover .admin-item-actions,
.file-item:hover .admin-item-actions {
    display: flex;
}

.admin-item-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background 0.2s;
}

.admin-item-actions button:hover {
    background: #eee;
}

.admin-sortable.drag-over {
    border: 2px dashed #3498db !important;
    background: #ebf5fb !important;
}

.admin-browser-controls button {
    font-size: 12px;
    padding: 5px 12px;
    cursor: pointer;
}


/* Formatting Toolbar */
.formatting-toolbar { display: flex !important; gap: 2px; background: #e0e0e0 !important; padding: 5px !important; border: 1px solid #999 !important; border-bottom: none; border-radius: 4px 4px 0 0; min-height: 25px; visibility: visible !important; }
.formatting-btn { background: #fff !important; border: 1px solid #ccc !important; padding: 4px 10px !important; cursor: pointer; font-size: 14px; border-radius: 3px; color: #333 !important; transition: background 0.2s; }
.formatting-btn:hover { background: #3498db !important; color: #fff !important; }
