/* ===== TV PAGE - TOPIC-BASED STREAMING PLATFORM ===== */

/* CSS VARIABLES */
:root {
    --primary: #000000;
    --primary-light: #333333;
    --accent: #ffffff;
    --bg: #0a0a0a;
    --card-bg: #1a1a1a;
    --text: #ffffff;
    --text-muted: #999999;
    --border: #2a2a2a;
    --success: #2ecc71;
    --danger: #e74c3c;
    --warning: #f39c12;
    --info: #3498db;
    --purple: #9b59b6;
    --pink: #e91e63;

    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.5);

    --transition-fast: 0.2s;
    --transition-medium: 0.4s;
    --cubic: cubic-bezier(0.4, 0, 0.2, 1);

    /* Sidebar Layout Variables */
    --sidebar-width: 260px;
    --sidebar-collapsed: 70px;
    --card-radius: 12px;
    --card-hover-scale: 1.03;
}

[data-theme="light"] {
    --bg: #fafafa;
    --card-bg: #ffffff;
    --text: #000000;
    --text-muted: #666666;
    --border: #e8e8e8;
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 8px 25px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.15);
}

/* ===== TV CONTAINER (SIDEBAR + CONTENT) ===== */
.islamvoice-container {
    display: flex;
    min-height: 100vh;
    padding-top: 70px; /* Nav height */
    background: var(--bg);
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    box-sizing: border-box;
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-left: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    right: 0;
    top: 70px;
    bottom: 0;
    z-index: 100;
    transition: transform var(--transition-medium) var(--cubic);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
    touch-action: pan-y;
    overscroll-behavior: contain;
    padding-top: 8px;
}

/* Custom scrollbar for sidebar */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

.sidebar-header {
    padding: 1.5rem 1rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-shrink: 0;
}

.sidebar-toggle {
    background: none;
    border: none;
    color: var(--text);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: background var(--transition-fast);
    display: none; /* Hidden on desktop, visible on mobile */
}

.sidebar-toggle:hover {
    background: var(--border);
}

.sidebar-title {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
    overflow: visible;
    flex: 1;
}

.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
    min-height: 0; /* Allow flex item to shrink for scrolling */
}

.sidebar-btn {
    width: 100%;
    padding: 1rem 1.5rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 1rem;
    text-align: right;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: color var(--transition-fast), background-color var(--transition-fast);
    position: relative;
    white-space: nowrap;
    overflow: visible;
}

.sidebar-btn i {
    font-size: 1.2rem;
    min-width: 24px;
    flex-shrink: 0;
}

.sidebar-btn span {
    flex: 1;
    white-space: nowrap;
    overflow: visible;
    text-overflow: clip;
}

.sidebar-btn .badge {
    background: var(--danger);
    color: #fff;
    font-size: 0.75rem;
    padding: 0.2rem 0.5rem;
    border-radius: 12px;
    font-weight: 700;
}

.sidebar-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text);
}

.sidebar-btn.active {
    background: #1a1a1a !important;
    color: #ffffff !important;
    font-weight: 600;
}

.sidebar-btn.active::before {
    content: '';
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 70%;
    background: #1a1a1a;
    border-radius: 2px 0 0 2px;
}

/* Light mode sidebar button styles */
[data-theme="light"] .sidebar-btn:hover {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="light"] .sidebar-btn.active {
    background: #1a1a1a;
    color: #ffffff;
}

[data-theme="light"] .sidebar-btn.active::before {
    background: #000000;
}

.sidebar-footer {
    padding: 1rem 0;
    border-top: 1px solid var(--border);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 99;
    top: 70px;
}

/* ===== MAIN CONTENT AREA ===== */
.main-content {
    flex: 1;
    margin-left: 0;
    margin-right: var(--sidebar-width);
    padding: 2rem;
    max-width: calc(100% - var(--sidebar-width));
    width: 100%;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* ===== VIEW CONTAINERS ===== */
.view-container {
    display: none;
    animation: fadeIn 0.3s ease-in;
    min-height: 60vh;
    width: 100%;
}

.view-container.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.view-header {
    margin-bottom: 2rem;
    max-width: 100%;
    overflow: visible;
}

.view-header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
    max-width: 100%;
}

