/**
 * Oz Single Beat Shortcode Styles
 * Mobile-first responsive design with CSS custom properties
 * Version: 2.0.0 - Complete rebuild
 */

/* ═══════════════════════════════════════════════════════════════════════════════
   CSS CUSTOM PROPERTIES (Variables)
   ═══════════════════════════════════════════════════════════════════════════════ */
:root {
    /* Colors */
    --beat-bg: #121212;
    --beat-bg-secondary: #1a1a1a;
    --beat-bg-tertiary: #1e1e1e;
    --beat-text: #ffffff;
    --beat-text-secondary: #D8D8D8;
    --beat-meta-color: #aaaaaa;
    --beat-accent: #d8d8d8;
    --beat-accent-hover: #b3b3b3;
    --beat-muted: #666666;
    
    /* Spacing */
    --beat-padding-xs: 0.5rem;   /* 8px */
    --beat-padding-sm: 1rem;     /* 16px */
    --beat-padding-md: 1.5rem;   /* 24px */
    --beat-padding-lg: 2rem;     /* 32px */
    --beat-gap-sm: 0.625rem;     /* 10px */
    --beat-gap-md: 0.9375rem;    /* 15px */
    --beat-gap-lg: 1.25rem;      /* 20px */
    
    /* Border radius */
    --beat-radius-sm: 0.125rem;  /* 2px */
    --beat-radius-md: 0.25rem;   /* 4px */
    --beat-radius-lg: 0.5rem;    /* 8px */
    
    /* Typography */
    --beat-font-xs: 0.75rem;     /* 12px */
    --beat-font-sm: 0.8125rem;   /* 13px */
    --beat-font-base: 0.875rem;  /* 14px */
    --beat-font-md: 0.9375rem;   /* 15px */
    --beat-font-lg: 1.125rem;    /* 18px */
    --beat-font-xl: 1.25rem;     /* 20px */
    --beat-font-2xl: 1.5rem;     /* 24px */
    --beat-font-3xl: 1.75rem;    /* 28px */
    
    /* Sizing */
    --beat-cover-mobile: 40vw;
    --beat-cover-tablet: 13.75rem;  /* 220px */
    --beat-cover-desktop: 15rem;    /* 240px */
    --beat-waveform-height-mobile: 5rem;   /* 80px */
    --beat-waveform-height-desktop: 5rem;  /* 80px */
    --beat-play-btn-size: 3.5rem;   /* 56px */
    --beat-play-btn-size-lg: 4rem;  /* 64px */
    --beat-icon-size: 1rem;         /* 16px */
    --beat-icon-size-lg: 1.125rem;  /* 18px */
    --beat-icon-size-xl: 1.25rem;   /* 20px */
    
    /* Transitions */
    --beat-transition: 0.3s ease;
    --beat-transition-fast: 0.2s ease;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BASE STYLES (Mobile First)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* Main Container */
.single-beat-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--beat-bg);
    color: var(--beat-text);
    padding: var(--beat-padding-sm);
    border-radius: var(--beat-radius-md);
    gap: var(--beat-gap-md);
    margin: var(--beat-gap-lg) 0;
    max-width: 100%;
    box-sizing: border-box;
}

/* ─────────────────────────────────────────────────────────────────────────────
   COVER ART
   ───────────────────────────────────────────────────────────────────────────── */
.single-beat-cover {
    width: var(--beat-cover-mobile);
    max-width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: var(--beat-radius-sm);
    overflow: hidden;
    position: relative;
    background-color: var(--beat-bg-secondary);
    flex-shrink: 0;
}

.single-beat-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.single-beat-cover-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--beat-bg-secondary);
    color: var(--beat-muted);
}

.single-beat-cover-placeholder i {
    font-size: 3rem;
}

/* Play/Pause Button */
.single-beat-play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: var(--beat-play-btn-size);
    height: var(--beat-play-btn-size);
    border-radius: 50%;
    background-color: var(--beat-accent);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background var(--beat-transition), transform var(--beat-transition-fast);
    z-index: 10;
    border: none;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

/* Desktop only: hover effect for play/pause button */
@media (hover: hover) and (pointer: fine) {
    .single-beat-play:hover {
        background-color: var(--beat-accent-hover);
    }
}

/* Touch devices: prevent stuck hover state on play/pause button */
@media (hover: none) {
    .single-beat-play:hover {
        background-color: var(--beat-accent);
    }
}

.single-beat-play:focus {
    outline: 2px solid var(--beat-accent);
    outline-offset: 2px;
}

.single-beat-play i {
    font-size: 1.375rem;
    color: #000000;
    margin-left: 0.25rem; /* Slight offset for play icon centering */
}

