/**
 * Pôli Podcast - Extended Features Styles
 * Version: 2.0.0
 * Features: Social Sharing, Download, Transcripts, Toast Notifications
 */

/* ==========================================================================
   SOCIAL SHARING
   ========================================================================== */
.ps-share-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.ps-share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: var(--ps-radius-full, 9999px);
    background: var(--ps-bg-tertiary, #f1f5f9);
    color: var(--ps-text-secondary, #64748b);
    cursor: pointer;
    transition: all 0.2s ease;
}

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

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

/* Platform Colors */
.ps-share-btn[data-platform="twitter"]:hover,
.ps-share-btn[data-platform="x"]:hover {
    background: #000000;
    color: white;
}

.ps-share-btn[data-platform="facebook"]:hover {
    background: #1877f2;
    color: white;
}

.ps-share-btn[data-platform="linkedin"]:hover {
    background: #0a66c2;
    color: white;
}

.ps-share-btn[data-platform="whatsapp"]:hover {
    background: #25d366;
    color: white;
}

.ps-share-btn[data-platform="telegram"]:hover {
    background: #0088cc;
    color: white;
}

.ps-share-btn[data-platform="email"]:hover {
    background: var(--ps-primary, #1DB954);
    color: white;
}

.ps-share-btn[data-platform="copy"]:hover {
    background: var(--ps-secondary, #191414);
    color: white;
}

/* Share Button with Label */
.ps-share-btn.with-label {
    width: auto;
    padding: 8px 16px;
    gap: 8px;
    border-radius: var(--ps-radius-md, 12px);
}

.ps-share-btn.with-label span {
    font-size: 13px;
    font-weight: 500;
}

/* Share Dropdown */
.ps-share-dropdown {
    position: relative;
}

.ps-share-dropdown-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--ps-bg-tertiary);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: var(--ps-text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ps-share-dropdown-trigger:hover {
    background: var(--ps-bg-secondary);
}

.ps-share-dropdown-trigger svg {
    width: 18px;
    height: 18px;
}

.ps-share-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    min-width: 200px;
    background: var(--ps-bg-glass-strong, rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    box-shadow: var(--ps-shadow-xl);
    padding: 8px;
    margin-top: 8px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 100;
}

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

.ps-share-dropdown-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    color: var(--ps-text-primary);
    font-size: 14px;
    cursor: pointer;
    border-radius: var(--ps-radius-sm);
    transition: background 0.15s ease;
}

.ps-share-dropdown-item:hover {
    background: var(--ps-bg-tertiary);
}

.ps-share-dropdown-item svg {
    width: 20px;
    height: 20px;
    color: var(--ps-text-secondary);
}

/* ==========================================================================
   DOWNLOAD PROGRESS
   ========================================================================== */
.ps-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--ps-bg-tertiary);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: var(--ps-text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ps-download-btn:hover {
    background: var(--ps-primary);
    border-color: var(--ps-primary);
    color: white;
}

.ps-download-btn svg {
    width: 18px;
    height: 18px;
}

/* Download Progress Notification */
.ps-download-progress {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 300px;
    padding: 16px;
    background: var(--ps-bg-glass-strong, rgba(255, 255, 255, 0.95));
    backdrop-filter: blur(20px);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-lg);
    box-shadow: var(--ps-shadow-xl);
    z-index: 10000;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.3s ease;
}

.ps-download-progress.show {
    opacity: 1;
    transform: translateX(0);
}

.ps-download-progress-bar {
    height: 4px;
    background: var(--ps-primary);
    border-radius: 2px;
    width: 0%;
    transition: width 0.2s ease;
    margin-bottom: 12px;
}

.ps-download-progress-text {
    font-size: 14px;
    color: var(--ps-text-primary);
    font-weight: 500;
}

.ps-download-progress.error .ps-download-progress-bar {
    background: #ef4444;
}

.ps-download-progress.error .ps-download-progress-text {
    color: #ef4444;
}

/* ==========================================================================
   TOAST NOTIFICATIONS
   ========================================================================== */
.ps-toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    background: var(--ps-secondary, #191414);
    color: white;
    border-radius: var(--ps-radius-full);
    box-shadow: var(--ps-shadow-xl);
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
}

.ps-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.ps-toast-icon {
    width: 20px;
    height: 20px;
    background: var(--ps-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
}

.ps-toast-message {
    font-size: 14px;
    font-weight: 500;
}

/* Toast Variants */
.ps-toast.success .ps-toast-icon {
    background: #10b981;
}

.ps-toast.error .ps-toast-icon {
    background: #ef4444;
}

.ps-toast.warning .ps-toast-icon {
    background: #f59e0b;
}

/* ==========================================================================
   TRANSCRIPT VIEWER
   ========================================================================== */
.ps-transcript-wrapper {
    margin-top: 24px;
}

.ps-transcript-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: var(--ps-bg-tertiary);
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    color: var(--ps-text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 100%;
    justify-content: center;
}

.ps-transcript-toggle:hover {
    background: var(--ps-bg-secondary);
}

.ps-transcript-toggle svg {
    width: 18px;
    height: 18px;
    transition: transform 0.2s ease;
}

.ps-transcript-toggle.active svg {
    transform: rotate(180deg);
}

/* Transcript Content */
.ps-transcript-content {
    display: none;
    margin-top: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 20px;
    background: var(--ps-bg-secondary);
    border-radius: var(--ps-radius-lg);
    border: 1px solid var(--ps-border);
}

/* Transcript Segments */
.ps-transcript-segment {
    padding: 12px 16px;
    margin: 4px 0;
    border-radius: var(--ps-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    gap: 16px;
}

.ps-transcript-segment:hover {
    background: var(--ps-bg-tertiary);
}

.ps-transcript-segment.active {
    background: rgba(29, 185, 84, 0.15);
    border-left: 3px solid var(--ps-primary);
}

.ps-transcript-timestamp {
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    color: var(--ps-primary);
    font-weight: 600;
    min-width: 50px;
    flex-shrink: 0;
}

.ps-transcript-text {
    font-size: 15px;
    line-height: 1.6;
    color: var(--ps-text-primary);
}

.ps-transcript-segment.active .ps-transcript-text {
    font-weight: 500;
}

/* Speaker Labels */
.ps-transcript-speaker {
    font-size: 13px;
    font-weight: 600;
    color: var(--ps-text-secondary);
    margin-bottom: 4px;
}

/* Search in Transcript */
.ps-transcript-search {
    margin-bottom: 16px;
}

.ps-transcript-search-input {
    width: 100%;
    padding: 10px 16px;
    border: 1px solid var(--ps-border);
    border-radius: var(--ps-radius-md);
    background: var(--ps-bg-primary);
    font-size: 14px;
    color: var(--ps-text-primary);
}

.ps-transcript-search-input:focus {
    outline: none;
    border-color: var(--ps-primary);
    box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.15);
}

/* Highlight Search Results */
.ps-transcript-highlight {
    background: rgba(255, 213, 0, 0.4);
    border-radius: 2px;
    padding: 0 2px;
}

/* ==========================================================================
   EPISODE ACTIONS BAR
   ========================================================================== */
.ps-episode-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 0;
    border-top: 1px solid var(--ps-border);
    margin-top: 16px;
}

.ps-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    border-radius: var(--ps-radius-md);
    color: var(--ps-text-secondary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ps-action-btn:hover {
    background: var(--ps-bg-tertiary);
    color: var(--ps-text-primary);
}

.ps-action-btn.active {
    color: var(--ps-primary);
}

.ps-action-btn svg {
    width: 18px;
    height: 18px;
}

/* Like Button */
.ps-action-btn.like.active {
    color: #ef4444;
}

.ps-action-btn.like.active svg {
    fill: #ef4444;
}

/* Queue Button */
.ps-action-btn.queue-add.active {
    color: var(--ps-primary);
}

/* ==========================================================================
   CHAPTERS LIST
   ========================================================================== */
.ps-chapters-wrapper {
    margin-top: 24px;
}

.ps-chapters-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--ps-text-primary);
    margin: 0 0 16px;
}

