/* ==============================================
   FEATURES CSS - Consolidated Feature Styles
   Merged from: share.css, share-incentive-simple.css, 
                settings-menu.css, youtube-preview.css
   ============================================== */

/* ==============================================
   SHARE FUNCTIONALITY STYLES
   Source: share.css
   ============================================== */

/* Share buttons within action-container */
.share-btn {
    background: transparent !important;
    border: 2px solid var(--text-color, #000) !important;
    color: var(--text-color, #000) !important;
    transition: all 0.3s ease;
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
}

.share-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn svg {
    width: 20px;
    height: 20px;
    /* Removed fill: currentColor to preserve inline styles */
}

.share-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Twitter/X button */
#share-songs-twitter,
#share-albums-twitter {
    border-color: #000 !important;
    color: #000 !important;
}

/* Light mode specific fix for X button */
body:not(.dark-mode) #share-songs-twitter,
body:not(.dark-mode) #share-albums-twitter {
    border-color: #000 !important;
    color: #000 !important;
}

body:not(.dark-mode) #share-songs-twitter .btn-icon,
body:not(.dark-mode) #share-albums-twitter .btn-icon {
    color: #000 !important;
}

#share-songs-twitter:hover,
#share-albums-twitter:hover {
    background: #000 !important;
    color: white !important;
}

/* Instagram button */
#share-songs-instagram,
#share-albums-instagram {
    border-color: #E4405F !important;
    color: #E4405F !important;
}

#share-songs-instagram:hover,
#share-albums-instagram:hover {
    background: linear-gradient(45deg, #F58529, #DD2A7B, #8134AF, #515BD4) !important;
    border-color: #DD2A7B !important;
    color: white !important;
}

/* Facebook button */
#share-songs-facebook,
#share-albums-facebook {
    border-color: #1877F2 !important;
    color: #1877F2 !important;
}

#share-songs-facebook:hover,
#share-albums-facebook:hover {
    background: #1877F2 !important;
    color: white !important;
}

/* Dark mode support for share buttons */
@media (prefers-color-scheme: dark) {
    .share-btn {
        border-color: #888 !important;
        color: #ccc !important;
    }
    
    #share-songs-twitter,
    #share-albums-twitter {
        border-color: #fff !important;
        color: #fff !important;
    }
    
    #share-songs-twitter:hover,
    #share-albums-twitter:hover {
        background: #fff !important;
        color: #000 !important;
    }
    
    #share-songs-instagram,
    #share-albums-instagram {
        border-color: #E4405F !important;
        color: #E4405F !important;
    }
    
    #share-songs-facebook,
    #share-albums-facebook {
        border-color: #4B9BFF !important;
        color: #4B9BFF !important;
    }
    
    #share-songs-facebook:hover,
    #share-albums-facebook:hover {
        background: #1877F2 !important;
        border-color: #1877F2 !important;
        color: white !important;
    }
}

body.dark-mode .share-btn {
    border-color: #888 !important;
    color: #ccc !important;
}

body.dark-mode #share-songs-twitter,
body.dark-mode #share-albums-twitter {
    border-color: #fff !important;
    color: #fff !important;
}

body.dark-mode #share-songs-twitter:hover,
body.dark-mode #share-albums-twitter:hover {
    background: #fff !important;
    color: #000 !important;
}

body.dark-mode #share-songs-instagram,
body.dark-mode #share-albums-instagram {
    border-color: #E4405F !important;
    color: #E4405F !important;
}

body.dark-mode #share-songs-facebook,
body.dark-mode #share-albums-facebook {
    border-color: #4B9BFF !important;
    color: #4B9BFF !important;
}

body.dark-mode #share-songs-facebook:hover,
body.dark-mode #share-albums-facebook:hover {
    background: #1877F2 !important;
    border-color: #1877F2 !important;
    color: white !important;
}

/* Story Preview Overlay Styles */
.story-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.3s ease;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

