/* File Viewer Tool Styles */

.tool-form {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding: 1.5rem;
    background: #f8f9fa;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 1.5rem;
}

/* File Upload Section */
.file-upload-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.file-upload-label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(145deg, #4a90e2, #357abd);
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s ease;
    box-shadow: 0 4px 8px rgba(74, 144, 226, 0.3);
    line-height: 1;
}

.file-upload-label i {
    font-size: 1.2rem;
    vertical-align: middle;
    margin-bottom: 2px;
}

.file-upload-label:hover {
    background: linear-gradient(145deg, #357abd, #2968a3);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(74, 144, 226, 0.4);
}

.file-upload-label i {
    font-size: 1.2rem;
}

#file-input {
    display: none;
}

.file-info {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #e9f5ff;
    border-radius: 8px;
    border-left: 4px solid #4a90e2;
}

.file-name {
    font-weight: 600;
    color: #333;
    max-width: 70%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.file-size {
    color: #666;
    font-size: 0.9rem;
}

/* Encoding Options */
.encoding-options {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.option-group {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.option-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-weight: 500;
}

.option-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

/* File Content Display */
.file-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.content-table {
    width: 100%;
    border-collapse: collapse;
}

.table-header {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    background: #f0f4f8;
    border-bottom: 2px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 10;
}

.header-cell {
    min-width: 0;
    padding: 0.75rem 1rem;
    text-align: center;
    font-weight: 600;
    color: #333;
    border-right: 1px solid #ddd;
}

.header-cell:last-child {
    border-right: none;
}

.table-body-container {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    height: min(62vh, 620px);
    min-height: 320px;
    overflow: hidden;
}

.table-column {
    min-width: 0;
    min-height: 0;
    overflow: hidden;
    border-right: 1px solid #eee;
}

.table-column:last-child {
    border-right: none;
}



.column-content {
    width: 100%;
    height: 100%;
    overflow: auto;
    font-family: 'Courier New', monospace;
    scrollbar-gutter: stable;
    contain: strict;
    overscroll-behavior: contain;
}

.column-virtual-stage {
    position: relative;
    min-height: 100%;
}

.ascii-column .column-virtual-stage { min-width: 34ch; }
.hex-column .column-virtual-stage { min-width: 108ch; }
.binary-column .column-virtual-stage { min-width: 300ch; }

.ascii-column .column-content {
    background: #f9f9f9;
}

.hex-column .column-content {
    background: #f5f9ff;
}

.binary-column .column-content {
    background: #f5fff5;
}

.column-row {
    position: absolute;
    left: 0;
    display: block;
    box-sizing: border-box;
    width: 100%;
    height: 29px;
    line-height: 28px;
    padding: 0 0.75rem;
    border-bottom: 1px solid #eee;
    font-family: 'Courier New', monospace;
    white-space: pre;
}

.column-row:hover {
    background: rgba(0, 0, 0, 0.05);
}

.ascii-column .column-row {
    font-size: 0.9rem;
    color: #333;
}

.hex-column .column-row {
    font-size: 0.85rem;
    color: #0066cc;
}

.binary-column .column-row {
    font-size: 0.75rem;
    color: #008800;
}

/* Tool Message */
.tool-message {
    background: #fff3cd;
    border: 1px solid #ffeeba;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    color: #856404;
}

.tool-message.error {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.tool-message.success {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

/* Upload Progress Overlay */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.upload-progress-container {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    width: 90%;
    max-width: 400px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.upload-icon {
    font-size: 3rem;
    color: #4a90e2;
    margin-bottom: 1rem;
}

.upload-progress-container h3 {
    margin-bottom: 1.5rem;
    color: #333;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 1rem;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #4a90e2, #357abd);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 1.2rem;
    font-weight: 600;
    color: #4a90e2;
    margin-bottom: 1rem;
}

.upload-progress-container p {
    color: #666;
    font-size: 0.9rem;
}

/* Tool Hint */
.tool-hint {
    text-align: center;
    color: #666;
    font-style: italic;
    margin-top: 1rem;
}

/* Responsive Design */
@media (max-width: 768px) {
    .tool-form {
        padding: 1rem;
    }
    
    .option-group {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .table-body-container { height: min(58vh, 520px); }
    
    .column-row {
        padding: 0 0.4rem;
        font-size: 0.8rem;
    }
    
    .ascii-column .column-row {
        font-size: 1rem;
    }
    
    .binary-column .column-row {
        font-size: 0.7rem;
    }
    
    .file-info {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .file-name {
        max-width: 100%;
    }
}

@media (max-width: 480px) {
    .column-row {
        padding: 0 0.3rem;
        font-size: 0.75rem;
    }
    
    .ascii-column .column-row {
        font-size: 0.9rem;
    }
    
    .binary-column .column-row {
        font-size: 0.65rem;
    }
}
