/* Fixes bug when combined with WebRTC Tweaks module */
#ui-top{
    min-height:0;
}

#hand-mini-bar-container {
    display: flex;
    flex-direction: column;
    z-index: 1;
    position: relative;
    margin: 4px 0;
}

/* Collapsed state container */
#hand-mini-bar-container.hand-mini-bar-hidden {
    width: fit-content;
}

/* Draggable mode styling */
#hand-mini-bar-container.hand-mini-bar-draggable {
    cursor: move;
}

/* White glow effect while actively dragging */
#hand-mini-bar-container.hand-mini-bar-is-dragging {
    box-shadow: 0 0 15px 3px rgba(255, 255, 255, 0.4),
                0 0 25px 8px rgba(255, 255, 255, 0.25);
    filter: drop-shadow(0 0 10px rgba(255, 255, 255, 0.3));
    transition: box-shadow 0.1s ease-in-out, filter 0.1s ease-in-out;
}

/* Override cursor for cards in draggable mode - they should still be draggable */
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-card,
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-window-card {
    cursor: grab;
}

#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-card:active,
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-window-card:active {
    cursor: grabbing;
}

/* Show move cursor on the entire bottom button bar in draggable mode */
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-hidden-buttons {
    cursor: move;
}

/* But individual buttons show pointer cursor */
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-buttons-container .hand-mini-bar-hide-show,
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-buttons-container .hand-mini-bar-add-bar,
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-buttons-container .hand-mini-bar-subtract-bar {
    cursor: pointer;
}

/* Keep pointer cursor on side buttons even in draggable mode */
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-settings .hand-mini-bar-settings-hand,
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-settings .hand-mini-bar-settings-choose,
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-actions .hand-mini-bar-draw,
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-actions .hand-mini-bar-pass {
    cursor: pointer;
}

/* Keep pointer cursor on actual form elements */
#hand-mini-bar-container.hand-mini-bar-draggable button,
#hand-mini-bar-container.hand-mini-bar-draggable a,
#hand-mini-bar-container.hand-mini-bar-draggable input,
#hand-mini-bar-container.hand-mini-bar-draggable select {
    cursor: pointer;
}

/* Card container should not show move cursor */
#hand-mini-bar-container.hand-mini-bar-draggable .hand-mini-bar-card-container {
    cursor: default;
}

#hand-mini-bar-hands-container{
    display:flex;
    flex-direction: column;
    max-height:900px;
    /*ransition: max-height 500ms ease-in-out;*/
    transition: all 500ms ease-in-out;
    padding-bottom: 2px;
    overflow: hidden;    
    margin: 0px 0px 0px auto;
    padding-top: 22px;
}

#hand-mini-bar-container.hand-mini-bar-hidden #hand-mini-bar-hands-container{
    max-height:0px;
    padding-bottom: 0px; 
}

.hand-mini-bar-buttons-container, .hand-mini-bar-buttons-top-container {
    max-height: 28px;
    max-width: 220px;
    min-width: 220px;
    display: flex;
    padding: 4px 8px;
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.3));
    transition: all 0.2s ease-in-out;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 4px;
    margin: 0 auto;
}

.hand-mini-bar-buttons-top-container {
    display: none; /* Hide top container in collapsed state */
}

/* Non-draggable mode - restore original styling */
#hand-mini-bar-container:not(.hand-mini-bar-draggable) .hand-mini-bar-buttons-container {
    background: transparent;
    filter: drop-shadow(4px 6px 4px rgba(0, 0, 0, 0.5));
}

/* Always show the hidden buttons */
.hand-mini-bar-hidden-buttons {
    display: flex;
    flex-grow: 1;
    justify-content: center;
    align-items: center;
    gap: 4px;
}

/* Always hide the show-buttons (ellipsis) */
.hand-mini-bar-show-buttons {
    display: none !important;
}

.hand-mini-bar-buttons-container .hand-mini-bar-add-bar,
.hand-mini-bar-buttons-container .hand-mini-bar-subtract-bar{
    line-height: 1;
    font-size: 20px;
    font-weight: bold;
    color: #c9c7b8;
    -webkit-text-stroke-width: 1px;
    -webkit-text-stroke-color: black;
}

/* Hide/show button styling */
.hand-mini-bar-buttons-container .hand-mini-bar-hide-show {
    position: relative;
    line-height: 1;
    padding: 4px 24px 4px 8px;
    font-size: 22px;
    color: #c9c7b8;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
    transition: all 0.2s ease-in-out;
}

/* Cards icon */
.hand-mini-bar-buttons-container .hand-mini-bar-hide-show::after {
    content: '';
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%) scale(0.9);
    width: 20px;
    height: 16px;
    background-image: url(/modules/hand-mini-bar/artwork/cards.png);
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    opacity: 0.8;
    transition: all 0.2s ease-in-out;
    filter: drop-shadow(1px 1px 1px rgba(0, 0, 0, 0.5));
}

