/* static/css/history.css */

/* ##########################
        Color Setting
########################## */ 
:root {
    --bg-history-item: none;
    --bg-history-item-hover: rgb(100,100,100);
    --text-history-item: rgb(255,255,255);
    --bg-history-menu-btn: rgb(255,255,255);
    --bg-history-action-menu: rgb(47,47,47);
    --bg-history-action-menu-button-hover: rgb(80,80,80);
    --text-history-action-menu-button:rgb(255,255,255);
}

[data-theme="light"] {
    --bg-history-item: none;
    --bg-history-item-hover: rgb(97, 136, 155);
    --text-history-item: rgb(255,255,255);
    --bg-history-menu-btn: rgb(255,255,255);
    --bg-history-action-menu: rgb(74, 106, 118);
    --bg-history-action-menu-button-hover: rgb(97, 136, 155);
    --text-history-action-menu-button:rgb(255,255,255);
}



/* #########################
        History Item
######################### */ 

/* Main Settings */
#upload-new-img-btn {
    display: flex;
    position: relative;
    z-index: 4000;
    justify-content: flex-start;
    align-items: center;
    width: 160px;
    height: 35px;
    margin: 0px 15px 15px 15px;
    background: var(--bg-upload-new-img-btn);
    color: var(--text-upload-new-img-btn);
    border: var(--border-upload-new-img-btn);
    border-radius: 15px;
    font-family: 'PingFangHKWeb', sans-serif;
    font-weight: 500;
    font-size: 15px;
}
.btn-icon {
    width: 16px;
    height: 16px;
    margin-left: 8px;
    object-fit: contain;
}
.btn-plus {
    margin-left: 10px;
    margin-right: 25px;
}
#history-container-wrapper{
    overflow: hidden;
    transition: max-height 0.22s ease, opacity 0.18s ease, margin-top 0.18s ease;
    max-height: 2000px;
    opacity: 1;
    margin-top: 0;
}
#history-container-wrapper.collapsed{
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}
#history-container {
    margin: 0;
    padding: 8px 20px 20px 20px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: none;
    overflow: visible;
    box-sizing: border-box;
}
.file_icon {
    width: 14px;
    height: 20px;
    margin: 0 15px 0 0;
}
.history-item {
    position: relative;
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 35px;
    width: 100%;
    padding: 8px 36px 8px 12px;
    background: var(--bg-history-item);
    border: none;
    border-radius: 15px;
    color: var(--text-history-item);
    font-family: 'PingFangHKWeb', sans-serif;
    font-size: 14px;
    text-align: left;
    cursor: pointer;
    margin-bottom: 8px;
    overflow: hidden;
}
.history-item:hover {
    background: var(--bg-history-item-hover);
}
.history-item.selected {
    background: var(--bg-history-item-hover);
}
.history-item:hover .history-menu-btn {
    display: block;
}

/* File Name Tooltip */
.history-item::after {
    content: attr(data-tooltip);
    position: fixed;
    left: 190px;
    top: var(--tooltip-y, 0px);

    max-width: 260px;
    padding: 7px 10px;

    background: var(--bg-history-item-hover);
    color: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);

    font-family: 'PingFangHKWeb', sans-serif;
    font-size: 13px;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;

    opacity: 0;
    pointer-events: none;
    z-index: 6000;
    transform: translateY(-50%);
}
.history-item:hover::after {
    opacity: 1;
}
.history-filename {
  flex: 1 1 auto;       
  min-width: 0;         
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* Drag and Drop */
.history-item[draggable="true"]{
    cursor: grab;
}
.history-item[draggable="true"]:active{
    cursor: grabbing;
}
#history-container.drag-over-images{
    outline: 1px dashed rgba(255,255,255,0.4);
    border-radius: 12px;
}



/* ###########################
    History Menu Button
########################### */ 

