@import url('https://fonts.cdnfonts.com/css/ica-rubrik-black');
@import url('https://fonts.cdnfonts.com/css/poppins');

.top-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 40px;
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(10px);
    z-index: 10;
    border-bottom: 1px solid #8f07a18e;
    box-sizing: border-box;
}

.top-bar-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.5em;
    font-weight: 600;
    color: #fff;
}

.twitch-connect {
    display: flex;
    align-items: center;
    gap: 10px;
}

.twitch-connect .twitch-username-input {
    font-family: 'Poppins', sans-serif;
    background: #25283B;
    border: 1px solid #8f07a18e;
    color: white;
    padding: 8px 12px;
    border-radius: 5px;
    outline: none;
    transition: border-color 0.3s;
}

.twitch-connect .twitch-username-input::placeholder {
    color: #aaa;
}

.twitch-connect .twitch-username-input:focus {
    border-color: #8f07a1;
}

.twitch-connect .connect-btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    background: #8f07a1;
    color: white;
    border: none;
    padding: 9px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

.twitch-connect .connect-btn:hover {
    background: #a129b3;
}

/* Spinner Animation */
.spinner {
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Welcome Message */
.welcome-message {
    font-family: 'Poppins', sans-serif;
    color: #fff;
    font-weight: 500;
}

/* Disconnect Button */
.disconnect-btn {
    background: #a93226; /* A more muted red */
    color: white;
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.disconnect-btn:hover {
    background: #c0392b; /* Brighter red on hover */
    transform: scale(1.1);
}

.twitch-username-input:disabled {
    background-color: #3a3d52;
    color: #888;
    cursor: not-allowed;
}

/* Suggestion Box Styles */
.suggestion-box {
    position: fixed;
    top: 100px; /* Align with the item manager */
    right: 40px; /* Spacing from the edge */
    width: 350px; /* Match the item manager width */
    max-height: 50vh; /* Take up to half the screen height */
    background: rgba(15, 15, 15, 0.85);
    backdrop-filter: blur(8px);
    z-index: 9;
    padding: 20px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border-radius: 8px;
    transform: translateX(calc(100% + 40px)); /* Start hidden off-screen */
    transition: transform 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    display: flex;
    flex-direction: column;
    gap: 15px;
}

body.chat-connected .suggestion-box {
    transform: translateX(0);
}

/* Push the main banner down when the suggestion box is visible */

.suggestion-instructions {
    font-family: 'Poppins', sans-serif;
    color: #ccc;
    text-align: center;
    flex-shrink: 0; /* Prevent instructions from shrinking */
}

.suggestion-instructions .command-highlight {
    font-weight: 600;
    color: #fff;
}

.suggestion-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex-grow: 1;
    overflow-y: auto;
    padding-right: 10px;
}

.suggestion-list::-webkit-scrollbar {
    width: 8px;
}
.suggestion-list::-webkit-scrollbar-track {
    background: #1b1b1b;
    border-radius: 4px;
}
.suggestion-list::-webkit-scrollbar-thumb {
    background: #8f07a1;
    border-radius: 4px;
}
.suggestion-list::-webkit-scrollbar-thumb:hover {
    background: #a129b3;
}

.suggestion-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 5px;
    border-bottom: 1px solid #444;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-name {
    font-family: 'Poppins', sans-serif;
    font-weight: 500;
    color: #fff;
    flex-grow: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.suggestion-count {
    font-family: 'Poppins', sans-serif;
    font-size: 0.9em;
    color: #ccc;
    background: #3a3d52;
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.add-suggestion-btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    background: #27ae60; /* Green for add */
    color: white;
    border: none;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    flex-shrink: 0;
}

.item-manager {
    position: fixed;
    top: 100px; /* Below the top bar */
    bottom: 40px; /* Set a bottom boundary to create a fixed height */
    left: 40px;
    width: 350px;
    background: rgba(20, 20, 20, 0.7);
    backdrop-filter: blur(10px);
    border: 1px solid #8f07a18e;
    border-radius: 8px;
    padding: 20px;
    z-index: 9;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.item-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 5px 8px 5px;
    margin-bottom: 5px;
    font-weight: 600;
    color: #ccc;
    border-bottom: 1px solid #555;
}

.header-image {
    width: 40px; /* Corresponds to item-image width */
    margin-right: 10px;
}

.header-name {
    flex-grow: 1;
}

.header-chances {
    margin: 0 10px;
}

.header-action-spacer {
    width: 24px; /* width of remove button */
}

.item-list {
    list-style: none;
    padding: 0;
    padding-right: 10px; /* Prevent scrollbar from overlapping content */
    margin: 0;
    flex-grow: 1; /* Make the list fill the available vertical space */
    overflow-y: auto; /* Add scroll if needed */
}

.item-list::-webkit-scrollbar {
    width: 8px;
}
.item-list::-webkit-scrollbar-track {
    background: #25283B;
    border-radius: 4px;
}
.item-list::-webkit-scrollbar-thumb {
    background: #8f07a1;
    border-radius: 4px;
}
.item-list::-webkit-scrollbar-thumb:hover {
    background: #a129b3;
}

.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 5px;
    border-bottom: 1px solid #444;
}

