/* ============================================================================
   Emoji Picker + Mixer Tool - Custom Styles
   Specific styling for the emoji picker and mixer functionality.
   Base layout and theme handled by jugaadbox-frame.css and jugaadbox-tokens.css
   ============================================================================ */

/* Windows has no flag emoji glyphs; this font (Twemoji flags, CC-BY 4.0) draws them. */
@font-face {
    font-family: 'Twemoji Country Flags';
    src: url('TwemojiCountryFlags.woff2') format('woff2');
    unicode-range: U+1F1E6-1F1FF, U+1F3F4, U+E0062-E007F;
    font-display: swap;
}

.mode-panel,
.mode-panel button,
.emoji-picker-dropdown,
.emoji-picker-dropdown button,
.copy-status {
    font-family: 'Twemoji Country Flags', var(--font-family-base);
}

/* ===== MODE TABS ===== */
.mode-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.25rem;
    background: var(--color-secondary);
    border-radius: 12px;
    overflow-x: auto;
}

.mode-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    background: transparent;
    border: none;
    border-radius: 8px;
    color: var(--color-text-secondary);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    min-width: fit-content;
}

.mode-tab:hover {
    background: var(--color-secondary-hover);
    color: var(--color-text);
}

.mode-tab.active {
    background: var(--color-primary-fill);
    color: white;
    box-shadow: 0 2px 8px rgba(246, 136, 39, 0.2);
}

.mode-tab .icon {
    font-size: 1.1em;
}

/* ===== MODE PANELS ===== */
.mode-panel {
    display: none;
}

.mode-panel.active {
    display: block;
}

/* ===== SEARCH SECTION ===== */
.search-section {
    margin-bottom: 1.5rem;
}

.search-box {
    position: relative;
    max-width: 400px;
}

.search-input {
    width: 100%;
    padding: 0.75rem 1rem;
    padding-right: 3rem;
    border: 2px solid var(--color-border);
    border-radius: 12px;
    background: var(--color-surface);
    color: var(--color-text);
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--color-primary-fill);
    box-shadow: 0 0 0 3px rgba(246, 136, 39, 0.1);
}