.view-header p {
    font-size: 1.1rem;
    color: var(--text-muted);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.6;
    max-width: 100%;
}

.back-btn {
    background: var(--card-bg);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    transition: all var(--transition-fast);
}

.back-btn:hover {
    background: var(--border);
    transform: translateX(5px);
}

.back-btn i {
    transition: transform var(--transition-fast);
}

.back-btn:hover i {
    transform: translateX(3px);
}

/* ===== TOPICS GRID ===== */
.topics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 50vh;
    direction: rtl; /* Cards start from right side */
}

/* When topics-grid contains only empty-state, make it full width */
.topics-grid:has(.empty-state) {
    display: flex;
    align-items: center;
    justify-content: center;
}

.topic-card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    overflow: hidden;
    cursor: pointer;
    transition: transform var(--transition-medium) var(--cubic);
    border: 1px solid var(--border);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    will-change: transform;
}

.topic-card:hover {
    transform: scale(var(--card-hover-scale));
    box-shadow: var(--shadow-lg);
}

.topic-card-image {
    width: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--primary-light) 0%, var(--bg) 100%);
}

.topic-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--transition-medium);
    will-change: transform;
}

.topic-card:hover .topic-card-image img {
    transform: scale(1.1);
}

/* Fallback icon when image fails to load */
.topic-fallback-icon {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    place-items: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 3rem;
}

.topic-card-image.no-image .topic-fallback-icon {
    display: grid;
}

.topic-card:hover .topic-fallback-icon {
    color: rgba(255, 255, 255, 0.9);
}

.topic-card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
}

.topic-card-content {
    padding: 1.5rem;
}

.topic-card-title {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.3;
}

.topic-card-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.topic-card-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.topic-card-meta i {
    color: var(--text-muted);
}

/* ===== EPISODES LIST ===== */
.episodes-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 50vh;
}

/* When episodes-list contains only empty-state, center it */
.episodes-list:has(.empty-state) {
    align-items: center;
    justify-content: center;
}

.episode-item {
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    padding: 1.5rem;
    display: flex;
    gap: 1.5rem;
    cursor: pointer;
    transition: transform var(--transition-fast), border-color var(--transition-fast);
    width: 100%;
    max-width: 100%;
    will-change: transform;
    box-sizing: border-box;
    overflow: hidden;
}

.episode-item:hover {
    background: var(--primary-light);
    transform: translateX(-5px);
    box-shadow: var(--shadow-md);
}

/* Currently playing episode highlight */
.episode-item.now-playing,
.episode-card.now-playing {
    background: var(--primary-light);
    border: 2px solid var(--accent);
    position: relative;
}

.episode-item.now-playing::after,
.episode-card.now-playing::after {
    content: '▶ دەچێت';
    position: absolute;
    top: 8px;
    left: 8px;
    background: #000;
    color: #fff;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 600;
    z-index: 10;
}

[data-theme="dark"] .episode-item.now-playing::after,
[data-theme="dark"] .episode-card.now-playing::after {
    background: #fff;
    color: #000;
}

.episode-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 50px;
    text-align: center;
    align-self: center;
}

.episode-thumbnail {
    width: 280px;
    min-width: 280px;
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
    background: var(--bg);
    flex-shrink: 0;
}

.episode-thumbnail img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Fallback icon when episode image fails */
.episode-fallback-icon {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: none;
    place-items: center;
    background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 2rem;
}

.episode-thumbnail.no-image .episode-fallback-icon {
    display: grid;
}

.episode-play-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition-fast);
}

.episode-item:hover .episode-play-overlay {
    opacity: 1;
}

.episode-play-icon {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #000;
    font-size: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    transition: transform 0.2s ease;
}

.episode-play-icon:hover {
    transform: scale(1.1);
}

.episode-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
}

.episode-progress-fill {
    height: 100%;
    background: var(--danger);
    transition: width var(--transition-fast);
}

.episode-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.episode-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text);
    word-wrap: break-word;
    overflow-wrap: break-word;
    line-height: 1.4;
}

.episode-description {
    font-size: 0.95rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.episode-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--text-muted);
}

.episode-meta i {
    color: var(--text-muted);
}

.episode-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-self: center;
}

