
/* CSV Viewer */

#developer .tool-card {
    width: 100%;
}

#developer .tool-field {
    margin-top: 22px;
}

#developer .tool-field label {
    display: block;
    margin-bottom: 9px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.csvviewer-hint {
    margin: 8px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.6;
}

/* File input */

#csvViewerFile {
    display: block;
    width: 100%;
    min-height: 46px;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
}

#csvViewerFile::file-selector-button {
    margin-right: 12px;
    padding: 8px 14px;
    border: 0;
    border-radius: 7px;
    background: var(--primary, #315efb);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

#csvViewerFile::file-selector-button:hover {
    opacity: 0.88;
}

/* Delimiter select */

#csvViewerDelimiter {
    width: 100%;
    max-width: 260px;
    min-height: 44px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

#csvViewerFile:focus,
#csvViewerDelimiter:focus {
    outline: none;
    border-color: var(--primary, #315efb);
    box-shadow: 0 0 0 3px rgba(49, 94, 251, 0.12);
}

/* Buttons */

#developer .tool-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

#developer .tool-actions button {
    min-height: 43px;
    padding: 0 20px;
    border: 1px solid var(--primary, #315efb);
    border-radius: 9px;
    background: var(--primary, #315efb);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.2s;
}

#developer .tool-actions button:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

#developer .tool-actions button:active {
    transform: translateY(0);
}

#developer .tool-actions button.secondary-button {
    border-color: var(--line);
    background: var(--surface);
    color: var(--text);
}

/* Status */

#csvViewerStatus {
    margin-top: 16px;
    font-size: 14px;
    line-height: 1.6;
}

#csvViewerStatus:empty {
    display: none;
}

/* Results */

.csvviewer-results {
    margin-top: 28px;
    width: 100%;
}

.csvviewer-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
}

/* Table */

.csvviewer-table-wrapper {
    width: 100%;
    max-height: 520px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

#csvViewerTable {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 14px;
    text-align: left;
}

#csvViewerTable th,
#csvViewerTable td {
    padding: 13px 16px;
    border-bottom: 1px solid var(--line);
    border-right: 1px solid var(--line);
    color: var(--text);
    text-align: left;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    min-width: 100px;
    max-width: 360px;
    line-height: 1.5;
}

#csvViewerTable th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--surface);
    font-weight: 650;
}

#csvViewerTable td {
    background: var(--surface);
}

#csvViewerTable th:last-child,
#csvViewerTable td:last-child {
    border-right: none;
}

#csvViewerTable tbody tr:last-child td {
    border-bottom: none;
}

#csvViewerTable tbody tr:hover td {
    background: var(--background, rgba(127, 127, 127, 0.06));
}

/* Responsive */

@media (max-width: 640px) {
    #developer .tool-actions {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    #developer .tool-actions button {
        width: 100%;
        padding: 0 12px;
    }

    #csvViewerDelimiter {
        max-width: 100%;
    }

    .csvviewer-table-wrapper {
        max-height: 420px;
    }

    #csvViewerTable {
        font-size: 13px;
    }

    #csvViewerTable th,
    #csvViewerTable td {
        padding: 10px 12px;
        min-width: 85px;
        max-width: 220px;
    }
}
