/* Components CSS - UI component styles */

/* Base button styles */
.glass-button {
    width: 44px;
    height: 44px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px var(--shadow-color);
    outline: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    color: var(--text-primary);
    position: fixed;
    top: 20px;
}

.glass-button:hover {
    transform: scale(1.05);
    background: var(--glass-hover);
    box-shadow: 0 6px 20px var(--shadow-color);
}

.glass-button:active {
    transform: scale(0.95);
}

/* Theme toggle button */
.theme-toggle {
    right: 20px;
}

/* Reset button */
.reset-button {
    right: 80px;
}

/* Search button */
.search-button {
    right: 140px; /* Changed to maintain consistent 60px spacing: 20 (theme) + 60 + 60 = 140 */
}

/* Saved status indicator */
.saved-indicator {
    position: fixed;
    top: 20px;
    right: 140px;
    padding: 8px 16px;
    background: rgba(34, 197, 94, 0.9);
    color: white;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    z-index: 9999;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.saved-indicator.show {
    opacity: 1;
    transform: translateY(0);
}

[data-theme="light"] .saved-indicator,
.light-mode .saved-indicator {
    background: rgba(34, 197, 94, 0.8);
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.4);
}

.saved-indicator svg {
    margin-right: 6px;
    vertical-align: middle;
}

/* Image container */
.image-container {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: border-color 0.2s ease;
    cursor: default;
}

.resizable-container {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: border-color 0.2s ease;
    cursor: default;
}

.resizable-container:hover {
    border-color: rgba(74, 144, 226, 0.5);
}

.resizable-container.resizing {
    border-color: rgba(74, 144, 226, 0.8);
}

.resizable-container img {
    position: relative;
    user-select: none;
    border-radius: 12px;
    display: block;
}

/* Overlap prevention and warning styles */
.resizable-container.overlap-warning {
    border-color: rgba(255, 87, 34, 0.8) !important;
    box-shadow: 0 0 20px rgba(255, 87, 34, 0.4);
    animation: shake 0.5s ease-in-out;
}

[data-theme="light"] .image-container.overlap-warning,
.light-mode .image-container.overlap-warning {
    border-color: rgba(255, 152, 0, 0.8) !important;
    box-shadow: 0 0 20px rgba(255, 152, 0, 0.4);
}

/* Ensure proper z-index layering */
.resizable-container {
    z-index: 1;
}

.resizable-container:hover,
.resizable-container.dragging,
.resizable-container.resizing {
    z-index: 1000;
}

/* Prevent pointer events during animations to avoid issues */
.resizable-container.animating {
    pointer-events: none;
}

/* Style for link containers */
.link-container {
    position: absolute;
    border: 2px solid transparent;
    border-radius: 12px;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    cursor: default;
    z-index: 1;
}

.link-container:hover {
    z-index: 1000;
}

/* Overlap warning styles removed - no dragging/resizing */

/* Interaction controls removed - no dragging or resizing */
/* Resize handle styles removed */

/* GIF indicator */
.gif-indicator {
    position: absolute;
    top: 5px;
    left: 5px;
    background: rgba(255, 87, 34, 0.9);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: bold;
    text-transform: uppercase;
    z-index: 5;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.resizable-container:hover .gif-indicator {
    opacity: 1;
}

[data-theme="light"] .gif-indicator,
.light-mode .gif-indicator {
    background: rgba(255, 152, 0, 0.9);
}

/* Loading states */
.loading {
    opacity: 0.5;
    pointer-events: none;
}

.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid transparent;
    border-top: 2px solid var(--text-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Error states */
.error {
    border-color: rgba(239, 68, 68, 0.5) !important;
    background: rgba(239, 68, 68, 0.1);
}

.error::before {
    content: '⚠️';
    position: absolute;
    top: 5px;
    right: 5px;
    font-size: 16px;
    z-index: 10;
}

/* Responsive design */
@media (max-width: 768px) {
    .glass-button {
        width: 40px;
        height: 40px;
        top: 15px;
    }
    
    .theme-toggle {
        right: 15px;
    }
    
    .reset-button {
        right: 70px;
    }
    
    .search-button {
        right: 125px; /* Maintain consistent spacing: 15 + 55 + 55 = 125 */
    }
    
    .saved-indicator {
        right: 120px;
        font-size: 11px;
        padding: 6px 12px;
    }
    
    .resize-handle {
        width: 24px;
        height: 24px;
        bottom: -8px;
        right: -8px;
    }
}

/* Spotlight Search Styles */
.spotlight-search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(8px);
    opacity: 0;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.spotlight-search-container {
    width: 90%;
    max-width: 600px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    backdrop-filter: blur(16px);
    transform: translateY(20px);
    transition: transform 0.2s ease;
}

.spotlight-search-input {
    width: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    padding: 4px 0;
}

.spotlight-results-container {
    max-height: 300px;
    overflow-y: auto;
    padding: 8px 0;
}

.spotlight-result-item {
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.2s ease;
    display: flex;
    align-items: center;
    gap: 12px;
}

.spotlight-result-item:hover {
    background: var(--glass-hover);
}

.spotlight-result-item.selected {
    background: var(--glass-hover);
    outline: 1px solid var(--accent-primary);
}

.spotlight-no-results {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 14px;
}

.spotlight-close-button {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

@media (max-width: 480px) {
    .glass-button {
        width: 36px;
        height: 36px;
        top: 10px;
    }
    
    .theme-toggle {
        right: 10px;
    }
    
    .reset-button {
        right: 60px;
    }
    
    .search-button {
        right: 110px; /* Maintain consistent spacing: 10 + 50 + 50 = 110 */
    }
    
    .saved-indicator {
        right: 105px;
        font-size: 10px;
        padding: 4px 8px;
    }
}