.ps-chapters-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.ps-chapter-item {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--ps-bg-secondary);
    border-radius: var(--ps-radius-sm);
    cursor: pointer;
    transition: all 0.2s ease;
}

.ps-chapter-item:hover {
    background: var(--ps-bg-tertiary);
}

.ps-chapter-item.active {
    background: rgba(29, 185, 84, 0.15);
}

.ps-chapter-number {
    width: 28px;
    height: 28px;
    background: var(--ps-bg-tertiary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: var(--ps-text-secondary);
    flex-shrink: 0;
}

.ps-chapter-item.active .ps-chapter-number {
    background: var(--ps-primary);
    color: white;
}

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

.ps-chapter-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--ps-text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ps-chapter-time {
    font-size: 12px;
    color: var(--ps-text-tertiary);
    font-variant-numeric: tabular-nums;
}

.ps-chapter-duration {
    font-size: 13px;
    color: var(--ps-text-tertiary);
    flex-shrink: 0;
}

/* ==========================================================================
   EPISODE STATS
   ========================================================================== */
.ps-episode-stats {
    display: flex;
    gap: 24px;
    padding: 16px 0;
}

.ps-stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--ps-text-secondary);
    font-size: 13px;
}

.ps-stat-item svg {
    width: 16px;
    height: 16px;
}

.ps-stat-value {
    font-weight: 600;
    color: var(--ps-text-primary);
}

/* ==========================================================================
   RESPONSIVE ADJUSTMENTS
   ========================================================================== */
