/* Pub Page Styles - Professional Design */
:root {
    --color-background: #ffffff;
    --color-surface: #f8fafc;
    --color-accent: #3b82f6;
    --color-text: #1e293b;
    --color-text-secondary: #64748b;
    --color-border: #e2e8f0;
    --color-header: #ffffff;
    --color-header-border: #e2e8f0;
}

body {
    margin: 0;
    padding: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--color-background);
    color: var(--color-text);
    line-height: 1.6;
}

/* Header */
.header {
    background: var(--color-header);
    border-bottom: 1px solid var(--color-header-border);
    padding: 20px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 48px;
}

.header-logo-container img {
    height: 48px;
    width: auto;
}

.header-nav .nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 6px;
    transition: all 0.2s ease;
}

.header-nav .nav-link:hover {
    background: var(--color-surface);
    color: var(--color-text);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Compact Header Section */
.feed-header {
    margin: 24px 0;
    padding: 32px;
    background: var(--color-surface);
    border-radius: 12px;
    position: relative;
    overflow: visible;
    color: var(--color-text);
    text-align: left;
    min-height: 120px;
    display: flex;
    align-items: center;
}

/* Better image handling for different aspect ratios */
.feed-header.has-image {
    min-height: 140px;
}

.feed-header.has-image .header-image {
    object-position: center 20%;
}

.feed-header.has-image .header-overlay {
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.9) 40%,
        rgba(255, 255, 255, 0.7) 70%,
        rgba(255, 255, 255, 0.4) 100%
    );
}

.header-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 0;
    opacity: 1;
    filter: none;
    pointer-events: none;
}

.header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.9) 40%,
        rgba(255, 255, 255, 0.7) 70%,
        rgba(255, 255, 255, 0.4) 100%
    );
    z-index: 1;
    pointer-events: none;
}

.header-share-container {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.header-share-icon {
    color: var(--color-accent);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-size: 1.1rem;
}

.header-share-icon:hover {
    background-color: rgba(59, 130, 246, 0.1);
}

.header-share-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    display: none;
    min-width: 320px;
    max-width: 90vw;
    z-index: 11;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    transform: translateX(0);
}

.header-share-popover.visible {
    display: block;
}

.popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-weight: 600;
    color: var(--color-text);
}

.popover-close {
    background: none;
    border: none;
    color: var(--color-text-secondary);
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    border-radius: 4px;
}

.popover-close:hover {
    background-color: var(--color-surface);
}

