/* === Audio Player === */

.player-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-5);
    box-shadow: var(--shadow-sm);
}

.player-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.player-title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--text-2xl);
    color: var(--color-accent);
}

/* Custom audio player */
.custom-audio-player {
    background: var(--color-background);
    border-radius: var(--radius-md);
    padding: var(--space-5);
    margin: var(--space-4) 0;
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.audio-play-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--color-primary);
    color: var(--cloud);
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color var(--transition-normal), transform 0.1s;
}

.audio-play-btn:hover {
    background: var(--color-primary-hover);
}

.audio-play-btn:active {
    transform: scale(0.95);
}

.audio-progress-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.audio-progress-bar {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--color-border);
    outline: none;
    cursor: pointer;
}

.audio-progress-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid var(--cloud);
    box-shadow: var(--shadow-sm);
}

.audio-progress-bar::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--color-primary);
    cursor: pointer;
    border: 2px solid var(--cloud);
    box-shadow: var(--shadow-sm);
}

.audio-time {
    display: flex;
    justify-content: space-between;
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}

.player-audio {
    width: 100%;
    margin: var(--space-4) 0;
    display: none;
}

.player-actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
    align-items: center;
    margin-top: var(--space-4);
}

.heart-btn.active {
    color: var(--ember-orange);
    border-color: var(--ember-orange);
}

/* Playlist detail */
.track-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.track-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    transition: box-shadow var(--transition-normal);
}

.track-item:hover {
    box-shadow: var(--shadow-sm);
}

.track-handle {
    color: var(--color-border);
    cursor: grab;
    display: flex;
    align-items: center;
}

.track-info {
    flex: 1;
    min-width: 0;
}

.track-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--color-text-primary);
}

.track-duration {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

.track-actions {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}

/* Drag states */
.track-item.dragging {
    opacity: 0.5;
    border: 2px dashed var(--color-border-hover);
    background: var(--color-background);
}

.track-item.drag-over {
    border-top: 2px solid var(--color-primary);
}

.track-chapter-count {
    font-size: var(--text-xs);
    color: var(--color-text-secondary);
}

/* Playlist meta */
.playlist-meta {
    color: var(--color-text-secondary);
    margin-bottom: var(--space-5);
    font-size: var(--text-sm);
}

/* =============================================
   Phase 3 — Design Enhancements
   ============================================= */

/* --- 1. Story Preview Typography --- */

.story-preview-body {
    font-family: var(--font-heading);
    font-size: var(--text-lg);
    line-height: var(--line-height-relaxed);
    color: var(--charcoal-brown);
    max-width: 65ch;
}

.story-preview-body p:first-of-type::first-letter {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: 3.5em;
    float: left;
    line-height: 0.8;
    margin-right: 0.08em;
    margin-top: 0.05em;
    color: var(--color-primary);
}

.story-preview-body p + p {
    text-indent: 1.5em;
}

/* --- 2. Audio Player Redesign --- */

/* Enhanced rounded progress bar */
.audio-progress-bar {
    height: 6px;
    border-radius: 3px;
    background: var(--sunlit-parchment);
}

.audio-progress-bar::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 3px;
    background: transparent;
}

.audio-progress-bar::-moz-range-track {
    height: 6px;
    border-radius: 3px;
    background: transparent;
}

.audio-progress-bar::-webkit-slider-thumb {
    width: 16px;
    height: 16px;
    margin-top: -5px;
    border: 2px solid var(--cloud);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease;
}

.audio-progress-bar::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border: 2px solid var(--cloud);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s ease;
}

.audio-progress-bar:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

.audio-progress-bar:hover::-moz-range-thumb {
    transform: scale(1.2);
}

/* Larger play/pause button with press animation */
.audio-play-btn--lg {
    width: 64px;
    height: 64px;
    font-size: 1.5rem;
    background: var(--color-primary);
    color: var(--cloud);
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    box-shadow: var(--shadow-md);
    transition: background-color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
}

.audio-play-btn--lg:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-lg);
    transform: scale(1.05);
}

.audio-play-btn--lg:active {
    transform: scale(0.88);
    box-shadow: var(--shadow-sm);
}

/* CSS Mini-Visualizer (3 animated bars) */
.audio-visualizer {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 24px;
    padding: 0 var(--space-2);
}

.audio-visualizer .bar {
    width: 4px;
    border-radius: 2px;
    background: var(--color-primary);
    animation: visualizer-idle 1.2s ease-in-out infinite;
}