/* Hover states */
.hand-mini-bar-buttons-container .hand-mini-bar-hide-show:hover {
    text-shadow: 0 0 6px rgba(255, 255, 255, 0.8);
}

.hand-mini-bar-buttons-container .hand-mini-bar-hide-show:hover::after {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

/* When container is hidden (collapsed) - arrow points up */
#hand-mini-bar-container.hand-mini-bar-hidden .hand-mini-bar-hide-show {
    transform: rotate(0deg);
    padding-right: 24px;
}

/* When container is visible (expanded) - arrow points down */
#hand-mini-bar-container:not(.hand-mini-bar-hidden) .hand-mini-bar-hide-show {
    transform: rotate(180deg);
}

.hand-mini-bar-buttons-container *,
.hand-mini-bar-buttons-top-container * {
    color: #c9c7b8;
    padding: 0;
    margin: 0 2px;
    cursor: pointer;
    pointer-events: all;
    font-size: 16px;
    line-height: 1;
    height: auto;
    -webkit-text-stroke-width: 1px;
    -webkit-text-stroke-color: black;
    text-shadow: 1px 1px 1px rgba(0, 0, 0, 0.8);
    transition: all 0.2s ease-in-out;
}


.hand-mini-bar-hand{
    display:flex;
    flex-direction: column;
    max-width:200px;
    max-height: 68px;
    margin: 5px 5px 1px 15px;
    color: var(--color-text-light-highlight);
    z-index: var(--z-index-ui);
    pointer-events: all;
}

.hand-mini-bar-hand-inner{
    display:flex;
    flex-direction: row;
    padding: 0;
    border-radius: 5px;
}

.hand-mini-bar-hand-name{
    display:none;
    font-size: 12px;
    color:#FFF;
    text-shadow: 2px 2px #000;
    width: 200px;
    text-align: center;
}

#hand-mini-bar-container.show-names .hand-mini-bar-hand-name{
    display:block;

}

.hand-mini-bar-settings,
.hand-mini-bar-actions{
    display:flex;
    cursor: pointer;
    flex-direction: column; 
    height: 52px;
    background: url(../../../ui/denim075.png) repeat;

}

.hand-mini-bar-settings{
    border-top-left-radius: 5px;
    border-bottom-left-radius: 5px;
}
.hand-mini-bar-actions{
    border-top-right-radius: 5px;
    border-bottom-right-radius: 5px;
}

.hand-mini-bar-settings-hand{
    background-image: url(/modules/hand-mini-bar/artwork/cards.png);
    background-size: 20px;
    background-repeat: no-repeat;
    width: 23px;
    height: 27px;
    background-position-y: 1px;
    background-position-x: 0px;
    border:1px solid #000;
    border-radius: 5px 0 0 0;
    color: #c9c7b8;
}

.hand-mini-bar-settings-choose{
    background-size: 30px;
    background-repeat: no-repeat;
    width: 23px;
    height: 28px;
    border:1px solid #000;
    border-radius:0 0 0 5px;
    color:#c9c7b8;
    font-size: 21px;
    padding-left: 1px;
    line-height: 23px;
}

.hand-mini-bar-settings-choose:before{
    content:'\2699';
}


.hand-mini-bar-reset{
    width: 23px;
    height: 26px;
    background-position-y: 7px;
    border:1px solid #000;
    border-radius:0 0 5px 0;
    color:#c9c7b8;
    padding-left: 2px;
    font-size: 22px;
    line-height: 23px;
}

.hand-mini-bar-reset:before{
    content: "\21bb";
}

.hand-mini-bar-pass{
    width: 23px;
    height: 26px;
    background-position-y: 7px;
    border:1px solid #000;
    border-radius:0 0 5px 0;
    color:#c9c7b8;
    padding-left: 2px;
    font-size: 22px;
    line-height: 23px;
}

.hand-mini-bar-pass:before{
    content: "\21aa";
}

.hand-mini-bar-draw{
    display:block;
    width: 23px;
    height:26px;
    color:#c9c7b8;
    border:1px solid #000;
    border-radius:0 5px 0 0;
    padding-left:1px;
}

