
/* styles.css */

.table-container {
    display: block;
    border: 4px solid rgba(0, 0, 255, 0.055);
    border-radius: 5px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    background-color: #eff4ffb0;
    padding: 6px;
    margin: 10px;
    max-width: 2000px;
    width: 100%;
    box-sizing: border-box;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.auto-expanding-table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    margin-bottom: 10px;
    table-layout: fixed;
}

.auto-expanding-table th, .auto-expanding-table td {
    border: 1px solid black;
    padding: 5px;
    text-align: center;
    word-wrap: break-word;
    overflow-wrap: break-word;
    vertical-align: middle;
}

.auto-expanding-table th {
    background-color: #f0f0f0;
    font-weight: bold;
    font-size: 14px;
}

.auto-expanding-table td:nth-child(1) { width: 5%; }
.auto-expanding-table td:nth-child(2) { width: 10%; }
.auto-expanding-table td:nth-child(3) { width: 10%; }
.auto-expanding-table td:nth-child(4) { width: 35%; text-align: left; }
.auto-expanding-table td:nth-child(5) { width: 10%; }
.auto-expanding-table td:nth-child(6) { width: 10%; }
.auto-expanding-table td:nth-child(7) { width: 20%; text-align: left; }

.button {
    background-color: #9888A2;
    color: white;
    border: none;
    padding: 10px 15px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
    font-size: 26px;
    margin: 4px 2px;
    cursor: pointer;
    border-radius: 5px;
    transition: background-color 0.3s, transform 0.3s;
    width: 350px;
    box-sizing: border-box;
}

.button:hover {
    background-color: #b7a8c0;
}

/* Стили для подсказок */
.suggestion-box {
    border: 1px solid #ccc;
    background: #aac4fdf5;
    max-height: 300px;
    overflow-y: auto;
    position: absolute;
    z-index: 9999;
    border-radius: 5px;
    min-width: 950px;
    max-width: 90vw;
    overflow-wrap: break-word;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    pointer-events: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.suggestion-item {
    padding: 10px 12px;
    user-select: none;
    -webkit-user-select: none;
    cursor: pointer;
    font-size: 18px;
    border-bottom: 1px solid rgba(0,0,0,0.1);
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover, .suggestion-item.highlighted {
    background-color: rgba(120, 163, 255, 0.8);
    color: white;
}

.suggestion-box::-webkit-scrollbar { width: 8px; }
.suggestion-box::-webkit-scrollbar-thumb {
    background-color: #8fc4fd;
    border-radius: 10px;
}

/* Подсказки внутри ячеек */
.name-suggestion {
    color: #888888;
    opacity: 0.6;
    pointer-events: none;
}

.notes-suggestion {
    color: #888888;
    opacity: 0.6;
    pointer-events: none;
}

#table-totals {
    font-size: 16px;
    line-height: 1.5;
}

/* Адаптивность для мобильных */
@media (max-width: 768px) {
    .table-container {
        padding: 4px;
        margin: 5px;
        overflow-x: scroll;
        -webkit-overflow-scrolling: touch;
    }

    .auto-expanding-table {
        min-width: 800px;
        font-size: 13px;
    }

    .auto-expanding-table th,
    .auto-expanding-table td {
        padding: 4px 3px;
        font-size: 12px;
    }

    .button {
        width: 100% !important;
        max-width: 100%;
        font-size: 16px;
        padding: 12px;
        margin: 3px 0;
    }

    .table-controls {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 5px;
        padding: 0 5px;
    }

    .table-controls .button {
        width: 100%;
        margin: 3px 0;
    }

    #downloadTableForm {
        padding: 0 5px;
    }

    #downloadTableForm .button {
        width: 100%;
    }

    /* Подсказки на мобильных — фиксированное позиционирование */
    .suggestion-box {
        position: fixed !important;
        left: 10px !important;
        right: 10px !important;
        top: auto !important;
        bottom: 20% !important;
        width: auto !important;
        max-width: none;
        max-height: 40vh;
        z-index: 10000;
        font-size: 16px;
    }

    .suggestion-item {
        padding: 15px;
        font-size: 16px;
    }

    #table-totals {
        font-size: 14px;
        padding: 10px;
    }

    caption h3 {
        font-size: 20px !important;
    }
}

@media (max-width: 480px) {
    .auto-expanding-table {
        min-width: 700px;
        font-size: 11px;
    }

    .auto-expanding-table th,
    .auto-expanding-table td {
        padding: 3px 2px;
        font-size: 11px;
    }

    caption h3 {
        font-size: 16px !important;
    }
    
    .suggestion-item {
        padding: 12px;
        font-size: 14px;
    }
}