/* Main Settings */
.history-menu-btn {
    position: absolute;
    top: 50%;
    right: 8px;
    transform: translateY(-50%);
    display: none;
    background: transparent;
    border: none;
    color: var(--bg-history-menu-btn);
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.history-action-menu {
    position: absolute;
    transform: none !important;
    width: 15px;
    height: 170px;
    margin: 0 !important;
    background: var(--bg-history-action-menu);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    padding: 4px 0;
    min-width: 140px;
    display: none;
}
.history-action-menu button {
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-history-action-menu-button);
    text-align: left;
    cursor: pointer;
}
.history-action-menu button:hover {
    background: var(--bg-history-action-menu-button-hover);
}

/* History Delete Modal (Whether to Delete History Item) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 5000;
}
.modal-box {
    background: var(--bg-modal-box);
    padding: 20px;
    border-radius: 6px;
    text-align: center;
    color: var(--text-modal-box);
}
.modal-box p {
    margin-bottom: 16px;
    font-size: 1.2rem;
}
.modal-actions button {
    margin: 0 8px;
    padding: 8px 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    color: #fff;
}
#modal-delete {
    background: rgb(204,0,0);
}
#modal-delete:hover {
    background: rgb(255,0,0);
}
#modal-cancel {
    background: rgb(100,100,100);
}





/* ============================
   Multi-select selected state
============================ */
.history-item.multi-selected,
.project-image-item.multi-selected {
    border: 3px solid rgba(135, 206, 250, 0.95) !important;
    box-shadow: 0 0 0 1px rgba(135, 206, 250, 0.35);
    background: rgba(100, 100, 100, 0.35);
}
/* avoid border thickness change */
.history-item,
.project-image-item {
    box-sizing: border-box;
}

/* ============================
   Multi action menu
============================ */
.multi-action-menu {
    position: fixed;
    min-width: 155px;
    background: var(--bg-history-action-menu);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    padding: 4px 0;
    display: none;
    z-index: 3200;
    overflow: visible;
}
.multi-action-menu button {
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-history-action-menu-button);
    text-align: left;
    cursor: pointer;
    font-family: 'PingFangHKWeb', sans-serif;
    font-size: 14px;
}
.multi-action-menu button:hover {
    background: var(--bg-history-action-menu-button-hover);
}
.multi-move-wrapper {
    position: relative;
}
.multi-move-submenu {
    position: absolute;
    top: 0;
    left: calc(100% - 4px);
    min-width: 160px;
    max-width: 220px;
    background: var(--bg-history-action-menu);
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.6);
    padding: 4px 0;
    display: none;
    z-index: 3300; 

    max-height: calc(100vh - 16px);
    overflow-y: auto;
}
.multi-move-submenu.visible {
    display: block;
}
.multi-move-option,
.multi-move-to-images-option,
.multi-move-empty {
    width: 100%;
    padding: 8px 12px;
    background: none;
    border: none;
    color: var(--text-history-action-menu-button);
    text-align: left;
    cursor: pointer;
    font-family: 'PingFangHKWeb', sans-serif;
    font-size: 13px;
}
.multi-move-option:hover,
.multi-move-to-images-option:hover {
    background: var(--bg-history-action-menu-button-hover);
}
.multi-move-empty:disabled {
    opacity: 0.5;
    cursor: default;
}
.multi-cancel-btn {
    border-top: 1px solid rgba(255,255,255,0.14) !important;
    margin-top: 4px;
}
.multi-cancel-btn:hover {
    background: rgba(120,120,120,0.55) !important;
}
.multi-project-folder-cancel-btn {
    border-top: 1px solid rgba(255,255,255,0.14) !important;
    margin-top: 4px;
}
.multi-project-folder-cancel-btn:hover {
    background: rgba(120,120,120,0.55) !important;
}









/* Demo History Items (Currently unavailable) */
.history-item.is-demo {
    background: var(--bg-history-item);   
    color: var(--text-history-item);
}
.history-item.is-demo:hover,
.history-item.is-demo.selected {
    background: linear-gradient(90deg, rgb(233, 121, 189) 0%, rgb(194, 106, 189) 50%, rgb(150, 89, 189) 100%);  
}