/* 🐟💥 Fishcannon - Image Upload Styles */

/* ===== UPLOAD TABS ===== */
.upload-tabs {
    display: flex;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 1.5rem;
    gap: 0;
}

.tab-button {
    flex: 1;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border: none;
    border-bottom: 2px solid transparent;
    color: #bdc3c7;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.tab-button:first-child {
    border-top-left-radius: 8px;
}

.tab-button:last-child {
    border-top-right-radius: 8px;
}

.tab-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ecf0f1;
}

.tab-button.active {
    background: rgba(52, 152, 219, 0.2);
    border-bottom-color: #3498db;
    color: #3498db;
}

.tab-content {
    display: none;
    max-width: 100%;
    box-sizing: border-box;
}

.tab-content.active {
    display: block;
}

/* Ensure upload panel doesn't cause horizontal scroll */
.upload-panel {
    max-width: 100%;
    box-sizing: border-box;
}

.upload-section {
    max-width: 100%;
    box-sizing: border-box;
}

/* ===== MEDIA CONTROLS ===== */
.media-controls {
    margin-top: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    max-width: 100%;
    box-sizing: border-box;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-width: 100%;
    box-sizing: border-box;
}

.control-item:last-child {
    margin-bottom: 0;
}

.control-item label {
    font-size: 0.85rem;
    color: #bdc3c7;
    min-width: 110px;
    max-width: 130px;
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.control-item input[type="range"] {
    flex: 1;
    min-width: 0;
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    outline: none;
    -webkit-appearance: none;
}

.control-item input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
}

.control-item input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #3498db;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.4);
}

.control-item span {
    font-size: 0.85rem;
    color: #3498db;
    font-weight: 500;
    min-width: 35px;
    max-width: 45px;
    text-align: center;
    flex-shrink: 0;
    white-space: nowrap;
}

/* Active cycling button styling */
.media-controls .action-button.active {
    background: rgba(46, 204, 113, 0.2);
    border-color: #2ecc71;
    color: #2ecc71;
}

.media-controls .action-button.active:hover {
    background: rgba(46, 204, 113, 0.3);
    border-color: #27ae60;
}

/* ===== UPLOAD SECTIONS ===== */
.upload-section {
    margin-bottom: 1.5rem;
}

.upload-section:last-child {
    margin-bottom: 0;
}

