/**
 * Image Spinner Wheel Styles
 * Wheel of Decision - Image Edition
 * Color Palette: Dark gray theme with amber accent
 */

/* Last Winner Image in Stats */
.last-winner-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.last-winner-image {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    overflow: hidden;
    border: 3px solid var(--brand-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-input);
    margin-bottom: 4px;
}

.last-winner-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.last-winner-image .no-winner {
    color: var(--text-muted);
    font-size: 24px;
    font-weight: 700;
}

/* Image Entries Grid */
.image-entries-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    max-height: 320px;
    overflow-y: auto;
    padding: 4px;
}

.image-entries-grid::-webkit-scrollbar {
    width: 4px;
}

.image-entries-grid::-webkit-scrollbar-thumb {
    background: var(--brand-primary);
    border-radius: 2px;
}

.image-entry {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 2px solid var(--border-color);
    transition: all 0.2s;
    cursor: pointer;
}

.image-entry:hover {
    border-color: var(--brand-primary);
    transform: scale(1.02);
}

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

.image-entry .entry-number {
    position: absolute;
    top: 4px;
    left: 4px;
    background: var(--brand-primary);
    color: var(--brand-dark);
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
}

.image-entry .remove-entry {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    background: rgba(0, 0, 0, 0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s, background 0.2s;
}

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

.image-entry .remove-entry:hover {
    background: #e53e3e;
}

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

.image-entry .entry-label {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
    color: #fff;
    padding: 16px 6px 6px;
    font-size: 10px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Add Image Section */
.add-image-section {
    text-align: center;
    margin-bottom: 16px;
}

.hidden-input {
    display: none !important;
}

.btn-add-image {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    background: var(--bg-input);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-image:hover {
    border-color: var(--brand-primary);
    color: var(--brand-primary);
    background: rgba(255, 190, 77, 0.1);
}

.btn-add-image svg {
    flex-shrink: 0;
}

.add-image-hint {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 8px;
}

/* Empty State */
.image-entries-grid:empty::before {
    content: 'No images added yet';
    grid-column: 1 / -1;
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

/* Result Modal - Image Version */
.image-result-content {
    max-width: 400px;
}

.result-image-wrapper {
    width: 180px;
    height: 180px;
    margin: 0 auto 20px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid var(--brand-primary);
    box-shadow: 0 8px 32px rgba(255, 190, 77, 0.3);
}

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

/* Result List - Image Version */
.image-wheel-app .result-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    animation: slideIn 0.3s ease;
}

.image-wheel-app .result-item .result-thumb {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--brand-primary);
}

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

.image-wheel-app .result-item .result-info {
    flex: 1;
    min-width: 0;
}

.image-wheel-app .result-item .result-name {
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: block;
}

.image-wheel-app .result-item .result-time {
    color: var(--text-muted);
    font-size: 10px;
}

/* Drag and Drop States */
.image-entries-grid.drag-over {
    background: rgba(255, 190, 77, 0.1);
    border: 2px dashed var(--brand-primary);
    border-radius: var(--radius-sm);
}

.btn-add-image.drag-over {
    border-color: var(--brand-primary);
    background: rgba(255, 190, 77, 0.2);
    color: var(--brand-primary);
}

/* Edit Label Modal */
.edit-label-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10003;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s;
}

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

.edit-label-modal {
    background: #ffffff;
    padding: 24px;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 320px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
    transform: scale(0.9);
    transition: transform 0.2s;
}

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

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

.edit-label-modal input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius-sm);
    background: #f5f5f5;
    color: #040405;
    font-size: 14px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.edit-label-modal input:focus {
    outline: none;
    border-color: var(--brand-primary);
    background: #ffffff;
}

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

.edit-label-actions button {
    flex: 1;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.edit-label-actions .btn-cancel {
    background: #ffffff;
    border: 2px solid #e0e0e0;
    color: #505152;
}

.edit-label-actions .btn-cancel:hover {
    background: #f5f5f5;
    border-color: #d0d0d0;
}

.edit-label-actions .btn-save {
    background: var(--brand-primary);
    border: 2px solid var(--brand-primary);
    color: var(--brand-dark);
}

.edit-label-actions .btn-save:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 190, 77, 0.4);
}

/* Dark mode adjustments for edit modal */
.dark-mode .edit-label-modal {
    background: #1c1c1d;
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-mode .edit-label-modal h4 {
    color: #ffffff;
}

.dark-mode .edit-label-modal input {
    background: #505152;
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

.dark-mode .edit-label-modal input:focus {
    background: #3a3a3b;
}

.dark-mode .edit-label-actions .btn-cancel {
    background: transparent;
    border-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
}

.dark-mode .edit-label-actions .btn-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

/* Loading State for Images */
.image-entry.loading {
    background: var(--bg-input);
}

.image-entry.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    border: 2px solid var(--border-color);
    border-top-color: var(--brand-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* Error State */
.image-entry.error {
    border-color: #e53e3e;
}

.image-entry.error::after {
    content: '!';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 24px;
    height: 24px;
    background: #e53e3e;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
}