.episode-action-btn {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 1.1rem;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.episode-action-btn:hover {
    background: var(--border);
    color: var(--text);
}

.episode-action-btn.active {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

.episode-action-btn {
    position: relative;
}

.episode-action-btn .action-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--primary);
    color: white;
    font-size: 0.65rem;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}

/* Like button active state - red heart */
.episode-action-btn.like-btn.active {
    background: #e74c3c;
    border-color: #e74c3c;
    color: #fff;
}

.episode-action-btn.like-btn.active i {
    animation: heartBeat 0.3s ease;
}

@keyframes heartBeat {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Comments Modal */
.comments-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.comments-modal.active {
    display: flex;
}

.comments-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
}

.comments-modal-container {
    position: relative;
    background: var(--card-bg);
    border-radius: 16px;
    width: 100%;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.comments-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.comments-modal-header h3 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.comments-close-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.2s;
}

.comments-close-btn:hover {
    background: var(--border);
    color: var(--text);
}

.comments-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 1.5rem;
    min-height: 200px;
    max-height: 50vh;
}

.comments-loading,
.comments-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 3rem 1rem;
    color: var(--text-muted);
    text-align: center;
}

.comments-empty i {
    font-size: 2.5rem;
    opacity: 0.5;
}

.comments-empty p {
    margin: 0;
}

.comment-item {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
}

.comment-item:last-child {
    border-bottom: none;
}

.comment-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.comment-content {
    flex: 1;
    min-width: 0;
}

.comment-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.25rem;
}

.comment-author {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text);
}

.comment-time {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.comment-text {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text);
    line-height: 1.5;
    word-wrap: break-word;
}

.comment-delete-btn {
    background: none;
    border: none;
    color: var(--danger);
    font-size: 0.75rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    margin-top: 0.5rem;
    border-radius: 4px;
    opacity: 0.7;
    transition: all 0.2s;
}

.comment-delete-btn:hover {
    opacity: 1;
    background: rgba(231, 76, 60, 0.1);
}

.comment-item.own-comment {
    background: rgba(var(--primary-rgb, 0, 0, 0), 0.03);
    margin: 0 -1rem;
    padding: 1rem;
    border-radius: 8px;
}

.comments-input-area {
    display: flex;
    gap: 0.75rem;
    padding: 1rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    border-radius: 0 0 16px 16px;
}

.comments-input-area textarea {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--card-bg);
    color: var(--text);
    font-family: inherit;
    font-size: 0.9rem;
    resize: none;
    transition: border-color 0.2s;
}

.comments-input-area textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.comments-input-area textarea::placeholder {
    color: var(--text-muted);
}

.comment-submit-btn {
    background: #000;
    color: #fff;
    border: none;
    border-radius: 12px;
    padding: 0.75rem 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-theme="dark"] .comment-submit-btn {
    background: #fff;
    color: #000;
}

.comment-submit-btn:hover {
    opacity: 0.85;
    transform: scale(1.02);
}

.comment-submit-btn:active {
    transform: scale(0.98);
}

/* Completed Episode */
.episode-item.completed .episode-number {
    color: var(--success);
}

.episode-item.completed::before {
    content: '\f00c'; /* Font Awesome check icon */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--success);
    font-size: 1.2rem;
}

/* Locked/Scheduled Episode */
.episode-item.locked {
    opacity: 0.7;
}

.episode-item.locked:hover {
    transform: none;
}

.episode-item.locked .episode-play-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
}

.episode-item.locked .episode-play-icon {
    background: rgba(255, 193, 7, 0.9);
}

.episode-item.locked .episode-play-icon i {
    color: #000;
}

/* Shake animation for locked episodes */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

.episode-item.shake,
.episode-card.shake {
    animation: shake 0.5s ease-in-out;
}

/* ===== HISTORY LIST (Timeline Style) ===== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    min-height: 50vh;
}

/* When history-list contains only empty-state, center it */
.history-list:has(.empty-state) {
    align-items: center;
    justify-content: center;
}

.history-date-group {
    margin-bottom: 1rem;
}

.history-date {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

/* ===== PLAYER MODAL ===== */
.player-modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.98);
    z-index: 9999;
    display: none;
    align-items: center;
    justify-content: center;
}