@media (max-width: 768px) {
    .ps-share-buttons {
        gap: 6px;
    }
    
    .ps-share-btn {
        width: 36px;
        height: 36px;
    }
    
    .ps-download-progress {
        left: 16px;
        right: 16px;
        width: auto;
        bottom: 80px;
    }
    
    .ps-transcript-content {
        max-height: 300px;
        padding: 16px;
    }
    
    .ps-transcript-segment {
        flex-direction: column;
        gap: 4px;
        padding: 10px 12px;
    }
    
    .ps-episode-actions {
        flex-wrap: wrap;
    }
    
    .ps-episode-stats {
        flex-wrap: wrap;
        gap: 16px;
    }
}

@media (max-width: 480px) {
    .ps-share-dropdown-menu {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        border-radius: var(--ps-radius-lg) var(--ps-radius-lg) 0 0;
        margin-top: 0;
        padding: 16px;
    }
    
    .ps-share-dropdown.open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.5);
        z-index: 99;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */
@media print {
    .ps-share-buttons,
    .ps-download-btn,
    .ps-episode-actions,
    .ps-transcript-toggle {
        display: none !important;
    }
    
    .ps-transcript-content {
        display: block !important;
        max-height: none;
        overflow: visible;
    }
}

/* ==========================================================================
   MULTI-PODCAST STYLES
   ========================================================================== */

/* Filter Bar */
.ps-multi-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 24px;
    padding: 20px;
    background: var(--ps-bg-glass, rgba(255, 255, 255, 0.7));
    backdrop-filter: blur(20px);
    border-radius: var(--ps-radius-lg, 16px);
    border: 1px solid var(--ps-border, rgba(0, 0, 0, 0.08));
}

.ps-filter-search {
    flex: 1;
    min-width: 250px;
    position: relative;
}

.ps-multi-search-input {
    width: 100%;
    padding: 12px 16px 12px 48px;
    border: 2px solid var(--ps-border, rgba(0, 0, 0, 0.08));
    border-radius: var(--ps-radius-full, 9999px);
    background: var(--ps-bg-primary, #fff);
    font-size: 15px;
    color: var(--ps-text-primary, #1e293b);
    transition: all 0.2s ease;
}

.ps-multi-search-input:focus {
    outline: none;
    border-color: var(--ps-primary, #1DB954);
    box-shadow: 0 0 0 4px rgba(29, 185, 84, 0.15);
}

.ps-filter-search svg {
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    color: var(--ps-text-tertiary, #94a3b8);
}

.ps-filter-podcasts,
.ps-filter-categories {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ps-filter-podcasts label,
.ps-filter-categories label {
    font-size: 13px;
    font-weight: 500;
    color: var(--ps-text-secondary, #64748b);
    white-space: nowrap;
}

.ps-filter-podcasts select,
.ps-filter-categories select {
    padding: 10px 36px 10px 14px;
    border: 2px solid var(--ps-border);
    border-radius: var(--ps-radius-md, 12px);
    background: var(--ps-bg-primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E") no-repeat right 12px center;
    font-size: 14px;
    color: var(--ps-text-primary);
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.ps-filter-podcasts select:focus,
.ps-filter-categories select:focus {
    outline: none;
    border-color: var(--ps-primary);
}

/* Podcast Badge */
.ps-podcast-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: white;
    border-radius: var(--ps-radius-full);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Multi Grid */
.ps-multi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 24px;
}

.ps-multi-container .ps-episode-card {
    position: relative;
}

/* Responsive */
@media (max-width: 768px) {
    .ps-multi-filter {
        flex-direction: column;
    }
    
    .ps-filter-search {
        min-width: 100%;
    }
    
    .ps-filter-podcasts,
    .ps-filter-categories {
        width: 100%;
    }
    
    .ps-filter-podcasts select,
    .ps-filter-categories select {
        flex: 1;
    }
    
    .ps-multi-grid {
        grid-template-columns: 1fr;
    }
}

/* ==========================================================================
   ADMIN TAB STYLES (inline)
   ========================================================================== */
.ps-tab-intro {
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

.ps-tab-intro h3 {
    margin: 0 0 8px;
    color: #1e293b;
}

.ps-tab-intro p {
    margin: 0;
    color: #64748b;
}

/* Toggle Switch */
.ps-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
}

.ps-toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.ps-toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: #cbd5e1;
    border-radius: 28px;
    transition: 0.3s ease;
}

.ps-toggle-slider:before {
    position: absolute;
    content: "";
    height: 22px;
    width: 22px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.ps-toggle input:checked + .ps-toggle-slider {
    background: #1DB954;
}

.ps-toggle input:checked + .ps-toggle-slider:before {
    transform: translateX(24px);
}

.ps-toggle input:focus + .ps-toggle-slider {
    box-shadow: 0 0 0 3px rgba(29, 185, 84, 0.2);
}