.single-beat-play.playing i.fa-play::before {
    content: "\f04c"; /* Pause icon */
}

/* ─────────────────────────────────────────────────────────────────────────────
   BEAT INFO SECTION
   ───────────────────────────────────────────────────────────────────────────── */
.single-beat-info {
    width: 100%;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Title */
.single-beat-title {
    font-size: var(--beat-font-xl);
    font-weight: 700;
    margin: 0 0 var(--beat-gap-sm) 0;
    line-height: 1.2;
    color: var(--beat-text-secondary);
    text-transform: uppercase;
    text-align: center;
}

/* ─────────────────────────────────────────────────────────────────────────────
   METADATA ROW (Genre, BPM, Key, Time)
   ───────────────────────────────────────────────────────────────────────────── */
.single-beat-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.75rem;
    font-size: var(--beat-font-sm);
    color: var(--beat-meta-color);
    margin-bottom: var(--beat-gap-md);
}

.single-beat-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.beat-genre,
.beat-bpm,
.beat-key,
.beat-age {
    color: var(--beat-meta-color);
}

/* Meta Icons */
.beat-genre-icon,
.beat-bpm-icon,
.beat-age-icon {
    width: var(--beat-icon-size);
    height: var(--beat-icon-size);
    vertical-align: middle;
    flex-shrink: 0;
}

/* Key Icon - Now uses inline SVG like other metadata icons */
.beat-key-icon {
    width: var(--beat-icon-size);
    height: var(--beat-icon-size);
    vertical-align: middle;
    flex-shrink: 0;
    display: inline-block;
}

/* ─────────────────────────────────────────────────────────────────────────────
   WAVEFORM CONTAINER
   ───────────────────────────────────────────────────────────────────────────── */
.single-beat-waveform-container {
    width: 100%;
    margin: var(--beat-gap-md) 0;
    position: relative;
}

.single-beat-waveform {
    width: 100%;
    min-height: var(--beat-waveform-height-mobile);
    height: var(--beat-waveform-height-mobile);
    cursor: pointer;
    margin-bottom: var(--beat-padding-xs);
    background-color: transparent;
    /* Performance: Hardware acceleration */
    will-change: transform;
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Touch handling */
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
    /* Prevent overflow */
    overflow: hidden;
    position: relative;
    z-index: 1;
}

/* Ensure canvas fills waveform container */
.single-beat-waveform canvas {
    display: block;
    width: 100% !important;
    max-width: 100%;
    height: 100%;
    background-color: transparent !important;
}

.single-beat-waveform wave {
    display: block;
    width: 100%;
    background: rgba(255, 255, 255, 0.05);
}

.single-beat-waveform wave::-webkit-scrollbar {
    display: none;
}

/* Time Display */
.single-beat-time {
    display: flex;
    justify-content: space-between;
    font-size: var(--beat-font-xs);
    color: var(--beat-meta-color);
    margin-top: 0.3125rem;
}

.single-beat-time-current,
.single-beat-time-total {
    font-family: 'Roboto', -apple-system, BlinkMacSystemFont, sans-serif;
    font-variant-numeric: tabular-nums;
}

/* Visual Progress Bar (fallback) */
.single-beat-progress-container {
    position: relative;
    height: 0.375rem;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 0.1875rem;
    margin: var(--beat-gap-md) 0;
    display: none;
}

.single-beat-progress-container.show {
    display: block;
}

.single-beat-progress {
    width: 0%;
    height: 100%;
    background-color: var(--beat-accent);
    border-radius: 0.1875rem;
    transition: width 0.1s linear;
}

/* ─────────────────────────────────────────────────────────────────────────────
   ACTION BUTTONS
   ───────────────────────────────────────────────────────────────────────────── */
.single-beat-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: var(--beat-gap-md);
    width: 100%;
    flex-wrap: wrap;
}

