/**
 * Custom styles for Binwalk WASM application
 * Provides enhanced styling for hex viewer and overall UI polish
 */

/* Body and layout */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background-color: #f8f9fa;
}

/* Card enhancements */
.card {
    border: none;
    border-radius: 8px;
}

.card-header {
    font-weight: 600;
    border-radius: 8px 8px 0 0 !important;
}

/* Table styling */
.table {
    font-size: 0.9rem;
}

.table thead th {
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.5px;
}

.table-hover tbody tr:hover {
    background-color: rgba(0, 123, 255, 0.05);
    cursor: pointer;
}

/* Hex Viewer Styles */
.hex-viewer-container {
    background-color: #1e1e1e;
    color: #d4d4d4;
    padding: 20px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 14px;
    max-height: 500px;
    overflow-y: auto;
    overflow-x: auto;
}

.hex-viewer {
    white-space: pre;
    line-height: 1.6;
}

.hex-line {
    display: flex;
    margin-bottom: 2px;
}

.hex-offset {
    color: #569cd6;
    margin-right: 20px;
    user-select: none;
    flex-shrink: 0;
}

.hex-bytes {
    color: #ce9178;
    margin-right: 20px;
    font-family: 'Courier New', Courier, monospace;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.hex-ascii {
    color: #4ec9b0;
    font-family: 'Courier New', Courier, monospace;
    flex-shrink: 0;
}

/* Hex compare specific styles */
.hex-compare-line {
    display: flex;
    margin-bottom: 2px;
}

.hex-compare-bytes {
    display: inline-flex;
    margin-right: 20px;
    gap: 16px;
}

.hex-compare-ascii {
    display: inline-flex;
    gap: 16px;
}

.hex-bytes-file1,
.hex-bytes-file2 {
    font-family: 'Courier New', Courier, monospace;
}

.hex-ascii-file1,
.hex-ascii-file2 {
    font-family: 'Courier New', Courier, monospace;
}

.hex-byte {
    display: inline-block;
    min-width: 18px;
    text-align: center;
}

.hex-byte-diff,
.hex-ascii-diff {
    background-color: rgba(220, 53, 69, 0.35); /* bootstrap danger red-ish */
}

.hex-byte-selected,
.hex-ascii-selected {
    background-color: #ffc107;
    color: #000;
}

.hex-compare-map {
    height: 500px;
    background-color: #111;
    border-radius: 4px;
    border: 1px solid #333;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.hex-compare-map-segment {
    flex: 1;
    background-color: #222;
    cursor: pointer;
}

.hex-compare-map-segment.has-diff {
    background-color: #dc3545;
}

.hex-compare-map-segment:hover {
    background-color: #ff6b81;
}

/* Custom scrollbar for hex viewer */
.hex-viewer-container::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.hex-viewer-container::-webkit-scrollbar-track {
    background: #2d2d2d;
}

.hex-viewer-container::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 6px;
}

.hex-viewer-container::-webkit-scrollbar-thumb:hover {
    background: #777;
}

/* Button enhancements */
.btn {
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.btn:active {
    transform: translateY(0);
}

/* Badge styling */
.badge {
    font-weight: 500;
    padding: 0.35em 0.65em;
    border-radius: 4px;
}

/* Progress card styling */
#progressCard {
    border-left: 4px solid #0d6efd;
}

/* File info table */
#fileInfoCard table th {
    width: 40%;
    font-weight: 600;
    color: #495057;
}

#fileInfoCard table td {
    word-break: break-all;
}

/* Welcome message */
#welcomeMsg {
    border: 2px dashed #dee2e6;
    background-color: #ffffff;
}

#welcomeMsg .display-1 {
    font-size: 4rem;
}

/* Modal enhancements */
.modal-content {
    border-radius: 8px;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.modal-header {
    border-radius: 8px 8px 0 0;
}

/* File input styling */
.form-control:focus {
    border-color: #0d6efd;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

/* Sticky table header */
.sticky-top {
    position: sticky;
    top: 0;
    z-index: 10;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .hex-viewer-container {
        font-size: 11px;
        padding: 10px;
    }
    
    .hex-offset {
        margin-right: 10px;
    }
    
    .hex-bytes {
        margin-right: 10px;
    }
    
    #welcomeMsg .display-1 {
        font-size: 2.5rem;
    }
}

/* Loading animation */
@keyframes pulse {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.spinner-border {
    animation: pulse 1.5s ease-in-out infinite;
}

/* Tooltip styling */
.tooltip {
    font-size: 0.875rem;
}

/* Category badge colours - enhanced */
.badge.bg-light {
    color: #212529;
    border: 1px solid #dee2e6;
}

/* Code elements */
code {
    background-color: #f8f9fa;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.9em;
}

/* Navbar enhancement */
.navbar {
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Card hover effect */
.card {
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

/* Action buttons in table */
.table td .btn {
    margin-right: 4px;
    margin-bottom: 4px;
}

/* Hex viewer controls */
.hex-viewer-controls {
    position: sticky;
    top: 0;
    z-index: 5;
}

/* Custom colour scheme variables */
:root {
    --primary-color: #0d6efd;
    --success-color: #198754;
    --info-color: #0dcaf0;
    --warning-color: #ffc107;
    --danger-color: #dc3545;
    --dark-color: #212529;
}

/* Accessibility improvements */
.btn:focus-visible,
.form-control:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* Print styles */
@media print {
    .navbar,
    .card-header,
    .btn,
    #progressCard {
        display: none;
    }
    
    .card {
        box-shadow: none;
        border: 1px solid #dee2e6;
    }
}