.share-link-input {
    width: 100%;
    padding: 10px;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 6px;
    color: var(--color-text);
    font-size: 0.9rem;
    margin-bottom: 12px;
    box-sizing: border-box;
    word-break: break-all;
    overflow-wrap: break-word;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.copy-button {
    background: var(--color-accent);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 500;
    transition: background-color 0.2s ease;
    width: 100%;
}

.copy-button:hover {
    background-color: #2563eb;
}

.header-title-container {
    position: relative;
    z-index: 2;
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.header-title-container h1 {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 2rem;
    margin-bottom: 12px;
    color: var(--color-text);
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.header-title-container p {
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    color: var(--color-text-secondary);
    margin: 0;
    line-height: 1.5;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
    margin-bottom: 64px;
    align-items: start;
}

.player-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

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

.card-header {
    padding: 24px;
    border-bottom: 1px solid var(--color-border);
}

.card-title {
    font-family: 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.25rem;
    margin-bottom: 12px;
    color: var(--color-text);
    line-height: 1.3;
    height: 2.6em; /* Fixed height for exactly 2 lines (1.3 * 2) */
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    text-overflow: ellipsis;
}

.title-link {
    color: var(--color-text);
    text-decoration: none;
    transition: color 0.2s ease;
}

.title-link:hover {
    color: var(--color-accent);
}

.card-description {
    font-size: 0.9rem;
    color: var(--color-text-secondary);
    margin-bottom: 16px;
    line-height: 1.4;
    height: 2.8em;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--color-text-secondary);
}

.card-meta .duration {
    display: flex;
    align-items: center;
    gap: 6px;
    font-weight: 500;
}

.share-link-container {
    position: relative;
}

.share-link-icon {
    color: var(--color-accent);
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background-color 0.2s ease;
    font-size: 0.9rem;
}

.share-link-icon:hover {
    background-color: var(--color-surface);
}

.share-link-popover {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 16px;
    display: none;
    min-width: 280px;
    z-index: 11;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

.share-link-popover.visible {
    display: block;
}

/* Player Wrapper */
.player-wrapper {
    background: var(--color-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}


/* Loading and Error States */
.loading-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--color-text-secondary);
}

.loading-logo {
    height: 60px;
    width: auto;
    margin-bottom: 24px;
    opacity: 0.8;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 0.4; }
}

.loading-state p {
    font-size: 1.1rem;
    margin: 0;
    font-weight: 500;
}

.loading {
    text-align: center;
    padding: 60px 20px;
    color: var(--color-accent);
    font-size: 1.1rem;
}

.loading i {
    font-size: 2rem;
    margin-bottom: 16px;
    display: block;
}

/* Empty/Error State in Grid */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 40px;
    background: var(--color-surface);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin: 40px 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.empty-state-icon {
    margin-bottom: 24px;
}

.empty-state-icon i {
    font-size: 80px;
    color: var(--color-text-secondary);
    opacity: 0.4;
}

.empty-state h2 {
    font-size: 24px;
    font-weight: 600;
    color: var(--color-text);
    margin-bottom: 12px;
    line-height: 1.3;
}

.empty-state p {
    font-size: 16px;
    color: var(--color-text-secondary);
    line-height: 1.6;
    max-width: 480px;
    margin: 0 auto;
}

/* Legacy error class - redirect to empty-state */
.error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 40px;
    background: var(--color-surface);
    border-radius: 16px;
    border: 1px solid var(--color-border);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin: 40px 0;
    color: var(--color-text-secondary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.error i {
    font-size: 80px;
    margin-bottom: 24px;
    display: block;
    opacity: 0.4;
}

@media (max-width: 768px) {
    .empty-state,
    .error {
        padding: 60px 24px;
        margin: 24px 0;
        min-height: 320px;
    }
    
    .empty-state-icon i,
    .error i {
        font-size: 64px;
    }
    
    .empty-state h2 {
        font-size: 20px;
    }
    
    .empty-state p {
        font-size: 15px;
    }
}

/* Friendly Error Message */
.error-message-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 40px 20px;
}

.error-message {
    text-align: center;
    color: var(--color-text-secondary);
    max-width: 520px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.error-message-icon {
    font-size: 120px;
    margin-bottom: 32px;
    color: var(--color-text-secondary);
    opacity: 0.5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.error-message h2 {
    color: var(--color-text);
    margin-bottom: 20px;
    font-weight: 600;
    font-size: 28px;
    line-height: 1.3;
}

.error-message p {
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 36px;
    color: var(--color-text-secondary);
    max-width: 420px;
}

.error-message-button {
    background-color: var(--color-surface);
    color: var(--color-text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 16px;
    padding: 14px 28px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s ease;
    border: 1px solid var(--color-border);
}

.error-message-button:hover {
    background-color: var(--color-text-secondary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.error-message-button i {
    font-size: 14px;
}

/* Standalone Player Page */
.player-page-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 0;
}

.standalone-player {
    width: 100%;
    background: #000;
    border-radius: 16px;
    overflow: visible;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container {
        padding: 0 16px;
    }
    
    .feed-header {
        padding: 24px 20px;
        margin: 20px 0;
    }
    
    .header-title-container h1 {
        font-size: 1.75rem;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin-bottom: 48px;
    }
    
    .card-header {
        padding: 20px;
    }
    
    .header-share-popover {
        right: -20px;
        min-width: 280px;
        max-width: calc(100vw - 40px);
    }
}
