/* Widget general styles */
.emoji-mini-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 0.5rem;
}

.emoji-mini-item {
    background: rgba(248, 249, 250, 0.8);
    border-radius: 8px;
    padding: 0.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    aspect-ratio: 1/1; /* 使背景框为正方形 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.emoji-mini-item:hover {
    background: rgba(255, 255, 255, 0.95);
    transform: translateY(-8px) scale(1.08);
    box-shadow: 0 12px 25px rgba(0,0,0,0.2);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.emoji-mini-character {
    font-size: 2.25rem; /* 放大50% (从1.5rem到2.25rem) */
    line-height: 1;
}

/* 表情网格通用样式 - 统一规范 */
.emoji-grid {
    display: grid;
    gap: 20px;
    margin: 0;
    justify-content: center;
    max-width: 100%;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.emoji-item {
    background: rgba(255, 255, 255, 0.85);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    aspect-ratio: 1/1; /* Ensure square */
    min-width: 150px;
    min-height: 150px;
    width: 100%;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.emoji-item:hover {
    transform: translateY(-8px) scale(1.05);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.15);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.5);
}

.emoji-item:hover .emoji-copy-btn {
    opacity: 1;
    transform: translateY(0);
}

.emoji-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

.emoji-link:hover {
    text-decoration: none;
    color: inherit;
}

.emoji-character {
    font-size: 64px;
    line-height: 1;
    cursor: pointer;
    user-select: all;
    margin-bottom: 0.5rem;
    width: 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.emoji-name {
    font-size: 18px !important;
    color: #666;
    margin-top: 0.5rem;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    line-height: 1.2;
}

/* Emoji copy button */
.emoji-copy-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transform: translateY(-5px);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.emoji-copy-btn:hover {
    background: #0056b3;
    transform: translateY(0) scale(1.1);
}

.emoji-copy-btn:active {
    transform: translateY(0) scale(0.95);
}

/* Copy notification styles */
.copy-notification {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #28a745;
    color: white;
    padding: 1rem 2rem;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 9999;
    text-align: center;
}

.copy-notification.show {
    opacity: 1;
    transform: translate(-50%, -50%);
}

.copy-notification.error {
    background: #dc3545;
}

/* 懒加载动画 */
.fade-in {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.6s ease;
}

/* General button styles */
.btn-primary {
    background: #007bff;
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-primary:hover {
    background: #0056b3;
    color: white;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,123,255,0.3);
}

/* Desktop styles - Ensure emoji background box is square */
@media (min-width: 1201px) {
    .emoji-item {
        width: 100%;
        height: auto;
        aspect-ratio: 1/1; /* Ensure square */
    }
    
    .emoji-mini-grid {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.75rem;
    }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .emoji-grid {
        gap: 15px;
        max-width: 100%;
        width: 100%;
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }
    
    .emoji-item {
        min-width: 130px;
        min-height: 130px;
        background: rgba(255, 255, 255, 0.85);
        border-radius: 10px;
    }
    
    .emoji-character {
        font-size: 56px;
        width: 56px;
        height: 56px;
    }
    
    .emoji-name {
        font-size: 16px !important;
    }
    
    .emoji-mini-grid {
        grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
        gap: 0.4rem;
    }
}

@media (max-width: 768px) {
    .emoji-mini-grid {
        grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    }
    
    /* Mobile emoji grid layout - Ensure 3 emojis per row and square shape */
    .emoji-grid {
        display: grid !important;
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 8px !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        padding: 0 5px !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .emoji-item {
        width: 100% !important;
        height: auto !important; /* Remove fixed height */
        aspect-ratio: 1/1 !important; /* Ensure square */
        position: relative !important;
        background: rgba(255, 255, 255, 0.9);
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
        padding: 0.75rem !important;
        min-height: auto !important;
        min-width: auto !important;
        box-sizing: border-box !important;
        backdrop-filter: blur(5px);
        -webkit-backdrop-filter: blur(5px);
        border: 1px solid rgba(255, 255, 255, 0.2);
    }
    
    .emoji-item:hover {
        transform: translateY(-5px) scale(1.03);
        box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
        background: rgba(255, 255, 255, 0.95);
    }
    
    .emoji-item > * {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        box-sizing: border-box;
        text-decoration: none;
    }
    
    .emoji-character {
        font-size: 48px !important; /* Change to 48px font size */
        width: 48px !important; /* Change to 48px width */
        height: 48px !important; /* Change to 48px height */
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .emoji-name {
        font-size: 14px !important; /* Change to 14px font size */
        margin-top: 0.25rem !important;
    }
    
    .copy-notification {
        position: fixed;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        background: #28a745;
        color: white;
        padding: 0.75rem 1.5rem;
        border-radius: 4px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.2);
        opacity: 0;
        transition: all 0.3s ease;
        z-index: 9999;
        text-align: center;
        font-size: 0.9rem;
    }
    
    /* Mobile widget emoji character styles */
    .emoji-mini-character {
        font-size: 2.25rem !important; /* Maintain enlarged size */
    }
    
    /* Mobile widget meme styles */
    .sticker-mini-item {
        aspect-ratio: 1/1; /* Maintain square */
        box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Maintain shadow */
    }
    
    .sticker-mini-image {
        height: 95%; /* Change to 95% */
    }
}

@media (max-width: 480px) {
    .emoji-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
        gap: 6px !important;
        max-width: 100% !important;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100% !important;
        box-sizing: border-box !important;
        padding: 0 2px !important;
    }
    
    .emoji-item {
        padding: 0.75rem !important;
        width: 100% !important;
        height: auto !important; /* Remove fixed height */
        min-height: auto !important;
        min-width: auto !important;
        box-sizing: border-box !important;
        border-radius: 6px;
        background: rgba(255, 255, 255, 0.9);
        box-shadow: 0 2px 6px rgba(0,0,0,0.08);
    }
    
    .emoji-item:hover {
        transform: translateY(-3px) scale(1.02);
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    }
    
    .emoji-character {
        font-size: 48px !important; /* Change to 48px font size */
        width: 48px !important; /* Change to 48px width */
        height: 48px !important; /* Change to 48px height */
    }
    
    .emoji-name {
        font-size: 14px !important; /* Change to 14px font size */
    }
    
    .emoji-mini-grid {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: 0.3rem;
    }
    
    .copy-notification {
        left: 50%;
        transform: translateX(-50%) translateY(-20px);
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
}