/**
 * Image Wheel Spinner Styles
 * Styles for image upload and image wheel functionality
 * WOD v4 Theme
 */

/* ===================================
   CSS VARIABLES
   =================================== */

:root {
    --iw-text-primary: #040405;
    --iw-text-secondary: #505152;
    --iw-border-color: rgba(4, 4, 5, 0.1);
    --iw-item-bg: transparent;
    --iw-item-hover-bg: rgba(255, 190, 77, 0.08);
}

body.dark-mode {
    --iw-text-primary: #f5f5f5;
    --iw-text-secondary: rgba(255, 255, 255, 0.6);
    --iw-border-color: rgba(255, 255, 255, 0.1);
    --iw-item-bg: transparent;
    --iw-item-hover-bg: rgba(255, 190, 77, 0.1);
}

/* ===================================
   IMAGE ENTRIES LIST (like text entries)
   =================================== */

.image-entries-list {
    display: flex;
    flex-direction: column;
    max-height: 280px;
    overflow-y: auto;
    padding-right: 4px;
}

/* Custom Scrollbar */
.image-entries-list::-webkit-scrollbar {
    width: 4px;
}

.image-entries-list::-webkit-scrollbar-track {
    background: transparent;
}

.image-entries-list::-webkit-scrollbar-thumb {
    background: rgba(255, 190, 77, 0.3);
    border-radius: 2px;
}

.image-entries-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 190, 77, 0.5);
}

/* Image Entry Item (row style like text entries) */
.image-entry-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--iw-border-color);
    background: var(--iw-item-bg);
    transition: all 0.2s ease;
    cursor: default;
}

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

.image-entry-item:hover {
    background: var(--iw-item-hover-bg);
}

/* Thumbnail */
.image-entry-thumb {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 6px;
    overflow: hidden;
    background: rgba(255, 190, 77, 0.1);
    border: 1px solid var(--iw-border-color);
}

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

/* Entry Name */
.image-entry-name {
    flex: 1;
    font-size: 14px;
    color: var(--iw-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Remove Button */
.image-entry-remove {
    width: 24px;
    height: 24px;
    min-width: 24px;
    background: transparent;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s ease;
    color: var(--iw-text-secondary);
}

.image-entry-item:hover .image-entry-remove {
    opacity: 1;
}

.image-entry-remove:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.image-entry-remove svg {
    width: 14px;
    height: 14px;
}

/* ===================================
   EMPTY STATE
   =================================== */

.entries-empty {
    padding: 24px 16px;
    text-align: center;
}

.entries-empty p {
    font-size: 14px;
    color: var(--iw-text-secondary);
    margin: 0;
}

/* ===================================
   ADD IMAGE ZONE
   =================================== */

.add-image-zone {
    margin-top: 12px;
}

.add-image-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 12px 16px;
    background: rgba(255, 190, 77, 0.1);
    border: 1px dashed rgba(255, 190, 77, 0.4);
    border-radius: 8px;
    color: #ffbe4d;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.add-image-btn:hover {
    background: rgba(255, 190, 77, 0.15);
    border-color: #ffbe4d;
    border-style: solid;
}

.add-image-btn svg {
    color: #ffbe4d;
}

/* Drag over state */
.add-image-zone.dragover .add-image-btn {
    background: rgba(255, 190, 77, 0.2);
    border-color: #ffbe4d;
    border-style: solid;
    transform: scale(1.02);
}

/* Hint text below add button */
.add-image-hint {
    margin: 8px 0 0 0;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.4);
    text-align: center;
}

body:not(.dark-mode) .add-image-hint {
    color: #999;
}

/* ===================================
   RESULT MODAL IMAGE
   =================================== */

.result-image-wrapper {
    width: 160px;
    height: 160px;
    margin: 0 auto 16px;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid #ffbe4d;
    box-shadow: 0 8px 32px rgba(255, 190, 77, 0.3);
    display: none;
}

.result-image-wrapper.has-image {
    display: block;
}

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

/* When image is shown, hide decoration */
.result-content:has(.result-image-wrapper.has-image) .result-decoration {
    display: none;
}

/* ===================================
   RESULT LIST IMAGE THUMBNAILS
   =================================== */

.result-item .result-thumb {
    width: 24px;
    height: 24px;
    border-radius: 4px;
    object-fit: cover;
    margin-right: 8px;
}

/* ===================================
   WINNING LABEL INPUT
   =================================== */

.winning-label-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 12px;
}