.list-item:last-child {
    border-bottom: none;
}

.list-item .item-image {
    width: 40px;
    border-radius: 4px;
    aspect-ratio: 200 / 250;
    object-fit: cover;
    margin-right: 10px;
    background-color: #1b1b1b; /* Fallback color */
}

.item-name {
    flex-grow: 1;
}

.item-chances-input {
    width: 50px;
    background: #25283B;
    border: 1px solid #8f07a18e;
    color: white;
    padding: 4px 8px;
    border-radius: 5px;
    text-align: center;
    font-family: 'Poppins', sans-serif;
    outline: none;
    margin: 0 10px;
    -moz-appearance: textfield; /* Firefox */
}

/* Hide number input arrows in WebKit browsers */
.item-chances-input::-webkit-outer-spin-button,
.item-chances-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}



.remove-item-btn {
    background: none;
    color: #c0392b;
    border: none;
    width: 24px;
    height: 24px;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.remove-item-btn:hover {
    color: #e74c3c;
    transform: scale(1.1);
}

.add-item-btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    background: #8f07a1;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1em;
    margin-top: 10px; /* Space above the button */
}

.add-item-btn:hover {
    background: #a129b3;
}

.banner{
    width: 100%;
    margin: 0 auto;
    height: 100vh;
    text-align: center;
    overflow: hidden;
    position: relative;
    padding-top: 75px; /* Account for fixed top bar */
}
.banner .slider{
    position: absolute;
    width: 110px;
    height: 150px;
    top: 10%;
    left: calc(50% - 100px);
    transform-style: preserve-3d;
    transform: perspective(1000px) rotateX(-16deg);
    animation: autoRun 20s linear infinite;
    z-index: 2;
}
@keyframes autoRun{
    from{
        transform: perspective(1000px) rotateX(-16deg) rotateY(0deg);
    }to{
        transform: perspective(1000px) rotateX(-16deg) rotateY(360deg);
    }
}

.banner .slider .item{
    font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif;
    color: white;
    text-shadow: -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000, 1px 1px 0 #000;
    position: absolute;
    text-align: center;

    border: #0006 5px solid;

    inset: 0 0 0 0;
    transform: 
        rotateY(calc( (var(--position) - 1) * (360 / var(--quantity)) * 1deg))
        translateZ(550px);
}
.banner .slider .item img{
    width: 100%;
    height: 100%;
    object-fit: cover;
    /* position: absolute; */
    z-index: -1;
    /* Change the browser's upscaling algorithm for a sharp, pixelated look */
    image-rendering: -moz-crisp-edges;          /* Firefox */
    image-rendering: -webkit-crisp-edges;       /* Webkit */
    image-rendering: pixelated;                 /* Modern browsers */
}
.banner .content{
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: min(1400px, 100vw);
    height: max-content;
    padding-bottom: 100px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    z-index: 1;
}
.banner .content h1{
    font-family: 'ICA Rubrik';
    font-size: 16em;
    line-height: 1em;
    color: #25283B;
    position: relative;
}
.banner .content h1::after{
    position: absolute;
    inset: 0 0 0 0;
    content: attr(data-content);
    z-index: 2;
    -webkit-text-stroke: 2px #d2d2d2;
    color: transparent;
}
.banner .content .author{
    font-family: Poppins;
    text-align: right;
    max-width: 200px;
}
.banner .content h2{
    font-size: 3em;
}
.banner .content .model{
    width: 100%;
    height: 75vh;
    position: absolute;
    bottom: 0;
    left: 0;
    background-size: auto 130%;
    background-repeat: no-repeat;
    background-position: top center;
    z-index: 1;
}
@media screen and (max-width: 1023px) {
    .banner .slider{
        width: 160px;
        height: 200px;
        left: calc(50% - 80px);
    }
    .banner .slider .item{
        transform: 
            rotateY(calc( (var(--position) - 1) * (360 / var(--quantity)) * 1deg))
            translateZ(300px);
    }
    .banner .content h1{
        text-align: center;
        width: 100%;
        text-shadow: 0 10px 20px #000;
        font-size: 7em;
    }
    .banner .content .author{
        color: #fff;
        padding: 20px;
        text-shadow: 0 10px 20px #000;
        z-index: 2;
        max-width: unset;
        width: 100%;
        text-align: center;
        padding: 0 30px;
    }
}
@media screen and (max-width: 767px) {
    .banner .slider{
        width: 100px;
        height: 150px;
        left: calc(50% - 50px);
    }
    .banner .slider .item{
        transform: 
            rotateY(calc( (var(--position) - 1) * (360 / var(--quantity)) * 1deg))
            translateZ(180px);
    }
    .banner .content h1{
        font-size: 5em;
    }
}