.search-clear {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.search-input:not(:placeholder-shown) + .search-clear {
    opacity: 1;
}

.search-clear:hover {
    background: var(--color-secondary);
    color: var(--color-text);
}

/* ===== CATEGORY FILTER ===== */
.category-filter {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.category-btn,
.emoticon-cat {
    padding: 0.5rem 1rem;
    background: var(--color-secondary);
    border: 1px solid var(--color-border);
    border-radius: 20px;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.category-btn:hover,
.emoticon-cat:hover {
    background: var(--color-secondary-hover);
    border-color: var(--color-primary-fill);
    color: var(--color-text);
    transform: translateY(-1px);
}

.category-btn.active,
.emoticon-cat.active {
    background: var(--color-primary-fill);
    border-color: var(--color-primary-fill);
    color: white;
    box-shadow: 0 2px 8px rgba(246, 136, 39, 0.2);
}

/* ===== EMOJI GRID ===== */
.emoji-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.75rem;
    margin-bottom: 2rem;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--color-surface);
    border-radius: 12px;
    border: 1px solid var(--color-border);
}

.emoji-item {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-size: 2rem;
    transition: all 0.2s ease;
    user-select: none;
}

.emoji-item:hover {
    background: var(--color-secondary);
    border-color: var(--color-primary-fill);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.emoji-item:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.emoji-item.copied {
    animation: copyPulse 0.6s ease;
}

@keyframes copyPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* ===== MIXER SECTION ===== */
.mixer-section h3 {
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.mixer-description {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.mixer-workspace {
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    text-align: center;
}

.selected-emojis {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.selected-emojis.empty .placeholder {
    color: var(--color-text-muted);
    font-style: italic;
}

.selected-emojis:not(.empty) .placeholder {
    display: none;
}

.selected-emoji {
    font-size: 2.5rem;
    padding: 0.5rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.selected-emoji:hover {
    transform: scale(1.1);
}

.selected-emoji .remove-btn {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 20px;
    height: 20px;
    background: #ff4444;
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mixer-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

/* ===== COMBINATION EXAMPLES ===== */
.popular-combinations h4 {
    margin-bottom: 1rem;
    color: var(--color-text);
}

.combination-examples {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

.combo-example {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.combo-example:hover {
    border-color: var(--color-primary-fill);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.combo-emojis {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.combo-meaning {
    color: var(--color-text-secondary);
    font-size: 0.875rem;
}

/* ===== EMOTICONS SECTION ===== */
.emoticon-section h3 {
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.emoticon-description {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.emoticon-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-content: flex-start;
    margin-bottom: 2rem;
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--color-surface);
    border-radius: 12px;
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.emoticon-item {
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: 2px solid transparent;
    border-radius: 12px;
    color: var(--color-text);
    font-size: 1.1rem;
    line-height: 1.4;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    text-align: center;
}

.emoticon-item:hover {
    background: var(--color-secondary);
    border-color: var(--color-primary-fill);
}

.emoticon-item.copied {
    animation: copyPulse 0.6s ease;
}

/* ===== ACTION BUTTONS ===== */
.action-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.action-btn.primary {
    background: var(--color-primary-fill);
    color: white;
}

.action-btn.primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
}

.action-btn.secondary {
    background: var(--color-secondary);
    color: var(--color-text);
    border: 1px solid var(--color-border);
}

.action-btn.secondary:hover {
    background: var(--color-secondary-hover);
    transform: translateY(-1px);
}

/* ===== SIDEBAR ELEMENTS ===== */
.copy-status {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    transition: all 0.3s ease;
}

.copy-status.success {
    background: #e8f5e8;
    border-color: #4caf50;
    color: #2e7d32;
}

.status-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.status-icon {
    font-size: 1.2em;
}

.status-copy {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
    font: inherit;
    font-weight: 600;
    text-decoration: underline dotted;
    cursor: pointer;
}

.status-copy:hover {
    color: var(--color-primary-fill);
    text-decoration-style: solid;
}

.guide-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.guide-card h3 {
    margin-bottom: 1rem;
    color: var(--color-text);
}

.guide-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.guide-list li {
    padding: 0.5rem 0;
    color: var(--color-text-secondary);
    font-size: 0.875rem;
    border-bottom: 1px solid var(--color-border);
}

.guide-list li:last-child {
    border-bottom: none;
}

.guide-list strong {
    color: var(--color-primary);
}

/* Same dashed placeholder box the shared frame uses for ad slots */
.ad-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 250px;
    border: 1px dashed var(--color-border);
    border-radius: 12px;
    color: var(--color-text-muted);
}

.ad-label {
    font-size: 0.8rem;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ad-space {
    flex: 1;
}

.ad-space:empty {
    display: none;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .mode-tabs {
        margin-bottom: 1rem;
    }
    
    .category-filter {
        gap: 0.25rem;
    }
    
    .category-btn {
        padding: 0.375rem 0.75rem;
        font-size: 0.75rem;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 0.5rem;
        padding: 0.75rem;
        max-height: 400px;
    }
    
    .emoji-item {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
    
    .mixer-workspace {
        padding: 1.5rem 1rem;
    }
    
    .selected-emoji {
        font-size: 2rem;
    }
    
    .mixer-actions {
        flex-direction: column;
    }
    
    .combination-examples {
        grid-template-columns: 1fr;
    }
}

/* ===== MASHUP SECTION ===== */
.mashup-section h3 {
    margin-bottom: 0.5rem;
    color: var(--color-text);
}

.mashup-description {
    color: var(--color-text-secondary);
    margin-bottom: 1.5rem;
}

.mashup-workspace {
    background: var(--color-surface);
    border: 2px dashed var(--color-border);
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
}

.mashup-selectors {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 2rem;
}

.mashup-column {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mashup-column label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--color-text);
}

.emoji-selector {
    padding: 0.75rem 1.5rem;
    background: var(--color-primary-fill);
    border: none;
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    min-width: 120px;
    transition: all 0.2s ease;
    position: relative;
}

.emoji-selector:hover {
    background: var(--color-primary-fill);
    opacity: 0.9;
    transform: translateY(-1px);
}

.mashup-operator {
    font-size: 2rem;
    color: var(--color-primary-fill);
}

.emoji-picker-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 0.75rem;
    z-index: 100;
    width: 340px;
    max-width: 90vw;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.mashup-column:last-child .emoji-picker-dropdown {
    left: auto;
    right: 0;
}

.picker-search {
    width: 100%;
    box-sizing: border-box;
    padding: 0.5rem 0.75rem;
    margin-bottom: 0.5rem;
    border: 2px solid var(--color-border);
    border-radius: 8px;
    font-size: 0.9rem;
}

.picker-search:focus {
    outline: none;
    border-color: var(--color-primary-fill);
}

.picker-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.4rem;
    max-height: 300px;
    overflow-y: auto;
    justify-items: center;
}

.emoji-picker-dropdown button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--color-border);
    background: var(--color-secondary);
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s ease;
}

.emoji-picker-dropdown button:hover:not(:disabled) {
    background: var(--color-primary-fill);
    transform: scale(1.1);
}

.emoji-picker-dropdown button:disabled {
    opacity: 0.2;
    filter: grayscale(1);
    cursor: not-allowed;
}

.mashup-dice {
    text-align: center;
    margin: -1rem 0 2rem;
}

/* ===== FAQ ===== */
.faq-section {
    margin: 2rem 0;
}

.faq-section h2 {
    margin-bottom: 1rem;
    color: var(--color-text);
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.faq-item {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 12px;
    padding: 1.25rem;
}

.faq-item h3 {
    font-size: 1rem;
    margin: 0 0 0.5rem;
    color: var(--color-text);
}

.faq-item p {
    margin: 0;
    color: var(--color-text-secondary);
    line-height: 1.6;
}

.mashup-result {
    text-align: center;
}

.mashup-image {
    max-width: 300px;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    margin-bottom: 1.5rem;
}

.mashup-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
}

.mashup-error {
    background: #fee;
    border: 1px solid #fcc;
    border-radius: 8px;
    padding: 1.5rem;
    text-align: center;
    color: #c33;
}

@media (max-width: 768px) {
    .mashup-selectors {
        flex-direction: column;
        gap: 1rem;
    }
    
    .mashup-operator {
        transform: rotate(90deg);
    }
}

@media (max-width: 480px) {
    .mode-tabs {
        padding: 0.125rem;
    }
    
    .mode-tab {
        padding: 0.625rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .emoji-grid {
        grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
    }
    
    .emoji-item {
        width: 45px;
        height: 45px;
        font-size: 1.25rem;
    }
}