/* ========== ОСНОВНЫЕ СТИЛИ ========== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-pink: #FF69B4;
    --light-pink: #FFC0CB;
    --bg-pink: #FFF0F5;
    --text-dark: #4B0082;
    --text-light: #9370DB;
    --white: #FFFFFF;
    --shadow: 0 4px 8px rgba(255, 105, 180, 0.2);
    --shadow-hover: 0 8px 16px rgba(255, 105, 180, 0.3);
    --border-radius: 15px;
}

body {
    font-family: 'Montserrat', sans-serif;
    background: linear-gradient(135deg, var(--bg-pink) 0%, var(--white) 100%);
    color: var(--text-dark);
    min-height: 100vh;
    line-height: 1.6;
}

.app-container {
    max-width: 1400px;
    margin: 20px auto;
    padding: 0 20px;
}

/* ========== ШАПКА ========== */
.app-header {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}

.logo {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 20px;
}

.logo i {
    font-size: 48px;
    color: var(--primary-pink);
    filter: drop-shadow(var(--shadow));
    transition: transform 0.3s ease;
}

.logo i:hover {
    transform: rotate(-10deg) scale(1.1);
}

.logo h1 {
    font-size: 36px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary-pink), var(--text-dark));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
}

.logo-badge {
    background: var(--light-pink);
    color: var(--text-dark);
    padding: 5px 15px;
    border-radius: 30px;
    font-size: 14px;
    font-weight: 600;
    margin-left: auto;
}

/* ========== НАВИГАЦИЯ ========== */
.main-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.tabs {
    display: flex;
    list-style: none;
    gap: 10px;
    margin: 0;
    padding: 0;
}

.tab {
    padding: 12px 24px;
    border-radius: 30px;
    background: var(--light-pink);
    color: var(--text-dark);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.tab i {
    font-size: 18px;
    color: var(--primary-pink);
}

.tab:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

.tab.active {
    background: linear-gradient(135deg, var(--primary-pink), var(--text-dark));
    color: var(--white);
}

.tab.active i {
    color: var(--white);
}

.action-buttons {
    display: flex;
    gap: 10px;
}

/* ========== КНОПКИ ========== */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 30px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    box-shadow: var(--shadow);
}

.btn:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-hover);
}

.btn:active {
    transform: scale(0.95);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-pink), #FF1493);
    color: var(--white);
}

.btn-secondary {
    background: var(--light-pink);
    color: var(--text-dark);
}

.btn-block {
    width: 100%;
    justify-content: center;
}

.btn-sm {
    padding: 8px 16px;
    font-size: 13px;
}

/* ========== КАРТОЧКИ ========== */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-hover);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-pink);
}

.card-header i {
    font-size: 24px;
    color: var(--primary-pink);
}

.card-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
}

/* ========== ФОРМЫ ========== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-dark);
}

.form-group label i {
    color: var(--primary-pink);
    margin-right: 5px;
}

.form-control {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--light-pink);
    border-radius: 30px;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    transition: all 0.3s ease;
    background: var(--white);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-pink);
    box-shadow: 0 0 0 3px rgba(255, 105, 180, 0.1);
}

.form-hint {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    color: var(--text-light);
}

/* ========== РЕЗУЛЬТАТЫ ========== */
.result-card {
    background: linear-gradient(135deg, var(--light-pink), #FFE4E1);
    border-radius: var(--border-radius);
    padding: 15px;
    margin-top: 20px;
    border-left: 4px solid var(--primary-pink);
}

.result-header {
    font-weight: 600;
    margin-bottom: 10px;
}

.result-body {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.result-body > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.result-label {
    color: var(--text-dark);
    font-weight: 500;
}

.result-value {
    color: var(--primary-pink);
    font-weight: 600;
}

.result-big {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-dark);
}

.result-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed var(--light-pink);
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-light);
}

/* ========== ТАБЛИЦЫ ========== */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--border-radius);
    background: var(--white);
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1200px;
}

