/* Styles specific to the Thumbnail Safe Zones Tool */

/* Upload Section */
.upload-section {
    text-align: center;
    margin-bottom: 0.5rem; /* Reduced margin from original inline */
}

#drop-zone {
    border: 2px dashed var(--border-color);
    border-radius: 8px;
    padding: 3rem 1rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: border-color 0.3s ease, background-color 0.3s ease;
}

#drop-zone.drag-over {
    border-color: var(--accent-color);
    background-color: rgba(0, 123, 255, 0.05); /* Light blue tint */
}
body.dark-mode #drop-zone.drag-over {
    background-color: rgba(102, 191, 255, 0.1); /* Light blue tint for dark mode */
}

#drop-zone p {
    color: var(--text-color);
    opacity: 0.8;
    pointer-events: none; /* Allow clicks to pass through */
}

#file-input {
    display: none; /* Hide the default input */
}

.file-label {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    background-color: var(--accent-color);
    color: var(--bg-color-light); /* Light text on button */
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    font-weight: 500;
}
body.dark-mode .file-label {
    color: var(--bg-color-dark); /* Dark text on button in dark mode */
}

.file-label:hover {
    opacity: 0.9;
}

#upload-status {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    color: #dc3545; /* Error color - Consider using --error-text */
    min-height: 1.4em; /* Reserve space */
}
body.dark-mode #upload-status {
     color: #f8d7da; /* Error color dark - Consider using --error-text */
}

/* Preview Section */
#preview-container {
    padding: 0;
    margin-top: 1rem;
}

#preview-container.hidden {
    display: none;
}

.preview-grid {
    display: grid;
    /* Responsive grid columns */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    align-items: start; /* Align items to the top */
}

.preview-box {
    text-align: center;
}

.preview-wrapper {
    position: relative; /* For absolute positioning of the label */
    width: 100%;
    overflow: hidden; /* Hide parts of image that don't fit */
    background-color: var(--preview-bg); /* Background for transparent images */
    border: 1px solid var(--border-color);
    border-radius: 4px;
}

/* Specific aspect ratios for wrappers using the aspect-ratio property */
.aspect-1-1 { aspect-ratio: 1 / 1; }
.aspect-9-16 { aspect-ratio: 9 / 16; }
.aspect-4-5 { aspect-ratio: 4 / 5; }
.aspect-16-9 { aspect-ratio: 16 / 9; }

/* Image within the wrapper */
.preview-box img {
    display: block;
    width: 100%;
    height: 100%;
    /* 'contain' fits the image within the bounds, showing the safe zone effect */
    /* Use 'cover' if you want it to fill the box and crop */
    object-fit: contain;
    object-position: center center;
}

/* Corner aspect ratio label */
.aspect-ratio-label {
    position: absolute;
    top: 4px;
    left: 4px;
    background-color: var(--label-bg); /* Uses theme variable */
    color: var(--label-text);      /* Uses theme variable */
    padding: 2px 6px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 3px;
    line-height: 1;
    z-index: 1; /* Ensure it's above the image */
    pointer-events: none; /* Don't interfere with clicks */
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Responsive Adjustments specific to this tool */
@media (max-width: 600px) {
    .preview-grid {
        /* Adjust grid for smaller screens */
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
        gap: 1rem;
    }

    .aspect-ratio-label {
        font-size: 0.65rem;
        padding: 1px 4px;
        top: 3px;
        left: 3px;
    }
}