.upload-title {
    font-size: 1rem;
    font-weight: 500;
    margin-bottom: 0.75rem;
    color: #ecf0f1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* ===== UPLOAD ZONES ===== */
.upload-zone {
    position: relative;
    border: 2px dashed #34495e;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    transition: all 0.3s ease;
    overflow: hidden;
}

.upload-zone:hover {
    border-color: #3498db;
    background: rgba(52, 152, 219, 0.05);
}

.upload-zone.drag-over {
    border-color: #2ecc71;
    background: rgba(46, 204, 113, 0.1);
    transform: scale(1.02);
}

.upload-zone.has-files {
    border-color: #2ecc71;
    border-style: solid;
}

/* ===== UPLOAD CONTENT ===== */
.upload-content {
    padding: 2rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.upload-content:hover {
    background: rgba(255, 255, 255, 0.03);
}

.upload-icon {
    font-size: 3rem;
    display: block;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.upload-text {
    font-size: 0.95rem;
    color: #bdc3c7;
    margin: 0;
    line-height: 1.4;
}

.upload-zone input[type="file"] {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 5;
    pointer-events: auto;
}

/* When images are uploaded, prevent file input from covering the images area */
.upload-zone.has-images input[type="file"] {
    pointer-events: none;
}

/* Enable file input interaction only on the upload content area */
.upload-zone.has-images .upload-content {
    position: relative;
    cursor: pointer;
}

/* Make sure uploaded images area blocks file input interaction */
.uploaded-images {
    position: relative;
    z-index: 20;
    pointer-events: auto;
}

/* ===== UPLOADED IMAGES DISPLAY ===== */
.uploaded-images {
    padding: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(0, 0, 0, 0.1);
    display: none; /* Hidden by default, shown when images are uploaded */
}

.uploaded-images.has-images {
    display: block;
}

.uploaded-images h4 {
    font-size: 0.9rem;
    color: #3498db;
    margin-bottom: 0.75rem;
    font-weight: 500;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.75rem;
}

.image-thumbnail {
    position: relative;
    aspect-ratio: 1;
    border-radius: 8px;
    overflow: hidden;
    background: #2c3e50;
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.image-thumbnail:hover {
    transform: scale(1.05);
    border-color: #3498db;
    box-shadow: 0 4px 15px rgba(52, 152, 219, 0.3);
}

.image-thumbnail.selected {
    border-color: #2ecc71;
    box-shadow: 0 4px 15px rgba(46, 204, 113, 0.4);
}

.image-thumbnail img,
.image-thumbnail video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.image-thumbnail video {
    pointer-events: none; /* Prevent video controls from interfering */
}

/* Ensure animated GIFs maintain their animation */
.image-thumbnail .animated-gif {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    /* Ensure GIF animation is preserved */
    animation-play-state: running;
    image-rendering: auto;
}

.image-thumbnail .media-type-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: bold;
    text-transform: uppercase;
}

.media-type-indicator.video {
    background: rgba(231, 76, 60, 0.9);
}

.media-type-indicator.gif {
    background: rgba(155, 89, 182, 0.9);
}

.media-type-indicator.image {
    background: rgba(52, 152, 219, 0.9);
}

.image-thumbnail .image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.image-thumbnail:hover .image-overlay {
    opacity: 1;
}

.image-overlay .overlay-actions {
    display: flex;
    gap: 0.5rem;
}

.overlay-button {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.overlay-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.overlay-button.select-btn:hover {
    background: rgba(46, 204, 113, 0.7);
}

.overlay-button.delete-btn:hover {
    background: rgba(231, 76, 60, 0.7);
}

/* Always visible delete button in corner */
.delete-btn-corner {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    color: #e74c3c;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: bold;
    transition: all 0.3s ease;
    z-index: 100;
    border: 2px solid #e74c3c;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
    pointer-events: auto;
}

.delete-btn-corner:hover {
    background: #e74c3c;
    color: white;
    transform: scale(1.15);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

/* ===== IMAGE PREVIEW MODAL ===== */
.image-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.image-preview-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.preview-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.preview-content img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.preview-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.preview-close:hover {
    background: rgba(231, 76, 60, 0.8);
    transform: scale(1.1);
}

/* ===== UPLOAD PROGRESS ===== */
.upload-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2ecc71);
    width: 0%;
    transition: width 0.3s ease;
}

/* ===== DRAG AND DROP STATES ===== */
.upload-zone.drag-enter {
    border-color: #f39c12;
    background: rgba(243, 156, 18, 0.1);
}

.upload-zone.drag-leave {
    border-color: #34495e;
    background: rgba(255, 255, 255, 0.02);
}

/* ===== ERROR STATES ===== */
.upload-zone.error {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.1);
}

.upload-error {
    padding: 0.75rem 1rem;
    background: rgba(231, 76, 60, 0.2);
    border: 1px solid #e74c3c;
    border-radius: 6px;
    color: #e74c3c;
    font-size: 0.85rem;
    margin-top: 0.5rem;
    display: none;
}

.upload-error.visible {
    display: block;
}

/* ===== UPLOAD STATISTICS ===== */
.upload-stats {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 0.8rem;
    color: #bdc3c7;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.stat-value {
    color: #3498db;
    font-weight: 500;
}

/* ===== RESPONSIVE ADJUSTMENTS ===== */
@media (max-width: 768px) {
    .upload-tabs {
        flex-direction: column;
        gap: 0;
    }
    
    .tab-button {
        border-radius: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .tab-button:first-child {
        border-top-left-radius: 8px;
        border-top-right-radius: 8px;
    }
    
    .tab-button:last-child {
        border-bottom-left-radius: 8px;
        border-bottom-right-radius: 8px;
        border-bottom: 2px solid transparent;
    }
    
    .tab-button.active {
        border-left: 3px solid #3498db;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .tab-button:last-child.active {
        border-bottom: 2px solid transparent;
    }
    
    .control-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .control-item label {
        min-width: auto;
        max-width: 100%;
        font-size: 0.8rem;
    }
    
    .control-item input[type="range"] {
        width: 100%;
        min-width: 0;
    }
    
    .control-item span {
        min-width: 30px;
        max-width: 40px;
        font-size: 0.8rem;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5rem;
    }
    
    .media-type-indicator {
        font-size: 0.6rem;
        padding: 1px 4px;
    }
}
@media (max-width: 768px) {
    .upload-content {
        padding: 1.5rem 1rem;
    }
    
    .upload-icon {
        font-size: 2.5rem;
    }
    
    .upload-text {
        font-size: 0.9rem;
    }
    
    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
        gap: 0.5rem;
    }
    
    .overlay-button {
        width: 28px;
        height: 28px;
        font-size: 0.7rem;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes uploadSuccess {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.upload-zone.success {
    animation: uploadSuccess 0.6s ease;
}

@keyframes imageAppear {
    0% { 
        opacity: 0;
        transform: scale(0.8);
    }
    100% { 
        opacity: 1;
        transform: scale(1);
    }
}

.image-thumbnail.new {
    animation: imageAppear 0.4s ease;
}