/* Shared button styles */
.oz-cart-trigger-shortcode,
.oz-download-btn-shortcode,
.oz-share-btn {
    padding: var(--beat-padding-xs) var(--beat-padding-sm);
    border-radius: var(--beat-radius-sm);
    font-weight: 600;
    cursor: pointer;
    border: none;
    font-size: var(--beat-font-base);
    transition: all var(--beat-transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--beat-padding-xs);
    text-decoration: none;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Buy Now Button */
.oz-cart-trigger-shortcode {
    background-color: var(--beat-accent);
    color: #000000;
    min-width: 8.75rem;
    flex: 0 0 auto;
}

.oz-cart-trigger-shortcode:hover {
    background-color: var(--beat-accent-hover);
    color: #000000;
}

.oz-cart-trigger-shortcode:active,
.oz-cart-trigger-shortcode:focus {
    transform: translateY(0);
    background-color: var(--beat-accent);
    outline: none;
    box-shadow: none;
}

.oz-cart-trigger-shortcode:focus-visible {
    outline: 2px solid var(--beat-accent);
    outline-offset: 2px;
}

/* Download Button */
.oz-download-btn-shortcode {
    background: none;
    color: var(--beat-text-secondary);
    min-width: 2.75rem;
    padding: var(--beat-padding-xs) 0.625rem;
}

.oz-download-btn-shortcode:hover {
    color: var(--beat-accent-hover);
    background: none;
}

.oz-download-btn-shortcode:active,
.oz-download-btn-shortcode:focus {
    transform: translateY(0);
    background: none;
    outline: none;
    box-shadow: none;
}

.oz-download-btn-shortcode:focus-visible {
    outline: 2px solid var(--beat-accent);
    outline-offset: 2px;
}

.oz-download-btn-shortcode svg,
.oz-download-icon {
    width: var(--beat-icon-size-xl);
    height: var(--beat-icon-size-xl);
}

/* Share Button */
.oz-share-btn {
    background: none;
    color: var(--beat-text-secondary);
    min-width: 2.75rem;
    padding: var(--beat-padding-xs) 0.625rem;
}

.oz-share-btn:hover {
    background: none;
    color: var(--beat-accent-hover);
}

.oz-share-btn:hover svg {
    stroke: var(--beat-accent-hover);
}

.oz-share-btn:active {
    transform: translateY(0);
}

.oz-share-btn:focus-visible {
    outline: 2px solid var(--beat-accent);
    outline-offset: 2px;
}

.oz-share-btn svg {
    width: var(--beat-icon-size-lg);
    height: var(--beat-icon-size-lg);
    transition: stroke var(--beat-transition);
}

/* ─────────────────────────────────────────────────────────────────────────────
   DESCRIPTION SECTION
   ───────────────────────────────────────────────────────────────────────────── */
.single-beat-description {
    width: 100%;
    margin-top: var(--beat-gap-lg);
    padding: var(--beat-padding-sm);
    color: #cccccc;
    font-size: var(--beat-font-md);
    line-height: 1.7;
    box-sizing: border-box;
}

.single-beat-description .description-heading {
    font-size: var(--beat-font-lg);
    color: var(--beat-text-secondary);
    margin-bottom: 0.625rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03125rem;
}

.description-text {
    max-height: 3.125rem;
    overflow: hidden;
    transition: max-height 0.4s ease;
}

.description-text.collapsed {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    text-overflow: ellipsis;
}

.description-text.expanded {
    display: block;
    -webkit-line-clamp: unset;
    line-clamp: unset;
    max-height: 62.5rem;
}

.toggle-description {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    background: none;
    border: none;
    color: #9e9e9e;
    cursor: pointer;
    margin-top: 0.4375rem;
    font-size: 0.9rem;
    padding: 0;
    outline: none;
    transition: color var(--beat-transition);
}

.toggle-description:hover,
.toggle-description:focus,
.toggle-description:active {
    color: #9e9e9e;
    background: none;
    outline: none;
    box-shadow: none;
}

.toggle-description i {
    transition: transform var(--beat-transition);
}

.toggle-description.active i {
    transform: rotate(180deg);
}

/* ─────────────────────────────────────────────────────────────────────────────
   BULK DEAL BOX
   ───────────────────────────────────────────────────────────────────────────── */
.single-beat-bulk-deal {
    width: 100%;
    margin-top: var(--beat-gap-lg);
    padding: var(--beat-padding-sm);
    border-left: 3px solid var(--beat-accent);
    background-color: var(--beat-bg-tertiary);
    border-radius: 0 var(--beat-radius-md) var(--beat-radius-md) 0;
    color: #f0f0f0;
    box-sizing: border-box;
}

.bulk-deal-title {
    display: flex;
    align-items: center;
    gap: var(--beat-padding-xs);
    font-size: var(--beat-font-lg);
    font-weight: 700;
    margin-bottom: var(--beat-padding-xs);
    color: var(--beat-text-secondary);
}

.bulk-deal-title svg {
    width: 1.25rem;
    height: 1.25rem;
    flex-shrink: 0;
}

.bulk-deal-steps p {
    margin: 4px 0;
    font-size: 0.93rem;
    line-height: 1.4em;
    color: var(--beat-text-secondary);
}

.bulk-deal-steps p::before {
    content: "➥ ";
    color: var(--beat-text-secondary);
    font-weight: bold;
    /* Arrow inherits font-size from paragraph (0.93rem) - matches backup */
}

/* ─────────────────────────────────────────────────────────────────────────────
   LOADING STATES
   ───────────────────────────────────────────────────────────────────────────── */
.single-beat-container.loading .single-beat-waveform,
.single-beat-container.loading .single-beat-play {
    opacity: 0.5;
    pointer-events: none;
}

.single-beat-waveform.waveform-loading {
    position: relative;
}

.single-beat-waveform.waveform-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(216, 216, 216, 0.1) 50%,
        transparent 100%
    );
    animation: waveform-shimmer 1.5s infinite;
    pointer-events: none;
}

