/* Audio Gallery Styles - Theme Adaptive Design */

:root {
    /* Kolory adaptowalne do motywu - fallback na ciemne jeśli brak */
    --ag-primary-color: var(--wp--preset--color--primary, var(--primary-color, #0073aa));
    --ag-secondary-color: var(--wp--preset--color--secondary, var(--secondary-color, #005177));
    --ag-accent-color: var(--wp--preset--color--accent, var(--accent-color, #1db954));
    --ag-background-color: var(--wp--preset--color--background, var(--background-color, #ffffff));
    --ag-surface-color: var(--wp--preset--color--surface, var(--surface-color, #f8f9fa));
    --ag-text-color: var(--wp--preset--color--foreground, var(--text-color, #333333));
    --ag-text-light: var(--wp--preset--color--tertiary, var(--text-light-color, #666666));
    --ag-border-color: var(--wp--preset--color--border, var(--border-color, #e1e1e1));
    
    /* Sprawdź czy motyw jest ciemny */
    --ag-is-dark-theme: 0;
}

/* Adaptacja do ciemnych motywów */
@media (prefers-color-scheme: dark) {
    :root {
        --ag-is-dark-theme: 1;
        --ag-background-color: var(--wp--preset--color--background, #121212);
        --ag-surface-color: var(--wp--preset--color--surface, #181818);
        --ag-text-color: var(--wp--preset--color--foreground, #ffffff);
        --ag-text-light: var(--wp--preset--color--tertiary, #b3b3b3);
        --ag-border-color: var(--wp--preset--color--border, #404040);
    }
    
    .audio-track-item:hover {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
    .audio-track-item {
        border-width: 2px;
    }
    
    .play-button-main,
    .like-button,
    .sticky-play-pause {
        border: 2px solid currentColor;
    }
    
    .audio-track-item:hover {
        border-color: var(--ag-primary-color);
        border-width: 3px;
    }
}

/* Jeśli ciało strony ma ciemne tło, użyj ciemnych kolorów */
body.dark-mode,
body[class*="dark"],
body[data-theme*="dark"] {
    --ag-background-color: #121212;
    --ag-surface-color: #181818;
    --ag-text-color: #ffffff;
    --ag-text-light: #b3b3b3;
    --ag-border-color: #404040;
}

.audio-gallery-container {
    background: #f7f8ff;
    border: 1px solid var(--ag-border-color);
    border-radius: 8px;
    padding: 24px;
    margin: 0;
    font-family: inherit;
    color: var(--ag-text-color);
}

.audio-gallery-empty {
    background: var(--ag-surface-color);
    color: var(--ag-text-light);
    text-align: center;
    padding: 60px 20px;
    border-radius: 8px;
    font-size: 16px;
    border: 1px solid var(--ag-border-color);
}

.audio-gallery-tracks {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.audio-track-item {
    background: var(--ag-background-color);
    border-radius: 8px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    border: 1px solid var(--ag-border-color);
    position: relative;
}

.audio-track-item:hover {
    background: var(--ag-surface-color);
    border-color: var(--ag-primary-color);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.track-position {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 40px;
}

.position-number {
    color: #003964;
    font-size: 3em;
    font-weight: 600;
    line-height: 1;
}

.trend-icon {
    font-size: 12px;
    margin-top: 4px;
    opacity: 0.7;
    color: var(--ag-accent-color);
}

.track-cover {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--ag-surface-color);
    border: 1px solid var(--ag-border-color);
}

.track-cover img[src*="default-cover.jpg"] {
    background: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzAwIiBoZWlnaHQ9IjMwMCIgdmlld0JveD0iMCAwIDMwMCAzMDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSIzMDAiIGhlaWdodD0iMzAwIiBmaWxsPSIjMTgxODE4Ii8+CjxjaXJjbGUgY3g9IjE1MCIgY3k9IjE1MCIgcj0iODAiIGZpbGw9IiM0MDQwNDAiLz4KPGNpcmNsZSBjeD0iMTUwIiBjeT0iMTUwIiByPSIzMCIgZmlsbD0iIzE4MTgxOCIvPgo8dGV4dCB4PSIxNTAiIHk9IjI1MCIgdGV4dC1hbmNob3I9Im1pZGRsZSIgZmlsbD0iI2IzYjNiMyIgZm9udC1mYW1pbHk9IkFyaWFsIiBmb250LXNpemU9IjE0Ij5CcmFrIG9rxYJhZGtpPC90ZXh0Pgo8L3N2Zz4K') center/cover;
    background-color: #282828;
}

.track-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.track-cover:hover img {
    transform: scale(1.05);
}

.track-cover.no-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ag-surface-color);
}

.default-cover-icon {
    color: var(--ag-text-light);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.track-cover.no-thumbnail:hover .default-cover-icon {
    opacity: 0.8;
    transform: scale(1.1);
}

.play-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}



.play-overlay .play-button {
    background: var(--ag-primary-color);
    border: none;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.play-overlay .play-button:hover {
    background: var(--ag-secondary-color);
    transform: scale(1.1);
}

.track-info {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

.track-details {
    flex: 1;
}

.track-title {
    color: #003964;
    font-size: 18px;
    font-weight: 600;
    margin: 0 0 4px 0;
    line-height: 1.3;
}

.track-artist {
    color: var(--ag-text-light);
    font-size: 14px;
    margin: 0 0 8px 0;
    font-weight: 400;
}

.track-description {
    color: var(--ag-text-light);
    font-size: 13px;
    margin: 0;
    line-height: 1.4;
    opacity: 0.8;
}

.track-actions {
    display: flex;
    gap: 12px;
    align-items: center;
}

.play-button-main {
    background: var(--ag-primary-color);
    border: none;
    border-radius: 24px;
    padding: 12px 24px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.play-button-main:hover {
    background: var(--ag-secondary-color);
    transform: scale(1.05);
}

.play-button-main .play-icon {
    font-size: 16px;
}

.like-button {
    background: #142a5b;
    border: 2px solid var(--ag-border-color);
    border-radius: 24px;
    padding: 12px 20px;
    color: #fff;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    font-size: 14px;
}

.like-button:hover {
	background: #f7f8ff;
    border-color: var(--ag-accent-color);
    color: var(--ag-accent-color);
    transform: scale(1.05);
}

.like-button.liked {
    background: var(--ag-accent-color);
    border-color: var(--ag-accent-color);
    color: white;
}

.like-button.disabled {
	background: #142a5b;
    opacity: 0.5;
    cursor: not-allowed;
    border-color: var(--ag-border-color);
    color: var(--ag-text-light);
}

.like-button.disabled:hover {
    transform: none;
    border-color: var(--ag-border-color);
    color: var(--ag-text-light);
}

.like-count {
    background: var(--ag-border-color);
    color: var(--ag-text-color);
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.like-button.liked .like-count {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

/* Sticky Player */
.audio-gallery-sticky-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--ag-surface-color);
    border-top: 1px solid var(--ag-border-color);
    padding: 12px 20px;
    z-index: 1000;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    backdrop-filter: blur(10px);
}

.sticky-player-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    gap: 20px;
}

.sticky-player-info {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.sticky-player-cover {
    width: 48px;
    height: 48px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
}

.sticky-player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.sticky-player-details {
    min-width: 0;
}

.sticky-player-title {
    color: var(--ag-text-color);
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-player-artist {
    color: var(--ag-text-light);
    font-size: 12px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sticky-player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 2;
    justify-content: center;
}

.sticky-play-pause {
    background: var(--ag-primary-color);
    border: none;
    border-radius: 100%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.sticky-play-pause:hover {
    background: var(--ag-secondary-color);
    transform: scale(1.1);
}

.progress-container {
    flex: 1;
    max-width: 400px;
}

.progress-bar {
    background: var(--ag-border-color);
    height: 4px;
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    margin-bottom: 4px;
}

.progress-fill {
    background: var(--ag-primary-color);
    height: 100%;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s ease;
}

.time-display {
    display: flex;
    justify-content: space-between;
    font-size: 11px;
    color: var(--ag-text-light);
}

.sticky-player-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    justify-content: flex-end;
}

.volume-button,
.close-player {
    background: transparent;
    border: none;
    color: var(--ag-text-light);
    cursor: pointer;
    font-size: 16px;
    padding: 8px;
    border-radius: 4px;
    transition: all 0.3s ease;
}

.volume-button:hover,
.close-player:hover {
    color: var(--ag-text-color);
    background: var(--ag-border-color);
}

/* Responsive Design */
@media (max-width: 768px) {
    .audio-gallery-container {
        padding: 16px;
        margin:10px 0;
    }

    .audio-track-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        padding: 12px;
    }

    .track-position {
        align-self: flex-start;
        flex-direction: row;
        gap: 8px;
        min-width: auto;
    }

    .track-cover {
        width: 100%;
        height: 200px;
        max-width: 300px;
        align-self: center;
    }

    .track-info {
        width: 100%;
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .track-actions {
        width: 100%;
        justify-content: space-between;
    }

    .play-button-main,
    .like-button {
        flex: 1;
        justify-content: center;
    }

    .sticky-player-content {
        flex-direction: column;
        gap: 12px;
        padding: 12px 0;
    }

    .sticky-player-controls {
        width: 100%;
        flex: none;
    }

    .sticky-player-actions {
        width: 100%;
        flex: none;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .track-actions {
        flex-direction: column;
        gap: 8px;
    }

    .play-button-main,
    .like-button {
        width: 100%;
    }

    .progress-container {
        max-width: none;
    }
}

/* SVG Icons */
.audio-gallery-icon {
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.play-icon svg,
.like-icon svg,
.trend-icon svg {
    transition: transform 0.2s ease;
}

.play-button:hover .play-icon svg,
.play-button-main:hover .play-icon svg {
    transform: scale(1.1);
}

.like-button:hover .like-icon svg {
    transform: scale(1.1);
}

.like-button.liked .like-icon svg {
    color: white;
}

/* Loading States */
.like-button.loading {
    pointer-events: none;
    opacity: 0.7;
}

.like-button.loading .like-icon svg {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* Focus States for Accessibility */
.play-button-main:focus,
.like-button:focus,
.sticky-play-pause:focus,
.volume-button:focus,
.close-player:focus {
    outline: 2px solid var(--ag-primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px rgba(var(--ag-primary-color-rgb, 0, 115, 170), 0.2);
}

/* Custom Scrollbar */
.audio-gallery-container::-webkit-scrollbar {
    width: 8px;
}

.audio-gallery-container::-webkit-scrollbar-track {
    background: var(--ag-surface-color);
    border-radius: 4px;
}

.audio-gallery-container::-webkit-scrollbar-thumb {
    background: var(--ag-border-color);
    border-radius: 4px;
}

.audio-gallery-container::-webkit-scrollbar-thumb:hover {
    background: var(--ag-primary-color);
} 