.audio-visualizer .bar:nth-child(1) {
    height: 8px;
    animation-delay: 0s;
}

.audio-visualizer .bar:nth-child(2) {
    height: 16px;
    animation-delay: 0.15s;
}

.audio-visualizer .bar:nth-child(3) {
    height: 12px;
    animation-delay: 0.3s;
}

.audio-visualizer.is-playing .bar {
    animation-name: visualizer-playing;
    animation-duration: 0.6s;
}

.audio-visualizer.is-playing .bar:nth-child(1) {
    animation-delay: 0s;
}

.audio-visualizer.is-playing .bar:nth-child(2) {
    animation-delay: 0.1s;
}

.audio-visualizer.is-playing .bar:nth-child(3) {
    animation-delay: 0.2s;
}

@keyframes visualizer-idle {
    0%, 100% { height: 6px; }
    50%      { height: 14px; }
}

@keyframes visualizer-playing {
    0%, 100% { height: 8px; }
    25%      { height: 22px; }
    50%      { height: 12px; }
    75%      { height: 20px; }
}

/* --- 3. Shareable Story Card --- */

.story-share-card {
    background: var(--cloud);
    border: 1px solid var(--parchment);
    border-radius: var(--radius-lg);
    padding: var(--space-8, 2.5rem) var(--space-7, 2rem);
    box-shadow: var(--shadow-xl);
    max-width: 480px;
    margin: var(--space-6) auto;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.story-share-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: linear-gradient(90deg, var(--color-primary), var(--color-accent));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.story-share-card__title {
    font-family: var(--font-heading);
    font-weight: 700;
    font-size: var(--text-2xl);
    color: var(--charcoal-brown);
    margin-bottom: var(--space-2);
}

.story-share-card__byline {
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--driftwood);
    margin-bottom: var(--space-4);
}

.story-share-card__excerpt {
    font-family: var(--font-heading);
    font-style: italic;
    font-size: var(--text-base);
    line-height: var(--line-height-relaxed);
    color: var(--charcoal-brown);
    margin-bottom: var(--space-5);
    padding: 0 var(--space-3);
}

.story-share-card__cover {
    width: 100%;
    max-height: 260px;
    object-fit: cover;
    border-radius: calc(var(--radius-lg) - 4px);
    margin-bottom: var(--space-4);
    box-shadow: var(--shadow-md);
}

.story-share-card__footer {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-size: var(--text-xs);
    color: var(--driftwood);
    padding-top: var(--space-4);
    border-top: 1px solid var(--parchment);
}

.story-share-card__footer .brand-mark {
    font-weight: 700;
    color: var(--color-primary);
}

/* --- 4. Yoto Push Section --- */

.yoto-push-section {
    border: 1px solid var(--parchment);
    border-radius: var(--radius-lg);
    background: var(--cloud);
    margin-top: var(--space-5);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s ease;
}

.yoto-push-section:hover {
    box-shadow: var(--shadow-md);
}

.yoto-push-section__toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: var(--text-base);
    color: var(--color-primary);
    transition: background-color 0.2s ease;
}

.yoto-push-section__toggle:hover {
    background: var(--parchment);
}

.yoto-push-section__toggle-icon {
    display: inline-flex;
    transition: transform 0.3s ease;
}

.yoto-push-section.is-open .yoto-push-section__toggle-icon {
    transform: rotate(180deg);
}

.yoto-push-section__body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, padding 0.35s ease;
    padding: 0 var(--space-5);
}

.yoto-push-section.is-open .yoto-push-section__body {
    max-height: 500px;
    padding: var(--space-1) var(--space-5) var(--space-5);
}

.yoto-push-section__status {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-size: var(--text-sm);
    color: var(--driftwood);
    margin-bottom: var(--space-3);
}

.yoto-push-section__status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--driftwood);
    flex-shrink: 0;
}

.yoto-push-section__status-dot.is-connected {
    background: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}

.yoto-push-section__actions {
    display: flex;
    gap: var(--space-3);
    flex-wrap: wrap;
}

.yoto-push-section__send-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-5);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--cloud);
    background: var(--color-primary);
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.12s ease, box-shadow 0.2s ease;
    box-shadow: var(--shadow-sm);
}

.yoto-push-section__send-btn:hover {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-md);
    transform: translateY(-1px);
}

.yoto-push-section__send-btn:active {
    transform: scale(0.96) translateY(0);
    box-shadow: none;
}

.yoto-push-section__send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