@keyframes waveform-shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ─────────────────────────────────────────────────────────────────────────────
   SHARE TOAST
   ───────────────────────────────────────────────────────────────────────────── */
.oz-share-toast {
    position: fixed;
    bottom: 1.25rem;
    right: 1.25rem;
    background-color: var(--beat-accent);
    color: #000000;
    padding: 0.75rem 1.25rem;
    border-radius: var(--beat-radius-lg);
    box-shadow: 0 0.25rem 0.75rem rgba(0, 0, 0, 0.3);
    z-index: 10000;
    opacity: 0;
    transform: translateY(1.25rem);
    transition: all var(--beat-transition);
    font-size: var(--beat-font-base);
    font-weight: 500;
}

.oz-share-toast.show {
    opacity: 1;
    transform: translateY(0);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TABLET BREAKPOINT (768px+)
   Two-column layout: Cover left, Info right
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 768px) {
    .single-beat-container {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: flex-start;
        padding: var(--beat-padding-md);
        gap: var(--beat-gap-lg);
    }
    
    /* Cover: Fixed width column */
    .single-beat-cover {
        width: var(--beat-cover-tablet);
        flex: 0 0 var(--beat-cover-tablet);
        aspect-ratio: 1 / 1;
    }
    
    /* Info: Flexible column fills remaining space */
    .single-beat-info {
        flex: 1 1 0;
        min-width: 0;
    }
    
    .single-beat-title {
        font-size: var(--beat-font-2xl);
        text-align: left;
    }
    
    .single-beat-meta {
        justify-content: flex-start;
        font-size: var(--beat-font-base);
    }
    
    .single-beat-actions {
        justify-content: flex-start;
    }
    
    .single-beat-play {
        width: var(--beat-play-btn-size-lg);
        height: var(--beat-play-btn-size-lg);
    }
    
    /* Waveform: Full width of info column */
    .single-beat-waveform {
        width: 100%;
        min-height: var(--beat-waveform-height-desktop);
        height: var(--beat-waveform-height-desktop);
    }
    
    /* Description: Full width below both columns */
    .single-beat-description {
        flex-basis: 100%;
        padding: var(--beat-padding-md);
    }
    
    /* Bulk deal: Full width below both columns */
    .single-beat-bulk-deal {
        flex-basis: 100%;
        padding: var(--beat-padding-md);
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   DESKTOP BREAKPOINT (1024px+)
   Same two-column layout with larger cover and more spacing
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (min-width: 1024px) {
    .single-beat-container {
        padding: var(--beat-padding-lg);
        gap: var(--beat-gap-lg);
    }
    
    /* Larger cover on desktop */
    .single-beat-cover {
        width: var(--beat-cover-desktop);
        flex: 0 0 var(--beat-cover-desktop);
    }
    
    .single-beat-title {
        font-size: var(--beat-font-3xl);
    }
    
    /* Description with more padding */
    .single-beat-description {
        padding: var(--beat-padding-md) var(--beat-padding-lg);
    }
    
    /* Bulk deal: Full width on desktop too */
    .single-beat-bulk-deal {
        flex-basis: 100%;
        width: 100%;
        margin-left: 0;
    }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SMALL MOBILE BREAKPOINT (480px and below)
   Tighter spacing for very small screens
   ═══════════════════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
    .single-beat-container {
        padding: 0.75rem;
    }
    
    .single-beat-cover {
        width: 50vw;
        max-width: 12.5rem;
    }
    
    .single-beat-title {
        font-size: var(--beat-font-lg);
    }
    
    .single-beat-meta {
        font-size: var(--beat-font-xs);
        gap: var(--beat-padding-xs);
    }
    
    .single-beat-play {
        width: 3rem;
        height: 3rem;
    }
    
    .single-beat-play i {
        font-size: 1.125rem;
    }
    
    .single-beat-description,
    .single-beat-bulk-deal {
        padding: var(--beat-padding-sm);
    }
}
