/**
 * Music Genre Explorer Styles - Purple Gradient Edition
 * Version: 3.9.0
 * Description: Matches the "Music Mood Survey" purple/pink aesthetic.
 */

/* ============================================================================
   1. MAIN CONTAINER & LAYOUT (Full Screen)
   ============================================================================ */

.mge-container {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    
    /* FULL SCREEN SETTINGS */
    width: 100%;
    max-width: 100%;
    min-height: 100vh;
    margin: 0;
    border-radius: 0;
    
    /* PURPLE GRADIENT BACKGROUND */
    /* A softer, elegant purple gradient that matches your reference plugin's vibe */
    background: linear-gradient(135deg, #f3e8ff 0%, #fce7f3 100%);
    
    padding: 40px;
    box-sizing: border-box;
    color: #334155;
    position: relative;
    overflow: hidden;
}

.mge-content {
    display: flex;
    flex-wrap: wrap;
    gap: 60px;
    position: relative;
    z-index: 2;
    align-items: center;
    height: 100%;
    min-height: 80vh;
}

.mge-left-panel {
    flex: 0 0 420px;
    max-width: 100%;
    padding-left: 40px;
}

.mge-right-panel {
    flex: 1;
    min-width: 50%;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Title Gradient - Strong Purple to Pink (Matches your reference buttons) */
.mge-title {
    font-size: 56px;
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 40px;
    margin-top: 0;
    /* Exact gradient from music-mood-survey.php buttons */
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

/* ============================================================================
   2. PLAYER CARD STYLES
   ============================================================================ */

.mge-player-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 24px;
    padding: 40px;
    /* Soft Purple shadow */
    box-shadow: 0 25px 50px -12px rgba(147, 51, 234, 0.15);
    min-height: 280px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: min-height 0.3s ease;
}

.mge-player-idle {
    text-align: center;
    width: 100%;
}

.mge-player-prompt {
    font-size: 18px;
    color: #64748b;
    margin-bottom: 30px;
    font-weight: 500;
}

.mge-dice-container {
    display: flex;
    justify-content: center;
}

.mge-dice-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    /* Purple to Pink Gradient */
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 25px rgba(147, 51, 234, 0.3);
}

.mge-dice-btn:hover {
    transform: translateY(-5px) rotate(15deg) scale(1.05);
    box-shadow: 0 20px 40px rgba(147, 51, 234, 0.4);
}

.mge-dice-btn svg {
    width: 36px;
    height: 36px;
}

/* ACTIVE STATE */
.mge-player-active {
    animation: fadeIn 0.4s ease forwards;
    width: 100%;
}

.mge-player-genre {
    font-size: 32px;
    font-weight: 800;
    color: #7c3aed; /* Strong Purple */
    margin-bottom: 8px;
    line-height: 1.2;
}

.mge-player-detail {
    font-size: 15px;
    color: #475569;
    line-height: 1.6;
    margin-bottom: 20px;
    max-height: 80px;
    overflow-y: auto;
}

.mge-player-song-title {
    font-size: 16px;
    color: #94a3b8;
    margin-bottom: 24px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mge-player-controls {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 24px;
}

.mge-control-btn {
    background: transparent;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    transition: all 0.2s;
    padding: 10px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mge-control-btn:hover {
    color: #9333ea;
    background: #f3e8ff;
}

.mge-play-btn {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9333ea 0%, #db2777 100%);
    border: none;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(147, 51, 234, 0.3);
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mge-play-btn:hover {
    transform: scale(1.1);
}

.mge-progress-bar {
    width: 100%;
    height: 8px;
    background: #f1f5f9;
    border-radius: 4px;
    margin-bottom: 20px;
    overflow: hidden;
}

.mge-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #9333ea, #db2777);
    width: 0%;
    border-radius: 4px;
    transition: width 0.1s linear;
}

.mge-song-dots {
    display: flex;
    gap: 8px;
    height: 8px;
    align-items: center;
}

.mge-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e1;
    transition: all 0.3s;
}

.mge-dot.active {
    background: #db2777;
    width: 24px;
    border-radius: 12px;
}

.mge-stats {
    margin-top: 30px;
    text-align: center;
    font-size: 15px;
    color: #64748b;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ============================================================================
   3. GENRE CLOUD ITEMS
   ============================================================================ */

.mge-genre-item {
    position: absolute;
    padding: 0;
    margin: 0;
    font-size: 11px;
    cursor: pointer;
    white-space: nowrap;
    user-select: none;
    font-weight: 500;
    border: none;
    background: none;
    
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    will-change: transform, opacity;
    transform-origin: center center;
    
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    
    transition: transform 0.4s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.4s ease, color 0.3s ease;
}

/* Unexplored - Light Blue (Contrasts well with purple background) */
.mge-genre-item.unexplored {
    color: #38bdf8; 
    font-weight: 500;
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    animation: genreBreathing 8s ease-in-out infinite;
    animation-delay: calc(var(--breathing-delay, 0s) * 1s);
}

.mge-genre-item.unexplored:hover {
    color: #0284c7;
    z-index: 50;
    animation-play-state: paused;
    transform: translate(-50%, -50%) scale(1.2);
    opacity: 1;
}

/* Explored - Deep Purple */
.mge-genre-item.explored {
    color: #7c3aed;
    font-weight: 700;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.5);
    z-index: 10;
    transform: translate(-50%, -50%) translateZ(0);
}

.mge-genre-item.explored:hover {
    color: #db2777;
    z-index: 100;
    transform: translate(-50%, -50%) scale(1.15);
}

.mge-genre-cloud.has-hover .mge-genre-item:not(.is-hovered) {
    opacity: 0.3;
    filter: blur(0.5px);
    transition: opacity 0.3s, filter 0.3s;
}

@keyframes genreBreathing {
    0% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.95); }
    50% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); text-shadow: 0 0 15px rgba(255, 255, 255, 0.9); }
    100% { opacity: 0.6; transform: translate(-50%, -50%) scale(0.95); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============================================================================
   4. SAFARI & LAYOUT FIX (CRITICAL)
   ============================================================================ */

#mge-genre-cloud {
    display: block !important;
    width: 100% !important;
    position: relative !important;
    aspect-ratio: 1000 / 700;
    height: 0;
    padding-bottom: 70%; 
    overflow: hidden;
    margin-top: 0;
    background: transparent;
}

