/* Sticker System Styles */

/* Sticker Container */
.sticker-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 500;
}

/* Base Sticker Styles */
.sticker {
    position: absolute;
    pointer-events: auto;
    cursor: move;
    user-select: none;
    border: 1px solid transparent;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

.sticker:hover {
    border-color: var(--color-blue-accent);
}

.sticker.selected {
    border: 2px dashed var(--color-blue-accent) !important;
}

/* Sticker Content */
.sticker-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

/* Edit Controls */
.sticker-edit-controls {
    position: absolute;
    top: -30px;
    right: -30px;
    display: flex;
    gap: 4px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    padding: 4px;
    box-shadow: var(--shadow-md);
    z-index: 1000;
}

.sticker-edit-btn {
    width: 24px;
    height: 24px;
    font-size: 12px;
    background: transparent;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.sticker-edit-btn:hover {
    background: var(--color-accent);
    color: white;
}

.sticker-resize-handle,
.sticker-rotate-handle,
.sticker-delete-btn {
    width: 24px;
    height: 24px;
    font-size: 12px;
    background: transparent;
    border: none;
    color: var(--color-text-light);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
    transition: all 0.2s ease;
}

.sticker-resize-handle:hover,
.sticker-rotate-handle:hover {
    background: var(--color-hover);
    color: var(--color-text);
}

.sticker-delete-btn:hover {
    background: var(--color-error);
    color: white;
}

.sticker-resize-handle {
    cursor: se-resize;
}

.sticker-rotate-handle {
    cursor: grab;
}

.sticker-rotate-handle:active {
    cursor: grabbing;
}

/* Context Menu */
.sticker-context-menu {
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 4px;
    min-width: 120px;
    z-index: 10000;
}

.context-menu-item {
    padding: 8px 12px;
    cursor: pointer;
    font-size: var(--font-size-sm);
    color: var(--color-text);
    border-radius: var(--border-radius);
    transition: background-color 0.2s ease;
}

.context-menu-item:hover {
    background: var(--color-hover);
}

/* Sticker Menu */
.sticker-menu {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 500px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.sticker-menu:not(.hidden) {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.sticker-menu-header {
    padding: var(--spacing-md);
    border-bottom: 1px solid var(--color-border);
    font-weight: 600;
    font-size: var(--font-size-base);
    color: var(--color-text);
    text-align: center;
}

.sticker-menu-items {
    padding: var(--spacing-md);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: var(--spacing-sm);
    max-height: 200px;
    overflow-y: auto;
}

.sticker-menu-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--spacing-xs);
    padding: var(--spacing-sm);
    border: 1px solid var(--color-border);
    border-radius: var(--border-radius);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.sticker-menu-item:hover {
    background: var(--color-hover);
    border-color: var(--color-blue-accent);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.sticker-menu-item:active {
    transform: translateY(0);
}

.sticker-menu-icon {
    font-size: 24px;
    line-height: 1;
}

.sticker-menu-label {
    font-size: var(--font-size-sm);
    color: var(--color-text);
    font-weight: 500;
}

/* Sticker Button */
.add-sticker-btn {
    position: fixed;
    bottom: 0;
    right: 20px;
    width: 56px;
    height: 56px;
    background: var(--color-accent);
    color: white;
    border: none;
    border-radius: 50%;
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-sticker-btn:hover {
    background: #b8754a;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.add-sticker-btn:active {
    transform: translateY(0);
}

/* Emoji Sticker Specific */
.emoji-content {
    font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji', sans-serif;
}

/* Text Sticker Specific */
.text-content {
    font-family: var(--font-family);
    word-wrap: break-word;
    overflow: hidden;
}

/* Modal Styles for Editors */
.emoji-picker-modal,
.text-editor-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.emoji-picker,
.text-editor {
    background: white;
    border-radius: var(--border-radius-large);
    box-shadow: var(--shadow-lg);
    animation: slideInUp 0.3s ease;
}

.emoji-grid {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.emoji-btn {
    padding: 8px;
    border: none;
    border-radius: var(--border-radius);
    background: transparent;
    cursor: pointer;
    font-size: 20px;
    transition: background-color 0.2s ease;
}

.emoji-btn:hover {
    background: var(--color-hover);
}

.emoji-btn.selected {
    background: var(--color-accent-light);
}

/* Drag State */
.sticker.dragging {
    opacity: 0.7;
    transform: rotate(5deg);
    z-index: 1000;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .sticker-menu {
        width: 95%;
        bottom: 90px;
    }
    
    .sticker-menu-items {
        grid-template-columns: repeat(auto-fit, minmax(70px, 1fr));
        gap: var(--spacing-xs);
    }
    
    .sticker-menu-icon {
        font-size: 20px;
    }
    
    .add-sticker-btn {
        width: 50px;
        height: 50px;
        right: 16px;
        bottom: 70px;
        font-size: 20px;
    }
    
    .sticker-edit-controls {
        top: -35px;
        right: -35px;
    }
    
    .sticker-edit-btn,
    .sticker-resize-handle,
    .sticker-rotate-handle,
    .sticker-delete-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    .emoji-picker,
    .text-editor {
        width: 95%;
        margin: 20px;
        max-height: 85vh;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(6, 1fr);
    }
}

/* Accessibility */
.sticker:focus {
    outline: 2px solid var(--color-blue-accent);
    outline-offset: 2px;
}

.sticker-menu-item:focus,
.emoji-btn:focus {
    outline: 2px solid var(--color-blue-accent);
    outline-offset: 2px;
}

/* Animation Classes */
@keyframes stickerFadeIn {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.sticker.new-sticker {
    animation: stickerFadeIn 0.3s ease;
}

/* Selection Indicator */
.sticker::after {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    border: 2px dashed transparent;
    border-radius: inherit;
    pointer-events: none;
    transition: border-color 0.2s ease;
}

.sticker.selected::after {
    border-color: var(--color-blue-accent);
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .sticker {
        border-width: 2px;
    }
    
    .sticker:hover {
        border-color: var(--color-blue-accent);
    }
    
    .sticker-edit-controls {
        border-width: 2px;
        box-shadow: none;
        background: var(--color-bg);
    }
}