.table th {
    background: linear-gradient(135deg, var(--light-pink), #FFB6C1);
    color: var(--text-dark);
    font-weight: 600;
    padding: 15px;
    text-align: center;
    font-size: 14px;
    white-space: nowrap;
}

.table td {
    padding: 12px 8px;
    text-align: center;
    border-bottom: 1px solid var(--light-pink);
    color: var(--text-dark);
    font-size: 13px;
}

.table tbody tr:hover {
    background: rgba(255, 105, 180, 0.05);
}

.mini-table {
    min-width: 100%;
}

/* ========== ТИПЫ ТОВАРОВ (ЦВЕТА) ========== */
.type-badge {
    display: inline-block;
    padding: 5px 15px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 12px;
}

.type-thread { background: #FF69B4; color: white; }
.type-fabric { background: #FFB6C1; color: #4B0082; }
.type-pack { background: #FFC0CB; color: #4B0082; }
.type-furniture { background: #DDA0DD; color: white; }

/* ========== ПОИСК И ФИЛЬТРЫ ========== */
.filters {
    display: flex;
    gap: 10px;
    align-items: center;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--white);
    border: 2px solid var(--light-pink);
    border-radius: 30px;
    padding: 0 5px;
}

.search-box i {
    color: var(--primary-pink);
    margin: 0 10px;
}

.search-box .form-control {
    border: none;
    background: transparent;
    padding: 8px 0;
}

.search-box.small .form-control {
    width: 200px;
}

/* ========== МОДАЛЬНЫЕ ОКНА ========== */
.modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-content {
    background: var(--white);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--light-pink);
}

.modal-header h3 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-pink);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: var(--text-light);
    cursor: pointer;
    transition: all 0.3s ease;
}

.close-btn:hover {
    color: var(--primary-pink);
    transform: scale(1.1);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    z-index: 999;
}

/* ========== КОМПОНЕНТЫ НАБОРОВ ========== */
.component-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: center;
    background: var(--light-pink);
    padding: 10px;
    border-radius: 30px;
}

.component-row select {
    flex: 2;
    min-width: 200px;
}

.component-row input {
    flex: 1;
    min-width: 80px;
}

.component-row .btn {
    flex: 0;
}

.image-preview {
    margin-top: 10px;
    max-width: 200px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--primary-pink);
}

.image-preview img {
    width: 100%;
    height: auto;
    display: block;
}

/* ========== УТИЛИТЫ ========== */
.text-center {
    text-align: center;
}

.badge {
    background: var(--primary-pink);
    color: var(--white);
    padding: 3px 10px;
    border-radius: 30px;
    font-size: 12px;
    font-weight: 600;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.content-header h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--primary-pink);
}

/* ========== АДАПТИВНОСТЬ ========== */
@media (max-width: 768px) {
    .app-container {
        padding: 10px;
    }
    
    .logo {
        flex-direction: column;
        text-align: center;
    }
    
    .logo-badge {
        margin: 0;
    }
    
    .main-nav {
        flex-direction: column;
    }
    
    .tabs {
        width: 100%;
        flex-direction: column;
    }
    
    .tab {
        width: 100%;
        justify-content: center;
    }
    
    .action-buttons {
        width: 100%;
        flex-direction: column;
    }
    
    .btn {
        width: 100%;
        justify-content: center;
    }
    
    .filters {
        flex-direction: column;
        width: 100%;
    }
    
    .search-box.small,
    .search-box.small .form-control,
    #stock-filter {
        width: 100%;
    }
    
    .table th,
    .table td {
        padding: 8px 5px;
        font-size: 12px;
    }
    
    .modal {
        width: 95%;
    }
    
    .component-row {
        flex-direction: column;
    }
    
    .component-row select,
    .component-row input {
        width: 100%;
    }
}

/* ========== АНИМАЦИИ ========== */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.fade-in {
    animation: fadeIn 0.3s ease;
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--light-pink);
    border-top-color: var(--primary-pink);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ========== ФУТЕР ========== */
.app-footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    color: var(--text-light);
    font-size: 14px;
}

.app-footer p {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
/* ========== ИСПРАВЛЕНИЕ ПЕРЕКЛЮЧЕНИЯ ВКЛАДОК ========== */
.tab-content {
    display: none !important;
}

.tab-content.active {
    display: block !important;
}

/* Для главной страницы с сеткой */
#main.tab-content.active .content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}
/* Стили для единиц измерения */
.amount-unit {
    margin-left: 8px;
    font-weight: 600;
    color: #FF69B4;
    min-width: 40px;
    font-size: 14px;
}

.component-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.component-row select {
    flex: 2;
    min-width: 200px;
}

.component-row input {
    flex: 1;
    min-width: 100px;
}