body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 20px;
    background-color: #000000; 
    color: #ffffff; 
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    overflow-x: hidden; /* Prevent horizontal scroll from canvas interactions */
}

#metaball-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    filter: blur(35px) contrast(45); /* Increased intensity */
    /* The canvas itself needs no background if body is black and balls are white */
}

.container {
    width: 100%;
    max-width: 800px;
    background: rgba(20, 20, 20, 0.65); /* Darkish glass */
    padding: 25px 30px;
    border-radius: 12px; /* Slightly larger radius for glass */
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px); /* Safari */
    position: relative; /* Ensure it's above the canvas */
    z-index: 1;
}

h1 {
    text-align: center;
    color: #ffffff; 
    margin-bottom: 25px;
    font-size: 1.8em;
    padding: 10px;
    border-radius: 6px;
    background: rgba(0,0,0,0.2); /* Subtle background for readability */
    border: 1px solid rgba(255,255,255,0.1);
}

.search-form .form-group {
    margin-bottom: 18px;
}

.search-form label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.95em;
    color: #ffffff; 
}

.search-form input[type="url"],
.search-form input[type="text"] {
    width: 100%;
    padding: 10px 12px;
    background-color: rgba(0, 0, 0, 0.3); 
    color: #ffffff; 
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 5px;
    box-sizing: border-box;
    font-size: 0.95em;
    transition: border-color 0.2s ease-in-out, background-color 0.2s ease-in-out;
}
.search-form input[type="url"]:focus,
.search-form input[type="text"]:focus {
    outline: none;
    border-color: #00aaff; 
    background-color: rgba(0, 0, 0, 0.5); 
    box-shadow: 0 0 0 0.2rem rgba(0,170,255,.35);
}

.search-form small {
    display: block;
    margin-top: 5px;
    font-size: 0.8em;
    color: #bbbbbb; 
}

button#searchButton {
    display: block;
    width: 100%;
    padding: 12px 15px;
    background-color: rgba(0, 0, 0, 0.4); 
    color: #ffffff; 
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    cursor: pointer;
    font-size: 1.05em;
    font-weight: 500;
    transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
}

button#searchButton:hover:not(:disabled) {
    background-color: rgba(20, 20, 20, 0.5); 
    border-color: rgba(255, 255, 255, 0.5);
}
button#searchButton:disabled {
    background-color: rgba(10, 10, 10, 0.3);
    color: #777777; 
    border-color: rgba(255, 255, 255, 0.1);
    cursor: not-allowed;
    opacity: 0.7;
}

#loadingIndicator {
    display: flex; 
    align-items: center;
    justify-content: center;
    padding: 20px;
    font-size: 1.1em;
    color: #ffffff; 
    text-align: center; 
    background: rgba(0,0,0,0.1);
    border-radius: 4px;
    margin-top: 15px;
}

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.25); 
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border-left-color: #ffffff; 
    animation: spin 1s ease infinite;
    margin-right: 10px; 
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

#errorMessages {
    margin-top: 15px;
    padding: 12px;
    background-color: rgba(50, 0, 0, 0.7); /* Dark red, semi-transparent */
    border: 1px solid #ff4444; 
    border-left: 5px solid #ff6666; 
    color: #ffffff; 
    border-radius: 4px;
    font-size: 0.9em;
}

#errorMessages:empty {
    display: none;
}

#resultsCount {
    margin-top: 25px;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 1.1em;
    color: #ffffff; 
    padding: 5px;
}

#resultsList {
    list-style-type: none;
    padding: 0;
    margin-top: 10px;
    max-height: 450px; 
    overflow-y: auto;
    background-color: rgba(0, 0, 0, 0.2); 
    border-radius: 6px;
    padding: 10px; 
    border: 1px solid rgba(255,255,255,0.1);
}

#resultsList li {
    background-color: rgba(10, 10, 10, 0.4); /* Slightly darker item background */
    border: 1px solid rgba(255,255,255,0.1);
    padding: 10px 12px;
    font-size: 0.95em;
    color: #ffffff; 
    margin-bottom: 8px; 
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex; /* Arrange main info and preview */
    flex-direction: column; /* Stack them vertically */
    gap: 10px; /* Space between file info and preview container */
}
#resultsList li:last-child {
    border-bottom: 1px solid rgba(255,255,255,0.1); 
     margin-bottom: 0;
}
#resultsList li:hover {
    background-color: rgba(30,30,30,0.5);
}

#resultsList li a {
    text-decoration: none;
    color: #87CEFA; 
}

#resultsList li a:hover {
    text-decoration: underline;
    color: #ADD8E6; 
}

.file-icon {
    margin-right: 10px;
    font-size: 1.2em;
}

.preview-container {
    margin-top: 5px; /* Adjusted from 10px, as li now uses gap */
    background-color: #0A0A0A;
    border: 1px solid #333;
    border-radius: 4px;
    box-shadow: inset 2px 2px 5px #000, inset -2px -2px 5px #181818;
    width: 150px;
    height: 150px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Important for fixed size */
    align-self: flex-start; /* Align with the start of file-main-info */
}

.preview-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 3px;
}

.preview-container pre {
    background-color: #010101 !important;
    color: #f0f0f0 !important;
    padding: 5px;
    border-radius: 0; /* Container has border-radius */
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow: auto;
    border: none; 
    white-space: pre-wrap;
    word-break: break-all;
    font-size: 0.7em; /* Smaller font for compact preview */
    line-height: 1.3;
}

.preview-container .preview-loading,
.preview-container .preview-error {
    padding: 10px;
    color: #aaa;
    text-align: center;
    font-size: 0.85em; /* Adjusted for smaller container */
    word-break: break-word; /* Ensure error messages wrap */
}
.preview-container .preview-error {
    color: #ff8080;
}

.preview-container pre code.hljs {
  padding: 0; 
  background: transparent !important; /* Ensure HLJS theme doesn't override pre background */
}