/* Modal Styles */
.hidden {
    display: none !important;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
    z-index: 100;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 15vh;
    overflow-y: auto; /* Allows scrolling if modal is too tall for viewport */
}

.modal-content {
    position: relative;
    background: #25283B;
    padding: 30px 40px;
    border-radius: 10px;
    border: 1px solid #8f07a18e;
    width: 90%;
    max-width: 800px;
    color: #fff;
    font-family: 'Poppins', sans-serif;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.modal-close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #aaa;
    font-size: 2em;
    cursor: pointer;
    transition: color 0.3s;
}

.modal-close-btn:hover {
    color: #fff;
}

.modal-content h2 {
    text-align: center;
    font-weight: 600;
}

.modal-form {
    display: flex;
    gap: 15px;
}

.modal-form input {
    flex-grow: 1;
    font-family: 'Poppins', sans-serif;
    background: #1b1b1b;
    border: 1px solid #8f07a18e;
    color: white;
    padding: 10px 15px;
    border-radius: 5px;
    outline: none;
    font-size: 1em;
}

.modal-form button {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    background: #8f07a1;
    color: white;
    border: none;
    padding: 10px 25px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    font-size: 1em;
}

.image-results-label {
    font-size: 0.9em;
    color: #ccc;
    border-top: 1px solid #444;
    padding-top: 20px;
}

.image-results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    max-height: 45vh;
    overflow-y: auto;
    padding: 5px;
}

.image-result-item {
    position: relative;
    width: 100%;
    aspect-ratio: 200 / 250;
    border-radius: 5px;
    border: 3px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s;
    overflow: hidden; /* Ensures inner image respects the border-radius */
}

.image-result-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-result-item:hover {
    border-color: #8f07a1;
    transform: scale(1.05);
}

.default-image-option span {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    text-align: center;
    pointer-events: none; /* Allows clicks to pass through to the container */
}

#spin-btn {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    padding: 10px 80px;
    font-family: 'ICA Rubrik';
    font-size: 2.2em;
    color: white;
    background: #8f07a1;
    border: 1px solid #6c057a; /* Top/side border */
    border-bottom: 6px solid #6c057a; /* 3D bottom edge */
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.1s ease-in-out;
    box-shadow: 0 5px 15px rgba(0,0,0,0.4);
}

#spin-btn:hover {
    background: #a129b3;
    transform: translateX(-50%) translateY(-2px) scale(1.02);
    box-shadow: 0 8px 20px rgba(0,0,0,0.5);
}

#spin-btn:active {
    transform: translateX(-50%) translateY(4px); /* "Press" the button down */
    border-bottom: 2px solid #6c057a; /* Make the edge almost disappear */
    box-shadow: 0 2px 5px rgba(0,0,0,0.4); /* Reduce the shadow */
}

#spin-btn:disabled {
    background: #7f8c8d;
    border-bottom: 6px solid #616b6c;
    cursor: not-allowed;
}

.winner-content {
    text-align: center;
}

.winner-display {
    margin-top: 20px;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.winner-display img {
    width: 200px;
    aspect-ratio: 200 / 250;
    object-fit: cover;
    border-radius: 8px;
    border: 5px solid #8f07a1;
}

.alert-content {
    max-width: 450px;
    text-align: center;
}

.alert-content p {
    font-size: 1.1em;
    margin-top: 10px;
}

.winner-actions {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 25px;
    border-top: 1px solid #444;
    padding-top: 25px;
    flex-wrap: wrap;
}

.winner-btn {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s, opacity 0.3s;
    font-size: 1em;
}

#winner-action-remove {
    background-color: #c0392b; /* Red */
}
#winner-action-remove:hover {
    background-color: #e74c3c;
}

#winner-action-keep {
    background-color: #7f8c8d; /* Grey */
}
#winner-action-keep:hover {
    background-color: #95a5a6;
}

.winner-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}