.hand-mini-bar-buttons-container .hand-mini-bar-hidden-buttons *:hover{
    filter: drop-shadow(0px 0px 2px #FFF);
}

.hand-mini-bar-settings-choose:hover,
.hand-mini-bar-pass:hover,
.hand-mini-bar-settings-hand:hover,
.hand-mini-bar-draw:hover{
    box-shadow: 0 0 5px #ffff;
}

.hand-mini-bar-draw:before{
    content: '+';
    font-size: 36px;
    line-height: 22px;
}

.hand-mini-bar-card-container{
    display: flex;
    flex-grow: 1;
    flex-direction: row;
    max-width: 154px;
    min-width: 154px;
    max-height: 52px;
    /*To Overlap cards and tokens*/
    padding-left: 14px;
    padding-right: 14px;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    background: rgba(0, 0, 0, 0.5);
    box-shadow: 0 0 5px #444 inset;
}

.hand-mini-bar-card{
    height: 50px;
    width: 50px;
    background-repeat: no-repeat;  
    background-size: auto 50px;
    cursor: pointer;
    /*To Overlap cards and tokens*/
    margin-left: -14px;
    margin-right: -14px;    
    z-index:1000;
    filter: drop-shadow(0px 0px 1px #000);
    transition: margin 500ms;
}

.hand-mini-bar-card:hover{
    margin-top:-24px;
    height:100px;
    flex: none;
    filter:drop-shadow(0px 0px 2px #FFF);
}

.card-description-popup{
    position: absolute;
    padding: 5px;
    border: 1px solid gray;
    background: black;
    font-size: 14px;
    color:white;
    text-align: center;
    z-index: 1001;
    max-width: 240px;
    border-radius: 5px;

}


.hand-mini-bar-message{
    display: flex;
    flex-direction: row;
    text-align: center;
}

.hand-mini-bar-message-info{
    display: flex;
    flex-grow: 1;
    flex-direction: column;
    max-width: 224px;
    padding-left: 4px;
}

.hand-mini-bar-message-name{
    font-size: 16px;
    margin-bottom: 2px;
}

.hand-mini-bar-play-dialog-description,
.hand-mini-bar-play-dialog-face-description{
    text-align:center;
    margin: 0px;
    font-weight: normal;
    font-size: 12px;
}

.cards-dialog div.separator{
    margin: 3px auto 0px auto;
    width: 30px;
    height: 6px;
    border-top: solid 1px #000;
}

.hand-mini-bar-message-card{
    height: 50px;
    width: 50px;
    background-position: center;
    background-size: auto 50px;
    background-repeat:no-repeat;
    cursor:pointer;
    position: relative;
    border: none;
    background-color:transparent;
    box-shadow: none;
}

/* Fixed-position preview overlay - bypasses chat container clipping */
.hand-mini-bar-card-preview{
    position: fixed;
    width: 200px;
    height: 280px;
    background-position: center;
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 10000;
    pointer-events: none;
    transform: translateY(-50%);
    filter: drop-shadow(8px 8px 12px rgba(0, 0, 0, 0.8));
    border-radius: 10px;
    animation: cardPreviewFadeIn 0.15s ease-out;
}

@keyframes cardPreviewFadeIn {
    from {
        opacity: 0;
        transform: translateY(-50%) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

.empty-hand-message{
    margin-left:-10px;
    padding:8px;
}
.empty-hand-message .settings-icon{
    color:greenyellow;
}

/* For displaying at the bottom-right of the screen*/

#ui-bottom.hand-mini-bar{
  display: grid;
  grid-auto-rows: minmax(auto, auto);
}

.hand-mini-bar-right{
    grid-template-columns: minmax(auto, auto) minmax(220px, 220px);
}

.hand-mini-bar-left{
    grid-template-columns: minmax(220px, 220px) minmax(auto, auto) ;
}

.hand-mini-bar #camera-views .camera-view{
    height:auto;
}

#ui-bottom.hand-mini-bar div{
    grid-row: 3;
}

#ui-bottom.hand-mini-bar div#camera-views{
    grid-row: 2;
    display:flex;
    flex-wrap: nowrap;
}

div#hand-mini-bar-container{
    width: fit-content;
    justify-content: end;
}

#ui-bottom.hand-mini-bar div#hand-mini-bar-container{
    grid-row: 1/4;
    grid-column: 2;
}
#ui-bottom.hand-mini-bar-left div#hand-mini-bar-container{
    grid-column: 1;
}

#ui-bottom.hand-mini-bar-right div#hand-mini-bar-container{
    grid-column: 2;
}
/* Window popup css*/
.hand-mini-bar-hand-popout .window-content{
    background: transparent;
}

.hand-mini-bar-window{
    height:100%;
}


.hand-mini-bar-window-cards{    
    max-width: 100%;
    height: calc(100% - 33px);
    display: flex;
    flex-grow: 1;
}

.hand-mini-bar-pile-shortcut-container{
    margin-left: 9px;
    min-height: 20px;
}