.winning-label-title {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

body:not(.dark-mode) .winning-label-title {
    color: #888;
}

.winning-label-input {
    width: 100%;
    padding: 12px 14px;
    background: #2a2a2b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.3s ease;
    box-sizing: border-box;
}

body:not(.dark-mode) .winning-label-input {
    background: #f0f0f0;
    border-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.winning-label-input:focus {
    outline: none;
    border-color: #ffbe4d;
    box-shadow: 0 0 0 3px rgba(255, 184, 76, 0.15);
}

.winning-label-input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

body:not(.dark-mode) .winning-label-input::placeholder {
    color: #999;
}

/* ===================================
   EDIT LABEL MODAL
   =================================== */

.edit-label-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.edit-label-overlay.show {
    opacity: 1;
    visibility: visible;
}

.edit-label-modal {
    background: #1c1c1d;
    border-radius: 16px;
    padding: 24px;
    width: 90%;
    max-width: 320px;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.edit-label-overlay.show .edit-label-modal {
    transform: scale(1);
}

body:not(.dark-mode) .edit-label-modal {
    background: #fff;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.edit-label-modal h4 {
    margin: 0 0 16px;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

body:not(.dark-mode) .edit-label-modal h4 {
    color: #333;
}

.edit-label-input {
    width: 100%;
    padding: 12px 14px;
    background: #2a2a2b;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-family: inherit;
    margin-bottom: 16px;
    box-sizing: border-box;
}

body:not(.dark-mode) .edit-label-input {
    background: #f0f0f0;
    border-color: rgba(0, 0, 0, 0.1);
    color: #333;
}

.edit-label-input:focus {
    outline: none;
    border-color: #ffbe4d;
    box-shadow: 0 0 0 3px rgba(255, 184, 76, 0.15);
}

.edit-label-actions {
    display: flex;
    gap: 12px;
}

.edit-label-actions button {
    flex: 1;
    padding: 10px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
}

.btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

body:not(.dark-mode) .btn-cancel {
    background: #e0e0e0;
    color: #333;
}

.btn-cancel:hover {
    background: rgba(255, 255, 255, 0.15);
}

body:not(.dark-mode) .btn-cancel:hover {
    background: #d0d0d0;
}

.btn-save {
    background: #ffbe4d;
    color: #1c1c1d;
}

.btn-save:hover {
    background: #ffc866;
}

/* ===================================
   RESULT ITEM WITH THUMBNAIL
   =================================== */

.result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 8px;
    margin-bottom: 6px;
}

body:not(.dark-mode) .result-item {
    background: rgba(0, 0, 0, 0.03);
}

.result-item .result-thumb {
    width: 32px;
    height: 32px;
    min-width: 32px;
    border-radius: 6px;
    overflow: hidden;
    flex-shrink: 0;
}

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

.result-item .result-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.result-item .result-name {
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body:not(.dark-mode) .result-item .result-name {
    color: #333;
}

.result-item .result-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
}

body:not(.dark-mode) .result-item .result-time {
    color: #999;
}

/* ===================================
   LAST WINNER IMAGE
   =================================== */

#lastWinnerImage {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
}

#lastWinnerImage img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

#lastWinnerImage .no-winner {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.3);
}

body:not(.dark-mode) #lastWinnerImage {
    background: rgba(0, 0, 0, 0.05);
}

body:not(.dark-mode) #lastWinnerImage .no-winner {
    color: rgba(0, 0, 0, 0.3);
}

/* ===================================
   IMAGE ENTRY ITEM CLICKABLE
   =================================== */

.image-entry-item {
    cursor: pointer;
    transition: background 0.2s ease;
}

.image-entry-item:hover {
    background: rgba(255, 255, 255, 0.08);
}

body:not(.dark-mode) .image-entry-item:hover {
    background: rgba(0, 0, 0, 0.05);
}

/* ===================================
   RESPONSIVE DESIGN
   =================================== */

@media (max-width: 1200px) {
    .image-entries-list {
        max-height: 200px;
    }

    .image-entry-thumb {
        width: 28px;
        height: 28px;
        min-width: 28px;
    }

    .image-entry-name {
        font-size: 13px;
    }
}

@media (max-width: 600px) {
    .image-entries-list {
        max-height: 180px;
    }

    .image-entry-item {
        padding: 6px 8px;
        gap: 10px;
    }

    .add-image-btn {
        padding: 10px 14px;
        font-size: 13px;
    }

    .result-image-wrapper {
        width: 120px;
        height: 120px;
    }
}

/* ===================================
   DARK MODE ADJUSTMENTS
   =================================== */

body.dark-mode .image-entry-thumb {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.05);
}

body.dark-mode .add-image-btn {
    background: rgba(255, 190, 77, 0.05);
    border-color: rgba(255, 190, 77, 0.3);
}

body.dark-mode .add-image-btn:hover {
    background: rgba(255, 190, 77, 0.1);
}

body.dark-mode .image-entry-remove:hover {
    background: rgba(239, 68, 68, 0.2);
}
