/* 
    MerchStudio version 0.01 - Core CSS File
    Copyright (c) 2025 Michael Lewis White and MerchStudio Inc.
    Common CSS (both admin and client side) for MerchStudio App
    @version common/css/image.css - 0.01 - 05-24-2025 - totaltec
    
    # included by client/css_load.tpl, admin/css_load.tpl
*/

/* MerchStudio - Image Input Grid Styling (Final Colors) */

/* Styles for the grid container itself */
.thumbnail_grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px; /* Space between grid items */
}

/* Base style for ALL items in the grid 
   (thumbnails & the "add new" drop zone button) */
.image_grid_item {
    position: relative;
    width: 120px;
    height: 120px;
    background-color: var(--base);
    border-radius: 8px; 
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    box-sizing: border-box;
}

/* L-shaped corners for ALL grid items */
.image_grid_item::before,
.image_grid_item::after {
    content: '';
    position: absolute;
    width: 40px;  /* Size of the L-arm */
    height: 40px; /* Size of the L-arm */
    border-color: var(--contrast);
    border-style: solid;
    transition: border-color 0.2s ease;
    z-index: 1;
}

/* Top-left L-shape for all grid items */
.image_grid_item::before {
    top: 0;
    left: 0;
    border-width: 4px 0 0 4px; 
}

/* Bottom-right L-shape for all grid items */
.image_grid_item::after {
    bottom: 0;
    right: 0;
    border-width: 0 4px 4px 0;
}

/* Specific styles for the "add new" drop zone item */
/* This element will also have the .image_grid_item class */
#image_drop_zone { 
    /* Inherits background and L-corners from .image_grid_item */
    border: 2px dashed var(--contrast); 
    cursor: pointer;
    transition: border-color 0.2s ease, 
                background-color 0.2s ease;
}

/* Icon within the drop zone */
#image_drop_zone .drop_zone_icon {
    width: 48px; 
    height: 48px;
    fill: var(--contrast); /* Icon color matches L-corners */
    transition: fill 0.2s ease;
    pointer-events: none; 
    z-index: 2; 
}

/* Highlight state when dragging over the drop zone */
#image_drop_zone:hover,
#image_drop_zone.highlight {
    /* Uses border-color for the dashed border */
    border-color: var(--highlight);
    background-color: var(--info_bg);
}

/* L-corners on the drop zone also highlight */
#image_drop_zone.highlight::before,
#image_drop_zone.highlight::after {
    border-color: var(--highlight);
}

/* Icon on the drop zone also highlights */
#image_drop_zone.highlight .drop_zone_icon {
    fill: var(--highlight);
}

/* Styling for actual image thumbnails (img tag itself) */
.image_grid_item img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover; 
    border-radius: inherit;
}

/* Note below the grid (e.g., "Multiple images allowed") */
.image_manager small {
    display: block; 
    text-align: left; 
    margin-top: 8px;
    padding-left: 5px;
}

/* Styles for action buttons on existing image thumbnails */
/* (from image_input_thumb.tpl, within .thumb_actions) */
.image_thumb .thumb_actions {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 3; /* Above L-corners and image */
}
.image_drag_handle,
.image_thumb .action_icon {
    background-color: rgba(0,0,0,0.4);
    color: var(--text);
    border-radius: 4px;
    padding: 2px;
    border: none;
    cursor: pointer;
}
/* Drag handle for thumb */
.image_drag_handle {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3; /* Above L-corners and image */
    cursor: grab;
}
.image_drag_handle:hover,
.image_thumb .action_icon:hover .merch_icon {
    color: var(--highlight);
}

/* Container for the progress bar and text */
.image_thumb .thumb_progress {
    position: absolute; 
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 3px 5px; 
    background-color: rgba(0, 0, 0, 0.65); /* Dark overlay */
    box-sizing: border-box;
    z-index: 5; 
}

/* The progress bar itself */
.image_thumb .progress_bar {
    height: 6px;                       /* Thickness of the bar */
    background-color: var(--highlight, #f0c040); /* Color of the bar */
    width: 0%;                         /* Starts empty, JS updates this */
    margin-bottom: 3px;                /* Space below bar, above text */
    border-radius: 2px;                /* Slightly rounded corners */
    transition: width 0.1s ease-out;   /* Smooths width changes */
}

/* Styling for the progress text */
.image_thumb .progress_text {
    display: block;
    width: 100%; 
    font-size: 0.7em; 
    color: #f0f0f0;        /* Light text on dark overlay */
    white-space: nowrap;   
    overflow: hidden;      
    text-overflow: ellipsis;
    line-height: 1.3;      
    text-align: center;    /* Center the percentage */
    font-weight: bold;     
}

/* Styling for individual node images within the node template (sections) */
.node_image { /* This is the <figure> element */
    display: inline-block;
    padding: 4px;
    margin: 5px;
    line-height: 0;
    width: 100%;
    box-sizing: border-box;
}

.node_image img {
    display: block;
    width: 100%;
    height: auto;
    max-width: 100%;
}

.image_placeholder svg {
    width: 100%; 
    height: 100%;
    color: var(--middle_grey); 
}