/* Калькулятор мебели - стили - ОБНОВЛЕНО 2025-09-25 18:35 - ОДИНАКОВАЯ ВЫСОТА КАРТОЧЕК + КОНТРАСТНЫЙ CARD-BODY */

body {
    background-color: #f8f9fa;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.breadcrumb {
    background: none;
    padding: 0;
}

.breadcrumb-item a {
    text-decoration: none;
}

.breadcrumb-item a:hover {
    text-decoration: underline;
}

/* Карточки проектов */
.project-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    border-radius: 15px;
    overflow: hidden;
}

.project-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.project-card .card-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-bottom: none;
    padding: 1.5rem;
}

.project-card .card-body {
    padding: 1.5rem;
}

.project-stats {
    display: flex;
    justify-content: space-between;
    margin-top: 1rem;
}

.project-stat {
    text-align: center;
    flex: 1;
}

.project-stat .stat-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #007bff;
}

.project-stat .stat-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Карточки модулей */
.module-card {
    transition: transform 0.2s, box-shadow 0.2s;
    border: none;
    border-radius: 12px;
    overflow: visible;
    margin-bottom: 1.5rem;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.module-card .card-header {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    color: white;
    border-bottom: none;
    padding: 1.25rem;
}

.module-card .card-body {
    padding: 1.25rem;
}

/* Таблица деталей */
.table th {
    background-color: #f8f9fa;
    border-top: none;
    font-weight: 600;
    color: #495057;
    white-space: nowrap;
}

.table td {
    vertical-align: middle;
}

.part-name {
    font-weight: 600;
    color: #007bff;
}

.part-dimensions {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    color: #6c757d;
}

.part-area, .part-volume {
    font-weight: 600;
}

/* Статистические карточки */
.stats-card {
    border: none;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
    transition: transform 0.2s;
}

.stats-card:hover {
    transform: translateY(-2px);
}

.stats-card .card-body {
    padding: 1.5rem;
}

.stats-card h3 {
    margin: 0;
    font-size: 2rem;
    font-weight: bold;
}

.stats-card .card-title {
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Модальные окна */
.modal-header {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    color: white;
    border-bottom: none;
}

.modal-header .btn-close {
    filter: invert(1);
}

.modal-body {
    padding: 2rem;
}

.modal-footer {
    border-top: 1px solid #e9ecef;
    padding: 1rem 2rem;
}

/* Формы */
.form-label {
    font-weight: 600;
    color: #495057;
    margin-bottom: 0.5rem;
}

.form-control:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

/* Кнопки */
.btn {
    border-radius: 8px;
    font-weight: 600;
    padding: 0.5rem 1rem;
    transition: all 0.2s;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    border: none;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
}

.btn-outline-primary:hover {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border-color: #007bff;
}

.btn-outline-danger:hover {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border-color: #dc3545;
}

/* Загрузчик */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Сообщения об отсутствии данных */
.no-data-message {
    color: #6c757d;
    font-size: 1.1rem;
}

.no-data-message i {
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* Адаптивность */
@media (max-width: 768px) {
    .project-stats {
        flex-direction: column;
        gap: 1rem;
    }

    .stats-card h3 {
        font-size: 1.5rem;
    }

    .table-responsive {
        font-size: 0.9rem;
    }

    .btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.9rem;
    }
}

/* Специальное оформление проекта "Библиотека" */
.card.library-project,
div.card.library-project,
.library-project.card,
.project-card.library-project {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    background-color: #667eea !important;
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: 2px solid #5a6fd8 !important;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3) !important;
}

.card.library-project .card-header,
.library-project.card .card-header {
    background: rgba(255, 255, 255, 0.1) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2) !important;
}

.card.library-project .card-title,
.library-project.card .card-title {
    color: #ffffff !important;
    font-weight: 600;
}

.card.library-project .text-light,
.library-project.card .text-light {
    color: rgba(255, 255, 255, 0.9) !important;
}

.card.library-project .card-body,
.library-project.card .card-body {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.card.library-project .project-stats,
.library-project.card .project-stats {
    color: #ffffff !important;
}

.card.library-project .project-stat,
.library-project.card .project-stat {
    color: #ffffff !important;
}

.card.library-project .stat-number,
.library-project.card .stat-number {
    color: #ffffff !important;
    font-weight: bold;
}

.card.library-project .stat-label,
.library-project.card .stat-label {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Дополнительная специфичность для всех текстовых элементов в библиотеке */
.card.library-project *,
.library-project.card * {
    color: #ffffff !important;
}

/* Переопределение для подписей */
.card.library-project .stat-label,
.library-project.card .stat-label {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* ФОРСИРОВАННЫЕ СТИЛИ ДЛЯ БИБЛИОТЕКИ - МАКСИМАЛЬНЫЙ ПРИОРИТЕТ */
.project-card.library-project[class*="library-project"],
div.card.project-card.library-project {
    background: #667eea !important;
    background-image: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: #ffffff !important;
}

.project-card.library-project[class*="library-project"] .card-body,
div.card.project-card.library-project .card-body {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
}

.project-card.library-project[class*="library-project"] *,
div.card.project-card.library-project * {
    color: #ffffff !important;
}

.project-card.library-project[class*="library-project"] .stat-label,
div.card.project-card.library-project .stat-label {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Анимации */
.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateX(-100%); }
    to { transform: translateX(0); }
}

/* Утилиты */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.cursor-pointer {
    cursor: pointer;
}

.shadow-sm-hover:hover {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075) !important;
}

/* Стили для разделителей материалов в таблице деталей */
.material-divider {
    border: none !important;
}

.material-divider td {
    padding: 0 !important;
    border: none !important;
}

.material-header {
    border-top: 2px solid rgba(0, 0, 0, 0.1) !important;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1) !important;
}

.material-header td {
    border-left: none !important;
    border-right: none !important;
    font-weight: 600;
}

.material-part {
    border-top: none !important;
}

.material-part:last-child {
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

/* Плавные переходы для строк */
.material-header {
    transition: background-color 0.2s ease;
}

.material-part:hover {
    background-color: rgba(0, 123, 255, 0.05) !important;
}

/* Специальные стили для разных материалов */
.material-part[data-material="ЛДСП"]:hover {
    background-color: rgba(13, 110, 253, 0.05) !important;
}

.material-part[data-material="МДФ"]:hover {
    background-color: rgba(25, 135, 84, 0.05) !important;
}

.material-part[data-material="ЛХДФ"]:hover {
    background-color: rgba(255, 193, 7, 0.05) !important;
}

/* ПРИНУДИТЕЛЬНЫЕ СТИЛИ ДЛЯ МОДАЛЬНОГО ОКНА ИМПОРТА - 2 МОДУЛЯ В РЯД */
#library-modules {
    display: flex !important;
    flex-wrap: wrap !important;
    margin: 0 -0.5rem !important;
}

#library-modules .col-6 {
    width: 50% !important;
    max-width: 50% !important;
    flex: 0 0 50% !important;
    padding: 0 0.5rem !important;
    box-sizing: border-box !important;
}