.player-modal.active {
    display: flex;
}

.close-player {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    color: #fff;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.5rem;
    z-index: 10000;
    transition: all var(--transition-fast);
    backdrop-filter: blur(10px);
}

.close-player:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

/* ===== LOADING SKELETON ===== */
.skeleton {
    background: linear-gradient(
        90deg,
        var(--card-bg) 25%,
        var(--border) 50%,
        var(--card-bg) 75%
    );
    background-size: 200% 100%;
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-topic-card {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--card-radius);
}

.skeleton-episode {
    width: 100%;
    height: 120px;
    border-radius: var(--card-radius);
}

/* ===== EMPTY STATES ===== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    min-height: 50vh;
    width: 100%;
    max-width: 100%;
    grid-column: 1 / -1; /* Span all columns if in a grid */
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.empty-state p {
    font-size: 1rem;
}

/* ===== MOBILE RESPONSIVE ===== */

/* Large tablets and small desktops */
@media (max-width: 1200px) {
    .main-content {
        max-width: 100%;
        padding: 1.5rem;
        width: 100%;
    }

    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1.5rem;
    }
}

/* Medium sized devices */
@media (max-width: 900px) {
    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 1.25rem;
    }
}

/* Tablets */
@media (max-width: 1024px) {
    .main-content {
        margin-right: 0;
        padding: 1.5rem;
        max-width: 100%;
        width: 100%;
    }

    .sidebar {
        transform: translateX(100%);
        visibility: hidden;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.4s;
    }

    .sidebar.active {
        transform: translateX(0);
        visibility: visible;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
    }

    .sidebar-toggle {
        display: block;
    }

    .sidebar-overlay.active {
        display: block;
    }

    .topics-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 1.5rem;
    }

    .episode-item {
        flex-direction: column;
        gap: 1rem;
    }

    .episode-thumbnail {
        width: 100%;
    }

    .episode-actions {
        flex-direction: row;
        justify-content: flex-start;
    }

    .view-header h1 {
        font-size: 2.2rem;
    }

    .empty-state {
        min-height: 45vh;
        padding: 3.5rem 2rem;
    }

    .empty-state i {
        font-size: 3.75rem;
    }

    .empty-state h3 {
        font-size: 1.4rem;
    }

    .empty-state p {
        font-size: 0.98rem;
    }
}

/* Mobile landscape and small tablets */
@media (max-width: 768px) {
    .islamvoice-container {
        padding-top: 70px;
    }

    .sidebar {
        top: 65px;
        width: 280px;
        transform: translateX(100%);
        visibility: hidden;
        box-shadow: -5px 0 25px rgba(0, 0, 0, 0.15);
        padding-bottom: env(safe-area-inset-bottom, 0);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0.4s;
    }

    .sidebar.active {
        transform: translateX(0);
        visibility: visible;
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), visibility 0s linear 0s;
    }

    /* Safe area for bottom navigation gesture area */
    .sidebar-nav {
        padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
    }

    .main-content {
        padding: 1.25rem;
        max-width: 100%;
        width: 100%;
    }

    .view-header {
        padding: 0;
        margin-bottom: 1.5rem;
    }

    .view-header h1 {
        font-size: 1.8rem;
        line-height: 1.3;
        margin-bottom: 0.75rem;
    }

    .view-header p {
        font-size: 1rem;
        line-height: 1.5;
    }

    .topics-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0;
    }

    .topic-card-title {
        font-size: 1.2rem;
        line-height: 1.4;
    }

    .topic-card-description {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .episode-number {
        font-size: 1.2rem;
        min-width: 40px;
    }

    .episode-title {
        font-size: 1.1rem;
        line-height: 1.4;
    }

    .episode-description {
        font-size: 0.9rem;
        line-height: 1.5;
    }

    .episode-item {
        padding: 1.25rem;
    }

    .sidebar-btn {
        padding: 0.875rem 1.25rem;
        font-size: 0.95rem;
        min-height: 48px;
    }

    .empty-state {
        min-height: 40vh;
        padding: 3rem 1.5rem;
    }

    .empty-state i {
        font-size: 3.5rem;
    }

    .empty-state h3 {
        font-size: 1.3rem;
    }

    .empty-state p {
        font-size: 0.95rem;
    }
}