.hand-mini-bar-pile-shortcut-container .hand-mini-bar-pile-shortcut{
    max-width: 154px;
    min-width: 154px;
    max-height: 52px;
    border-top: 1px solid #000;
    border-bottom: 1px solid #000;
    background: rgba(0, 0, 0, 0.5);
    color: #FFF;
    text-shadow: 2px 2px #000;
    box-shadow: 0 0 5px #444 inset;
    text-align: center;
    border-radius: 10px;
    cursor: pointer;
    margin: auto;
    margin-bottom:-22px;    
    pointer-events: all;
}
.directory-item .hand-mini-bar-pile-shortcut{    
    background-image: url(/modules/hand-mini-bar/artwork/cards.png);
    background-repeat: no-repeat;
    background-size: 30px;
    width: 40px;
    max-width: 40px;
    background-position: 4px;
    margin-right: 2px;
    cursor: pointer;
}

.hand-mini-bar-pile-shortcut:hover{
    outline: none;
    box-shadow: 0 0 5px #FFF;
}


.hand-mini-bar-window-cards.deck, .hand-mini-bar-window-cards.pile{    
    max-width: 100%;
    height: calc(100% - 33px);
    display: flex;
    flex-grow: 1;
    flex-flow: wrap;
}

.hand-mini-bar-window-cards.hand{    
    max-width: 100%;
    height: calc(100% - 33px);
    display: table;
    width: 100%;
}

.hand-mini-bar-window-cards-row{
    max-width: 100%;
    height: calc(100% - 33px);
    display: table-row;
    flex-grow: 1;
    flex-direction: row;
}
.hand-mini-bar-window-cards-row .card{
    display: table-cell;
}

.hand-mini-bar-window-cards.pile.show-players{    
    overflow-x: scroll;
    flex-flow:nowrap;
}

.hand-mini-bar-window-cards.pile.show-players .hand-mini-bar-window-card{
    margin: 10px;
}

.hand-mini-bar-window-cards.deck .hand-mini-bar-window-card, 
.hand-mini-bar-window-cards.pile .hand-mini-bar-window-card{
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    margin: 6px;
    filter: drop-shadow(0px 0px 6px #000);
    border: none;
    flex-grow: 1;
    max-height: 114px;
    min-width: 100px;
    min-height: 165px;
}

.hand-mini-bar-window-card{
    min-height: 300px;
    background-size: contain;
    background-repeat: no-repeat;
    cursor: pointer;
    margin: 6px;
    filter: drop-shadow(0px 0px 6px #000);
    border: none;
    flex-grow: 1;
}

.fa-hand-mini-bar-open-hand{    
    background-image: url(/modules/hand-mini-bar/artwork/cards.png);
    width: 15px;
    height: 15px;
    background-size: contain;
    display: block;
    margin-top: 6px;
    background-repeat: no-repeat;
    float: left;
}

.hand-mini-bar-window-buttons{
    display:flex;
    top:0;
    padding-bottom:3px;
}

.hand-mini-bar-window-button{    
    flex-grow: 1;
    max-width: 33%;
    margin: 0 1px;
    background: rgba(255, 255, 240, 1);
    border: 1px solid var(--color-border-light-primary);
    border-radius: 3px;
    font-size: var(--font-size-14);
    line-height: 28px;
    font-family: var(--font-primary);
    cursor: pointer;
    text-align: center;
    background: url(../../..//ui/parchment.jpg) repeat;
}

.hand-mini-bar-window-button:hover {
    outline: none;
    box-shadow: 0 0 5px var(--color-shadow-primary);
}

.hand-mini-bar-flip-icon:before{
    content: "\f064";
}

.hand-mini-bar-window-player-container{
    margin-right:2px;
}
.hand-mini-bar-window-player-container-name{
    color:var(--color-border-light-primary);
    border: 1px solid var(--color-border-light-primary);
    text-align:center;
    border-radius: 8px;
    background-color: #000;
    margin-bottom:0px;
}
.hand-mini-bar-window-player-container-cards {
    width: 130px;
    margin: 2px;
    overflow: hidden;
}
.hand-mini-bar-option-container{
    margin:8px 0px;
}

/* Shrink macro bar sooner*/
@media (max-width: 1316px)
{
    #hotbar {
        width: calc(var(--hotbar-width) / 2);
        height: calc(var(--hotbar-height) * 2);
    }
    #hotbar #macro-list {
        grid-template-columns: repeat(5, 50px);
    }
}

@media (max-width: 1065px)
{
    #ui-bottom div#hand-mini-bar-container div#hand-mini-bar-hands-container{
        /*margin-left:24px;*/
    }

    #ui-bottom{
      grid-template-columns: minmax(auto, auto) minmax(244px, 244px);
    }
}

.hand-mini-bar-draggable{
    position: absolute;
    /*Default location*/
    left: 110px;
    top: 50px;
}

.hand-mini-bar-move-handle{
    cursor: move;
    display:none;
    height: 5px;
    width: 30px;
    border-top: 1px solid #c9c7b8;
    border-bottom: 1px solid #c9c7b8;
    padding-bottom: 2px;
    padding-top:2px;
}

.hand-mini-bar-draggable .hand-mini-bar-move-handle{
    display: block;
}