.library-module-card {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
    flex-direction: column !important;
}

.library-module-card .card-body {
    flex: 1 !important;
    display: flex !important;
    flex-direction: column !important;
}

/* Дополнительная специфичность для модального окна */
.modal #library-modules {
    display: flex !important;
    flex-wrap: wrap !important;
}

.modal #library-modules .col-6 {
    width: 50% !important;
    flex: 0 0 50% !important;
}

/* Fallback для старых браузеров */
#library-modules::after {
    content: "";
    display: table;
    clear: both;
}

#library-modules .col-6 {
    float: left !important;
}

/* ============================================================================
   Стили для кромкования деталей
   ============================================================================ */

.edgeable-dimension {
    cursor: pointer;
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.edgeable-dimension:hover {
    background-color: #e3f2fd;
    transform: scale(1.05);
}

/* Визуальные состояния кромкования */
.edgeable-dimension[data-edge-count="0"] {
    text-decoration: none;
    color: #6c757d;
}

.edgeable-dimension[data-edge-count="1"] {
    text-decoration: underline;
    text-decoration-style: solid;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
    color: #0d6efd;
}

.edgeable-dimension[data-edge-count="2"] {
    text-decoration: underline;
    text-decoration-style: double;
    text-underline-offset: 3px;
    text-decoration-thickness: 2px;
    color: #0d6efd;
}

/* Подсветка при активном клике */
.edgeable-dimension:active {
    background-color: #bbdefb;
}
/* ===== DRAG & DROP СТИЛИ ДЛЯ МОДУЛЕЙ ===== */

/* Призрак (отображается на месте оригинала) */
.sortable-ghost {
    opacity: 0.4;
    background: #f8f9fa;
}

/* Выбранный элемент (при начале перетаскивания) */
.sortable-chosen {
    cursor: move;
}

/* Элемент во время перетаскивания */
.sortable-drag {
    opacity: 0.8;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    transform: rotate(2deg);
    cursor: grabbing !important;
}

/* Курсор при наведении на карточку модуля */
.module-card {
    cursor: grab;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.module-card:active {
    cursor: grabbing;
}

/* Dropdown меню для модулей - отображается поверх всего */
.module-card .dropdown-menu {
    z-index: 1050;
}