/* Hide overlay elements during screenshot */
@media screen and (display-mode: standalone) {
    .story-preview-instruction,
    .story-preview-close-hint {
        display: none !important;
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.story-preview-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.story-preview-instruction {
    position: absolute;
    top: env(safe-area-inset-top, 20px);
    top: max(env(safe-area-inset-top), 20px);
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 12px 24px;
    border-radius: 25px;
    font-size: 16px;
    font-weight: 600;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 10001;
    animation: pulse 2s ease-in-out infinite;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
        transform: translateX(-50%) scale(1);
    }
    50% {
        opacity: 0.9;
        transform: translateX(-50%) scale(1.05);
    }
}

.story-preview-close-hint {
    position: absolute;
    bottom: 10px; /* Much closer to the very bottom */
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    font-weight: 400;
    z-index: 10001;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

/* Platform shortcuts after screenshot */
.platform-shortcuts {
    position: absolute;
    bottom: env(safe-area-inset-bottom, 80px);
    bottom: max(env(safe-area-inset-bottom), 80px);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 15px;
    padding: 0 20px;
    z-index: 10001;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.platform-shortcut-btn {
    padding: 12px 20px;
    border: none;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    -webkit-tap-highlight-color: transparent;
}

.platform-shortcut-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.platform-shortcut-btn:active {
    transform: scale(0.98);
}

/* Ensure full-screen on all devices */
@supports (height: 100dvh) {
    .story-preview-overlay {
        height: 100dvh;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .story-preview-overlay {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        height: 100%;
    }
}

/* Landscape orientation adjustment */
@media screen and (orientation: landscape) {
    .story-preview-instruction {
        top: 20px;
    }
    
    .story-preview-close-hint {
        bottom: 20px;
    }
    
    .platform-shortcuts {
        bottom: 60px;
    }
}

/* ==============================================
   SHARE INSIGHTS STYLES
   Source: share-incentive-simple.css
   ============================================== */

/* Compact Ranking Insights Section */
.ranking-insights-compact {
    background: var(--accent-white, #f8f8f8);
    color: var(--text-color, #000);
    padding: 1.5rem;
    border-radius: 12px;
    margin: 1.5rem auto 0;
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
    transition: all 0.3s ease;
    text-align: center;
    max-width: 600px;
}

/* Dark mode compact insights */
body.dark-mode .ranking-insights-compact {
    background: #2a2a2a;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Compact insight item */
.insight-compact {
    display: flex;
    align-items: baseline;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.75rem 0;
    font-size: 0.95rem;
    line-height: 1.4;
}

.insight-compact:first-child {
    margin-top: 0;
}

.insight-compact:last-child {
    margin-bottom: 0;
}

/* Insight label */
.insight-label {
    font-weight: 600;
    color: var(--text-secondary, #666);
}

body.dark-mode .insight-label {
    color: #999;
}

/* Insight value (song name) */
.insight-value {
    font-weight: 800;
    color: var(--primary-color, #000);
}

body.dark-mode .insight-value {
    color: var(--accent-yellow, #FFD700);
}

/* Insight detail (rankings) */
.insight-detail {
    font-size: 0.85rem;
    color: var(--text-secondary, #666);
    opacity: 0.8;
}

body.dark-mode .insight-detail {
    color: #999;
}

/* Original full insights section (kept for future use) */
.ranking-insights {
    background: var(--accent-yellow, #FFD700);
    color: #000;
    padding: 2rem;
    border-radius: 20px;
    margin-top: 2rem;
    text-align: center;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

/* Dark mode insights */
body.dark-mode .ranking-insights {
    background: #333;
    color: var(--accent-yellow, #FFD700);
}

/* Reveal animation */
.ranking-insights.reveal-animation {
    animation: revealInsights 0.6s ease;
}

@keyframes revealInsights {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Insights heading */
.ranking-insights h3 {
    font-size: 1.3rem;
    font-weight: 800;
    margin: 0 0 1rem 0;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Insight item */
.insight-item {
    font-size: 1.05rem;
    margin: 0.5rem 0;
    font-weight: 600;
    line-height: 1.4;
}

/* Highlighted song */
.insight-song {
    display: block;
    margin-top: 0.5rem;
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--primary-color, #000);
}

body.dark-mode .insight-song {
    color: var(--accent-yellow, #FFD700);
}

/* Subtext */
.insight-subtext {
    font-size: 0.9rem;
    margin-top: 1rem;
    opacity: 0.8;
    font-weight: 500;
    line-height: 1.4;
}

/* Success Toast */
.share-success-toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--primary-color, #000);
    color: white;
    padding: 1.5rem 2.5rem;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    z-index: 1000;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    animation: toastAppear 0.4s ease;
    transition: opacity 0.3s ease;
}

@keyframes toastAppear {
    from {
        opacity: 0;
        transform: translate(-50%, -40%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* ==============================================
   SETTINGS MENU STYLES
   Source: settings-menu.css
   ============================================== */

/* Settings Button */
.settings-button {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #f0f0f0;
    border: 2px solid #e0e0e0;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 998;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.settings-button:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.settings-button.active {
    transform: rotate(180deg);
    background: #333;
    color: white;
    border-color: #333;
}

.settings-button svg {
    width: 24px;
    height: 24px;
}

/* Settings Menu */
.settings-menu {
    position: fixed;
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.15);
    padding: 8px;
    min-width: 200px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(10px);
    transition: all 0.3s ease;
    z-index: 997;
}

.settings-menu.open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.settings-menu-content {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.settings-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: #333;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: all 0.2s ease;
    text-align: left;
    width: 100%;
}

.settings-menu-item:hover {
    background: #f0f0f0;
}

.settings-menu-item:active {
    background: #e0e0e0;
}

.settings-icon {
    font-size: 18px;
    width: 24px;
    text-align: center;
}

/* Dark Mode Styles */
.dark-mode .settings-button {
    background: #2a2a2a;
    border-color: #444;
    color: #e0e0e0;
}

.dark-mode .settings-button:hover {
    background: #333;
    border-color: #555;
}

.dark-mode .settings-button.active {
    background: #e0e0e0;
    color: #333;
    border-color: #e0e0e0;
}

.dark-mode .settings-menu {
    background: #2a2a2a;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
}

.dark-mode .settings-menu-item {
    color: #e0e0e0;
}

.dark-mode .settings-menu-item:hover {
    background: #333;
}

.dark-mode .settings-menu-item:active {
    background: #444;
}

/* ==============================================
   YOUTUBE PREVIEW STYLES
   Source: youtube-preview.css
   ============================================== */

/* Preview container animations */
#youtube-preview-container {
    animation: slideInRight 0.3s ease-out;
}

#youtube-preview-container.hiding {
    animation: slideOutRight 0.3s ease-out;
}

/* Song card preview states */
.song-card.preview-loading {
    position: relative;
}

.song-card.preview-loading::after {
    content: '';
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    height: 20px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #ff0000;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.song-card.preview-playing {
    border: 2px solid #ff0000;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.2);
}

.song-card.preview-playing::before {
    content: '♪';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 24px;
    color: #ff0000;
    animation: musicNote 1s ease-in-out infinite;
}

@keyframes musicNote {
    0%, 100% { 
        transform: translateY(0) rotate(0deg); 
        opacity: 1;
    }
    50% { 
        transform: translateY(-10px) rotate(10deg); 
        opacity: 0.7;
    }
}

/* Preview toggle checkbox */
#preview-toggle label {
    display: flex;
    align-items: center;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    transition: all 0.3s ease;
}

#preview-toggle label:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

#preview-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* YouTube player overlay */
#youtube-preview-container button {
    transition: all 0.2s ease;
}

#youtube-preview-container button:hover {
    background: rgba(255, 0, 0, 0.8) !important;
    transform: scale(1.1);
}

/* Animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

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

/* ==============================================
   MOBILE RESPONSIVE STYLES
   Consolidated mobile rules from all sections
   ============================================== */

@media (max-width: 768px) {
    /* Share buttons mobile styles */
    .share-btn {
        flex: 1 1 100%;
        margin: 5px 0;
    }
    
    /* Share insights mobile styles */
    .ranking-insights-compact {
        padding: 1.2rem;
        margin-top: 1.2rem;
    }
    
    .insight-compact {
        font-size: 0.9rem;
    }
    
    .insight-detail {
        font-size: 0.8rem;
        width: 100%;
        margin-top: 0.2rem;
    }
    
    .ranking-insights {
        padding: 1.5rem;
        margin-top: 1.5rem;
    }
    
    .ranking-insights h3 {
        font-size: 1.1rem;
    }
    
    .insight-item {
        font-size: 0.95rem;
    }
    
    .insight-song {
        font-size: 1.05rem;
    }
    
    .insight-subtext {
        font-size: 0.85rem;
    }
    
    .share-success-toast {
        padding: 1.2rem 2rem;
        font-size: 1rem;
        width: 90%;
        max-width: 350px;
    }
    
    /* Settings menu mobile styles */
    .settings-button {
        bottom: 15px;
        right: 15px;
        width: 44px;
        height: 44px;
    }
    
    .settings-menu {
        min-width: 180px;
    }
    
    .settings-menu-item {
        padding: 10px 14px;
        font-size: 13px;
    }
    
    /* YouTube preview mobile styles */
    #youtube-preview-container {
        width: 280px;
        height: 157px;
        bottom: 60px;
        right: 10px;
    }
    
    #preview-toggle {
        bottom: 10px !important;
        left: 10px !important;
    }
}

/* ==============================================
   SHARE INTEGRATED STYLES
   From: share-integrated.js embedded CSS
   ============================================== */

/* Hide download buttons container initially to prevent flash */
.download-buttons:not(.reorganized) {
    opacity: 0 !important;
    visibility: hidden !important;
}

.action-container {
    padding: 20px;
    max-width: 1200px;
    margin: 0 auto;
    display: block !important;
}

.action-grid {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

/* Share sections container at bottom */
.share-sections-container,
#share-sections-container {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    margin-top: 3rem;
    padding: 20px;
    max-width: 1200px;
    margin-left: auto;
    margin-right: auto;
}

.action-row {
    display: flex !important;
    gap: 20px;
    justify-content: center;
    min-height: 220px !important;
}

.share-row {
    display: flex !important;
    gap: 20px;
    justify-content: center;
    min-height: 220px !important;
}

.top-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    max-width: 100%;
    width: 100%;
}

.share-row {
    display: flex !important;
    flex-direction: row !important;
    gap: 20px;
    max-width: 100%;
    width: 100%;
    justify-content: center;
}

.action-section {
    background: var(--card-bg, rgba(0, 0, 0, 0.03));
    border: 1px solid var(--border-color, rgba(0, 0, 0, 0.1));
    border-radius: 16px;
    padding: 25px;
    flex: 1;
    transition: all 0.3s ease;
    min-height: 180px !important;
    display: block !important;
}

.action-section:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-color, #000);
    text-align: center;
    margin: 0 0 20px 0;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0.7;
}

.section-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.share-buttons {
    flex-direction: column;
    min-height: auto;
}

.share-buttons .btn-large {
    width: 100%;
}

.section-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

/* Button style updates - uniform sizing */
.btn-large {
    min-width: 200px;
    min-height: 60px;
    height: 60px;
    transition: all 0.2s ease;
    display: flex !important;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
}

.btn-large .btn-icon {
    margin-right: 8px;
}

/* Share button specific styles */
.share-btn {
    display: inline-flex !important;
    align-items: center;
    gap: 8px;
    background: transparent !important;
    border: 2px solid var(--text-color, #000) !important;
    color: var(--text-color, #000) !important;
    visibility: visible !important;
    opacity: 1 !important;
    width: 100%;
    min-height: 60px;
    height: 60px;
}

.share-btn .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.share-btn svg {
    width: 20px;
    height: 20px;
}

/* Dark mode support for share integrated */
@media (prefers-color-scheme: dark) {
    .action-section {
        background: rgba(255, 255, 255, 0.03);
        border-color: rgba(255, 255, 255, 0.1);
    }
    
    .action-section:hover {
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }
}

body.dark-mode .action-section {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .action-section:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

/* Mobile responsiveness for share integrated */
@media (max-width: 768px) {
    .action-container {
        padding: 15px;
    }
    
    .action-grid {
        gap: 15px;
    }
    
    .action-row,
    .top-row,
    .share-row {
        flex-direction: column;
        grid-template-columns: 1fr;
    }
    
    .action-section {
        padding: 20px;
    }
    
    .section-title {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }
    
    .btn-large {
        width: 100%;
        min-width: unset;
    }
    
    /* Mobile share button container */
    .mobile-share-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    /* Native buttons container on mobile */
    .native-buttons-container {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
        margin-bottom: 20px !important;
        width: 100% !important;
    }
    
    /* Ensure platform buttons grid stays 2x2 on mobile */
    .platform-buttons {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 10px !important;
        margin-top: 0 !important;
    }
}