/* Mobile portrait */
@media (max-width: 480px) {
    .islamvoice-container {
        padding-top: 140px; /* Extra space for wrapped navbar */
    }

    .main-content {
        padding: 1rem;
        max-width: 100%;
        width: 100%;
    }

    .view-header {
        padding: 0;
        margin-bottom: 1.25rem;
    }

    .view-header h1 {
        font-size: 1.5rem;
        line-height: 1.3;
        margin-bottom: 0.5rem;
    }

    .view-header p {
        font-size: 0.9rem;
        line-height: 1.4;
    }

    .topic-card-content {
        padding: 1rem;
    }

    .topic-card-title {
        font-size: 1.1rem;
        line-height: 1.3;
    }

    .topic-card-description {
        font-size: 0.85rem;
        line-height: 1.4;
        -webkit-line-clamp: 2;
    }

    .episode-item {
        padding: 1rem;
        gap: 0.75rem;
        min-height: 60px;
    }

    .episode-number {
        font-size: 1rem;
        min-width: 35px;
    }

    .episode-title {
        font-size: 1rem;
        line-height: 1.3;
    }

    .episode-description {
        font-size: 0.85rem;
        line-height: 1.4;
    }

    .episode-meta {
        font-size: 0.8rem;
        flex-wrap: wrap;
    }

    .back-btn {
        font-size: 0.9rem;
        padding: 0.6rem 1rem;
    }

    .sidebar {
        width: 100%;
        max-width: 320px;
    }

    .sidebar-title {
        font-size: 1.1rem;
    }

    .sidebar-btn {
        padding: 0.75rem 1rem;
        font-size: 0.9rem;
        gap: 0.75rem;
        min-height: 48px;
    }

    .empty-state {
        min-height: 35vh;
        padding: 2.5rem 1rem;
    }

    .empty-state i {
        font-size: 3rem;
    }

    .empty-state h3 {
        font-size: 1.2rem;
    }

    .empty-state p {
        font-size: 0.9rem;
    }
}

/* Very small mobile devices */
@media (max-width: 360px) {
    .islamvoice-container {
        padding-top: 150px;
    }

    .main-content {
        padding: 0.75rem;
        max-width: 100%;
        width: 100%;
    }

    .view-header {
        margin-bottom: 1rem;
    }

    .view-header h1 {
        font-size: 1.3rem;
        line-height: 1.2;
        margin-bottom: 0.4rem;
    }

    .view-header p {
        font-size: 0.85rem;
        line-height: 1.3;
    }

    .topic-card-content {
        padding: 0.875rem;
    }

    .topic-card-title {
        font-size: 1rem;
        line-height: 1.3;
    }

    .topic-card-description {
        font-size: 0.8rem;
        line-height: 1.3;
        -webkit-line-clamp: 2;
    }

    .episode-item {
        padding: 0.75rem;
    }

    .episode-title {
        font-size: 0.95rem;
        line-height: 1.3;
    }

    .episode-description {
        font-size: 0.8rem;
        line-height: 1.3;
    }

    .sidebar-title {
        font-size: 1rem;
    }

    .sidebar-btn {
        padding: 0.65rem 0.875rem;
        font-size: 0.85rem;
        gap: 0.65rem;
        min-height: 44px;
    }

    .empty-state {
        min-height: 30vh;
        padding: 2rem 0.75rem;
    }

    .empty-state i {
        font-size: 2.5rem;
        margin-bottom: 0.75rem;
    }

    .empty-state h3 {
        font-size: 1.1rem;
        margin-bottom: 0.4rem;
    }

    .empty-state p {
        font-size: 0.85rem;
    }
}

/* Touch feedback for mobile devices */
@media (hover: none) and (pointer: coarse) {
    .sidebar-btn:active,
    .episode-item:active,
    .topic-card:active,
    .back-btn:active {
        transform: scale(0.98);
        opacity: 0.85;
        transition: transform 0.1s, opacity 0.1s;
    }
}

/* Reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .sidebar,
    .sidebar-overlay,
    .topic-card,
    .episode-item {
        transition: none;
    }

    @keyframes fadeIn {
        from, to {
            opacity: 1;
            transform: none;
        }
    }
}