/* ============================================================================
   5. ADMIN STYLES (Required)
   ============================================================================ */

.mge-admin-wrap, .mge-visual-editor-wrap { margin: 20px 20px 20px 0; }
.mge-admin-stats { display: flex; gap: 20px; margin: 20px 0; flex-wrap: wrap; }
.mge-stat-box { color: white; border-radius: 12px; padding: 25px; flex: 1; min-width: 250px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); position: relative; overflow: hidden; }
.mge-stat-box.total-genres { background: linear-gradient(135deg, #7c3aed 0%, #9333ea 100%); }
.mge-stat-box.explored-genres { background: linear-gradient(135deg, #db2777 0%, #f472b6 100%); }
.mge-stat-box.remaining-genres { background: linear-gradient(135deg, #06b6d4 0%, #22d3ee 100%); }
.mge-stat-box .dashicons { position: absolute; top: 20px; right: 20px; font-size: 40px; color: rgba(255, 255, 255, 0.2); }
.mge-stat-label { display: block; font-size: 14px; color: rgba(255, 255, 255, 0.85); margin-bottom: 5px; font-weight: 500; }
.mge-stat-value { display: block; font-size: 42px; font-weight: 700; color: white; line-height: 1; }
.mge-admin-actions { margin: 20px 0; display: flex; gap: 10px; }
.mge-form-container, .mge-genres-list { background: #fff; border: 2px solid #e9d5ff; border-radius: 12px; padding: 25px; margin: 20px 0; box-shadow: 0 2px 8px rgba(147, 51, 234, 0.1); }
.mge-form-container h3, .mge-genres-list h2 { margin-top: 0; color: #9333ea; }
.mge-modal { display: none; position: fixed; z-index: 100000; left: 0; top: 0; width: 100%; height: 100%; background-color: rgba(147, 51, 234, 0.5); display: flex; justify-content: center; align-items: center; overflow-y: auto; }
.mge-modal-content { background-color: #fff; padding: 30px; border: 3px solid #e9d5ff; border-radius: 16px; width: 90%; max-width: 900px; max-height: 90vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3); position: relative; margin: 20px 0; animation: fadeInScale 0.3s ease-out; }
@keyframes fadeInScale { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.mge-modal-content h2, .mge-modal-content h3 { color: #9333ea; }
.mge-modal-content h4 { color: #7c3aed; margin-top: 15px; margin-bottom: 10px; font-size: 16px; }
.mge-modal-header { border-bottom: 2px solid #e9d5ff; padding-bottom: 15px; margin-bottom: 20px; }
.mge-modal-grid { display: grid; grid-template-columns: 1fr 2fr; gap: 20px; }
.mge-modal-section { background: #faf5ff; border: 2px solid #e9d5ff; border-radius: 8px; padding: 20px; margin-bottom: 20px; }
.mge-modal-section:last-child { margin-bottom: 0; }
.mge-modal-section.genre-details-section { grid-column: 1 / 2; }
.mge-modal-section.song-list-section { grid-column: 2 / 3; }
.mge-no-songs { color: #6b7280; font-style: italic; margin: 10px 0; }
.mge-modal-close { color: #9333ea; position: absolute; right: 20px; top: 15px; font-size: 28px; font-weight: bold; cursor: pointer; transition: all 0.2s; }
.mge-modal-close:hover { color: #db2777; transform: scale(1.1); }
.mge-song-list { margin-top: 20px; max-height: 400px; overflow-y: auto; padding-right: 10px; }
.mge-song-item { background: linear-gradient(135deg, #fff 0%, #fcf8ff 100%); border: 1px solid #e9d5ff; border-radius: 8px; padding: 10px 15px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: center; transition: all 0.2s; }
.mge-song-item:hover { box-shadow: 0 2px 8px rgba(147, 51, 234, 0.1); }
.mge-song-info h4 { margin: 0 0 5px 0; color: #9333ea; font-size: 14px; }
.mge-song-info p { margin: 0; color: #6b7280; font-size: 12px; }
.mge-song-info a { color: #9333ea; font-weight: 600; }
.mge-song-actions { display: flex; gap: 5px; }
#mge-upload-status-bar { background-color: #f0f0f0; border-radius: 4px; margin-top: 15px; height: 10px; overflow: hidden; display: none; }
#mge-upload-status-fill { height: 100%; width: 0%; background: linear-gradient(90deg, #22d3ee, #06b6d4); transition: width 0.3s ease; }
.mge-upload-status-message { text-align: center; font-size: 13px; margin-top: 5px; font-weight: 600; color: #7c3aed; }
.mge-upload-status-message.error { color: #991b1b; }
#mge-genres-table { margin-top: 0; border: 2px solid #e9d5ff; border-radius: 8px; overflow: hidden; }
#mge-genres-table th { font-weight: 600; background: linear-gradient(135deg, #faf5ff 0%, #fef9c3 100%); color: #7c3aed; }
#mge-genres-table tbody tr:hover { background-color: #faf5ff !important; }
.mge-genre-status { display: inline-block; padding: 6px 14px; border-radius: 16px; font-size: 12px; font-weight: 600; cursor: pointer; transition: all 0.2s ease; user-select: none; }
.mge-genre-status:hover { opacity: 0.8; transform: scale(1.05); }
.mge-genre-status.explored { background: linear-gradient(135deg, #d4edda 0%, #c3fae8 100%); color: #065f46; border: 2px solid #10b981; }
.mge-genre-status.explored:hover { background: linear-gradient(135deg, #c3e6cb 0%, #a7f3d0 100%); }
.mge-genre-status.unexplored { background: linear-gradient(135deg, #fed7e2 0%, #fecaca 100%); color: #991b1b; border: 2px solid #f87171; }
.mge-genre-status.unexplored:hover { background: linear-gradient(135deg, #fbb6ce 0%, #fca5a5 100%); }
.mge-action-btn { padding: 6px 12px; margin-right: 5px; font-size: 12px; text-decoration: none; border-radius: 6px; transition: all 0.2s; }
.mge-action-btn:hover { transform: translateY(-1px); box-shadow: 0 2px 8px rgba(147, 51, 234, 0.2); }
.mge-editor-toolbar { background: white; border: 2px solid #e9d5ff; border-radius: 8px; padding: 15px; margin-bottom: 20px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mge-editor-stats { margin-left: auto; display: flex; gap: 20px; font-size: 13px; color: #6b7280; }
.mge-editor-controls { background: white; border: 2px solid #e9d5ff; border-radius: 8px; padding: 15px; margin-bottom: 20px; display: flex; gap: 30px; flex-wrap: wrap; align-items: center; }
.mge-control-group { display: flex; gap: 10px; align-items: center; }
.mge-editor-container { display: flex; gap: 20px; margin-bottom: 20px; }
.mge-editor-canvas-wrapper { flex: 1; background: white; border: 2px solid #e9d5ff; border-radius: 8px; padding: 20px; overflow: auto; position: relative; }
.mge-editor-canvas { width: 1000px !important; height: 700px !important; background-color: #f9f5ff; background-image: linear-gradient(135deg, #faf5ff 0%, #fef9c3 100%); border: 2px dashed #e9d5ff; border-radius: 8px; position: relative; transform-origin: top left; box-shadow: inset 0 0 20px rgba(0,0,0,0.05); }
.mge-editor-canvas.show-grid { background-image: linear-gradient(rgba(147, 51, 234, 0.15) 1px, transparent 1px), linear-gradient(90deg, rgba(147, 51, 234, 0.15) 1px, transparent 1px), linear-gradient(135deg, #faf5ff 0%, #fef9c3 100%); background-size: 50px 50px, 50px 50px, 100% 100%; background-position: -1px -1px, -1px -1px, 0 0; }
.mge-canvas-loading { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: #9333ea; }
.mge-editor-genre-item { position: absolute; padding: 8px 16px; font-size: 12px; cursor: grab; white-space: nowrap; border-radius: 6px; user-select: none; font-weight: 500; border: 2px solid transparent; background: white; box-shadow: 0 2px 8px rgba(147, 51, 234, 0.15); transition: all 0.2s ease; transform: translate(-50%, -50%); }
.mge-editor-genre-item.unexplored { color: #6b7280; border: 2px dashed #cbd5e1; background: rgba(255, 255, 255, 0.8); }
.mge-editor-genre-item.explored { color: #9333ea; font-weight: 600; border: 2px solid #9333ea; background: white; }
.mge-editor-genre-item:hover { transform: translate(-50%, -50%) scale(1.05); z-index: 50; border-color: #db2777; }
.mge-editor-genre-item.selected { border-color: #db2777; background: #fff0f7; z-index: 100; box-shadow: 0 0 0 4px rgba(219, 39, 119, 0.2); }
.mge-editor-genre-item.dragging { opacity: 0.8; cursor: grabbing; z-index: 1000; box-shadow: 0 12px 24px rgba(147, 51, 234, 0.3); }
.mge-editor-genre-item.hidden { display: none; }
.mge-editor-sidebar { width: 280px; background: white; border: 2px solid #e9d5ff; border-radius: 8px; padding: 20px; }
.mge-editor-sidebar h3 { margin-top: 0; color: #9333ea; border-bottom: 2px solid #e9d5ff; padding-bottom: 10px; }
.mge-no-selection { color: #9ca3af; font-style: italic; }
.mge-control-field { margin-bottom: 15px; }
.mge-control-field label { display: block; font-weight: 600; margin-bottom: 5px; color: #6b7280; font-size: 12px; }
.mge-control-field input { width: 100%; }
#mge-fontsize-display { display: inline-block; margin-left: 8px; font-weight: 600; color: #9333ea; }
.mge-editor-tips { margin-top: 30px; padding-top: 20px; border-top: 2px solid #e9d5ff; }
.mge-editor-tips h4 { color: #9333ea; margin-top: 0; }
.mge-editor-tips ul { font-size: 12px; color: #6b7280; margin: 0; padding-left: 20px; }
.mge-editor-footer { background: #fef9c3; border: 2px solid #fde047; border-radius: 8px; padding: 15px; color: #854d0e; }
@media (max-width: 960px) { .mge-modal-grid { grid-template-columns: 1fr; } .mge-modal-section.genre-details-section, .mge-modal-section.song-list-section { grid-column: 1 / 2; } .mge-modal-content { max-width: 600px; } }
@media (max-width: 768px) { .mge-admin-stats { flex-direction: column; gap: 15px; } .mge-stat-box { min-width: 100%; } .mge-modal-content { padding: 20px; } .mge-filter-controls { flex-direction: column; } .mge-filter-controls input { max-width: 100%; } }