body {
    margin: 0;
    font-family: 'Rubik', sans-serif;
    background: #f4f7fa;
    color: #333;
    direction: rtl;
}

.site-header {
    background: linear-gradient(to right, #008080, #4A90E2);
    color: #fff;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.main-container {
    max-width: 960px;
    margin: 1rem auto;
    padding: 0 1rem;
}

#player-container {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    box-shadow: 0 0 10px rgba(0,0,0,0.05);
    margin-bottom: 1.5rem;
    display: none;
}

#now-playing {
    font-weight: bold;
    margin-bottom: 0.75rem;
    color: #008080;
    font-size: 1.1rem;
    text-align: center;
}

/* סגנון כללי לנגני מדיה */
video, audio, #iframe-player iframe {
    width: 100%;
    border-radius: 10px;
    margin-bottom: 0.5rem;
}

/* סגנון ספציפי לנגן האודיו */
#audio-player {
    height: 40px;
    background: #f0f0f0;
    border: 1px solid #ddd;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: block;
    min-height: unset;
    appearance: none;
}

/* תיקון כפתורי שליטה */
#audio-player::-webkit-media-controls {
    display: flex !important;
    background: transparent;
    color: #333;
}

#audio-player::-webkit-media-controls-panel {
    background: #f0f0f0;
    border-radius: 8px;
    padding: 0;
    height: 40px;
}

/* סגנון לנגן וידאו */
#player {
    width: 100%;
    max-height: 400px;
    object-fit: contain;
    background: #000;
}

/* סגנון לנגן iframe */
#iframe-player {
    width: 100%;
    max-height: 400px; 
}

#iframe-player iframe {
    max-width: 100%;
    height: 350px; 
    border: none; 
    background: #000; 
}

#loading, #success, #error {
    text-align: center;
    font-size: 0.9rem;
    margin-top: 0.5rem;
}

#success {
    color: #38a169;
}

#error {
    color: #e53e3e;
}

.channels-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
}

.channel-card {
    background: #fff;
    border-radius: 12px;
    padding: 0.5rem;
    box-shadow: 0 0 6px rgba(0,0,0,0.05);
    cursor: pointer;
    transition: transform 0.2s ease;
    text-align: center;
    display: block;
    width: 80px;
    height: 80px;
    position: relative;
    margin: auto;
}

.channel-card:hover {
    transform: translateY(-3px);
}

.channel-logo {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain;
    background: #eee;
}

.channel-info, .info-button {
    display: none;
}

.tab-bar {
    display: flex;
    justify-content: space-around;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #fff;
    box-shadow: 0 -2px 6px rgba(0,0,0,0.05);
    z-index: 10;
}

.tab-button {
    flex: 1;
    padding: 0.75rem 0;
    border: none;
    background: none;
    font: inherit;
    text-align: center;
    color: #888;
    font-size: 0.9rem;
}

.tab-button.active {
    color: #008080;
    font-weight: 600;
}

.tab-button i {
    display: block;
    font-size: 1.2rem;
    margin-bottom: 0.25rem;
}

.tab-content {
    display: none;
    margin-bottom: 4rem;
}

.tab-content.active {
    display: block;
}

.tab-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.search-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #008080;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.search-icon:hover {
    color: #006666;
}

.footer {
    text-align: center;
    padding: 1rem;
    font-size: 0.85rem;
    color: #666;
    background: #f4f7fa;
    border-top: 1px solid #ddd;
    margin-bottom: 3.5rem;
}

.footer-content img {
    vertical-align: middle;
    margin-bottom: 0.5rem;
}

.footer-note {
    font-size: 0.8rem;
    margin-top: 0.3rem;
    color: #999;
}

#player-wrapper {
    max-width: 900px;
    margin: 1rem auto;
    padding: 0.5rem;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

/* note */
.reception-notice {
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: transparent;
    color: #ffffff;
    padding: 8px 12px;
    border-radius: 4px;
    border: 1px solid #ffffff;
    font-size: 0.9em;
    margin-top: 15px;
    text-decoration: none;
    cursor: pointer;
    width: fit-content;
    margin-inline: auto;
}

.reception-notice i {
    margin-inline-end: 6px;
    font-size: 1.1em;
}

.reception-notice:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: #f0f0f0;
}

/* search style */
.search-panel {
    position: fixed;
    top: 20%;
    left: 0;
    right: 0;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 101; /* מעל התוצאות */
    animation: fadeIn 0.3s ease-in-out;
}

.search-panel-content {
    background: #fff;
    border-radius: 12px;
    max-width: 90%;
    width: 500px;
    padding: 1rem;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: expandIn 0.3s ease-in-out;
}

.search-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: #f0f0f0;
    border-radius: 25px;
    padding: 0.5rem 1rem;
}

#search-input {
    flex-grow: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 0.5rem;
    color: #333;
    outline: none;
    text-align: right;
}

#clear-search {
    background: none;
    border: none;
    font-size: 1.2rem;
    color: #e53e3e;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

#clear-search:hover {
    color: #c53030;
}

#close-search-panel {
    position: absolute;
    bottom: -2.5rem; /* מתחת לחלון */
    right: 50%; /* מרכז אופקית */
    transform: translateX(50%); /* התאמה למרכז */
    background: #fff; /* רקע לבן לנראות */
    border-radius: 50%; /* צורה עגולה */
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: #555;
    cursor: pointer;
    transition: color 0.2s, background 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}

#close-search-panel:hover {
    color: #e53e3e;
    background: #f0f0f0;
}

.search-results {
    position: fixed;
    top: 30%; /* מתחת לשורת החיפוש */
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
    display: none;
    align-items: flex-start;
    justify-content: center;
    z-index: 100;
    animation: fadeIn 0.3s ease-in-out;
}

.search-results-content {
    background: #fff;
    border-radius: 12px;
    max-width: 90%;
    width: 600px;
    max-height: 60vh;
    overflow-y: auto;
    padding: 1.5rem;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: slideIn 0.3s ease-in-out;
}

.search-results-content h2 {
    margin: 0 0 1rem;
    font-size: 1.2rem;
    color: #008080;
    text-align: center;
}

#close-search-results {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #555;
    cursor: pointer;
    transition: color 0.2s;
}

#close-search-results:hover {
    color: #e53e3e;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

@keyframes expandIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

/* התאמות למסכים קטנים (ניידים) */
@media screen and (max-width: 600px) {
    #audio-player {
        height: 35px;
        margin: 0.5rem 0;
    }

    #audio-player::-webkit-media-controls-panel {
        height: 35px;
    }

    #player {
        max-height: 300px;
    }

    #iframe-player iframe {
        height: 300px; /* התאמה לגובה קטן יותר במובייל */
    }

    #player-container {
        padding: 0.5rem;
    }

    .tab-header h2 {
        font-size: 1.2rem;
    }

    .search-icon {
        font-size: 1.2rem;
        padding: 0.3rem;
    }

    .search-panel {
        top: 10%;
    }

    .search-panel-content {
        max-width: 95%;
        padding: 0.8rem;
    }

    .search-results {
        top: 20%;
    }

    .search-results-content {
        max-width: 95%;
        padding: 1rem;
        max-height: 70vh;
    }

    .search-results-content h2 {
        font-size: 1rem;
    }
    
    .channel-card {
        width: 70px;
        height: 70px;
    }
    
    .channels-container {
        grid-template-columns: repeat(auto-fill, minmax(75px, 1fr));
        gap: 0.75rem;
    }
}

/* Dark Mode */
@media (prefers-color-scheme: dark) {
    body {
        background-color: #121212;
        color: #e0e0e0;
    }

    .site-header h1,
    .tab-button span,
    .footer-text,
    .footer-note,
    #now-playing,
    #success,
    #error {
        color: #e0e0e0;
    }

    .tab-bar {
        background-color: #1f1f1f;
    }

    .tab-button {
        background-color: #1f1f1f;
        border: none;
        color: #e0e0e0;
    }

    .tab-button.active {
        background-color: #333;
        color: #fff;
    }

    .channel-card {
        background-color: #1e1e1e;
        border: 1px solid #333;
    }

    .channel-logo {
        filter: brightness(0.9);
    }

    #player-container {
        background-color: #1a1a1a;
        border: 1px solid #333;
    }

    #audio-player {
        background: #2a2a2a;
        border: 1px solid #444;
    }

    #audio-player::-webkit-media-controls-panel {
        background: #2a2a2a;
        color: #e0e0e0;
    }

    #player {
        background: #1a1a1a;
    }

    #iframe-player iframe {
        background: #1a1a1a; /* רקע כהה ל-iframe ב-Dark Mode */
    }

    .info-button {
        color: #ccc;
    }

    .footer {
        background-color: #1c1c1c;
        border-top: 1px solid #333;
    }

    .search-icon {
        color: #ccc;
    }

    .search-icon:hover {
        color: #fff;
    }

    .search-panel-content {
        background: #1e1e1e;
        box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    }

    .search-container {
        background: #2a2a2a;
    }

    #search-input {
        color: #e0e0e0;
    }

    #clear-search {
        color: #e53e3e;
    }

    #clear-search:hover {
        color: #c53030;
    }

    #close-search-panel {
        color: #ccc;
    }

    #close-search-panel:hover {
        color: #e53e3e;
    }

    .search-results-content {
        background: #1e1e1e;
        box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    }

    .search-results-content h2 {
        color: #ccc;
    }

    #close-search-results {
        color: #ccc;
    }

    #close-search-results:hover {
        color: #e53e3e;
    }
}

.group-link {
    background: #fff;
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.05);
    transition: transform 0.2s ease;
    cursor: pointer;
}

.group-link:hover {
    transform: translateY(-3px);
}

.group-card {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    width: 100%;
}

.group-icon img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 8px;
    background: #f0f0f0;
}

.group-info {
    flex: 1;
}

.group-info h2 {
    margin: 0;
    font-size: 1.1rem;
    color: #2d3748;
}

.channel-info {
    font-size: 0.85rem;
    color: #555;
    margin-top: 0.25rem;
}

.channel-comment {
    font-size: 0.8rem;
    color: #999;
    margin-top: 0.25rem;
}

.button-group {
    margin-top: 0.5rem;
    display: flex;
    gap: 0.5rem;
}

.info-button, .website-button {
    background: none;
    border: none;
    font-size: 1rem;
    color: #008080;
    cursor: pointer;
}

.join-button {
    font-size: 1.5rem;
    color: #008080;
    align-self: center;
    margin-inline-start: auto;
}

/* Small Radio clip */
.channel-card.audio-only {
    align-items: center;
    padding: 0.75rem;
}

.channel-card.audio-only .channel-logo {
    width: 40px;
    height: 40px;
}

.channel-card.audio-only .channel-info h3 {
    font-size: 0.95rem;
}

/* Loading Channel placeholder */
.channel-placeholder {
    border-radius: 12px;
    margin: 8px;
    background: linear-gradient(90deg, #eee 25%, #ddd 50%, #eee 75%);
    animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
    0% { background-position: -200px 0; }
    100% { background-position: 200px 0; }
}

/*
 * עיצוב קישור "ערוצים נוספים"
 */
.custom-sport-tab {
    background: #fff;
    color: #2d3748;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    max-width: 960px;
    margin: 1rem auto;
    width: 100%;
    box-sizing: border-box;
    padding: 1rem;
    text-decoration: none;
    display: flex; /* הגדרת תצוגה גמישה */
    flex-direction: row-reverse; /* כדי שהלוגו יהיה מצד ימין */
    align-items: center; /* יישור אנכי למרכז */
    gap: 1rem;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.custom-sport-tab:hover,
.custom-sport-tab:focus {
    transform: translateY(-3px);
    background: #f0f0f0;
}

.custom-sport-tab .channel-logo {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
    flex-shrink: 0; /* מונע מהתמונה להתכווץ */
}

.custom-sport-tab .channel-info {
    flex-grow: 1; /* מאפשר לטקסט לתפוס את כל השטח הנותר */
    text-align: right; /* יישור הטקסט לימין */
    overflow: hidden; /* מונע גלישה של טקסט מחוץ לאזור */
}

.custom-sport-tab .channel-title {
    color: #2d3748;
    font-weight: bold;
    margin: 0;
}

.custom-sport-tab .tab-description {
    color: #555;
    font-weight: normal;
    margin: 0.2rem 0 0;
    white-space: nowrap; /* מונע ירידת שורה */
    overflow: hidden; /* מונע גלישה של טקסט */
    text-overflow: ellipsis; /* מוסיף נקודות (...) לטקסט חתוך */
}

@media screen and (max-width: 600px) {
    .custom-sport-tab {
        padding: 0.75rem;
    }
    .custom-sport-tab .channel-logo {
        width: 40px;
        height: 40px;
    }
    .custom-sport-tab .channel-info {
        font-size: 0.9rem;
    }
}

@media (prefers-color-scheme: dark) {
    .custom-sport-tab {
        background: #1e1e1e;
        color: #e0e0e0;
    }
    .custom-sport-tab .channel-title {
        color: #e0e0e0;
    }
    .custom-sport-tab .tab-description {
        color: #ccc;
    }
    .custom-sport-tab:hover {
        background: #2a2a2a;
    }
}

/* כללים חדשים עבור מתג התצוגה וכפתורים */
.view-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-icon {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #008080;
    cursor: pointer;
    padding: 0.5rem;
    transition: color 0.2s;
}

.view-icon:hover, .view-icon.active {
    color: #006666;
}

/* כללים לתצוגת רשימה */
.channels-container.list-view {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
}

.channels-container.list-view .channel-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    max-width: none;
    height: auto;
    padding: 0.75rem;
    text-align: right;
    margin: 0;
    text-decoration: none;
}

.channels-container.list-view .channel-card:hover {
    transform: none;
    background: #f0f0f0;
}

.channels-container.list-view .channel-logo {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    object-fit: contain;
    background: #f0f0f0;
}

.channels-container.list-view .channel-info {
    display: block;
    margin-right: 1rem;
    flex-grow: 1;
}

.channels-container.list-view .channel-info h3 {
    margin: 0 0 0.25rem;
    font-size: 1.1rem;
    color: #2d3748;
}

.channels-container.list-view .channel-info p {
    margin: 0;
    font-size: 0.9rem;
    color: #555;
    line-height: 1.3;
}

.channels-container.list-view .channel-card .info-button {
    display: block;
}

/* התאמות למסכים קטנים (ניידים) */
@media screen and (max-width: 600px) {
    .view-icon {
        font-size: 1.2rem;
        padding: 0.3rem;
    }
    .channels-container.list-view .channel-card {
        box-sizing: border-box; /* תיקון 1 */
    }
    .channels-container.list-view .channel-logo {
        width: 40px; /* תיקון 1 */
        height: 40px;
        flex-shrink: 0; /* תיקון 1 */
    }
    .channels-container.list-view .channel-info {
        flex-grow: 1; /* תיקון 1 */
        overflow: hidden; /* תיקון 1 */
    }
    .channels-container.list-view .channel-info h3 {
        font-size: 0.95rem;
        white-space: nowrap; /* כותרת תישאר בשורה אחת */
        overflow: hidden; /* מונע גלישה */
        text-overflow: ellipsis; /* מוסיף נקודות */
    }
/* התאמות למסכים קטנים (ניידים) */
@media screen and (max-width: 600px) {
    /* ... (קוד קיים של ערוצים אחרים) ... */
    
    .channels-container.list-view .channel-info h3 {
        font-size: 0.95rem;
        white-space: nowrap; /* כותרת תישאר בשורה אחת */
        overflow: hidden; 
        text-overflow: ellipsis; 
    }
    
    .channels-container.list-view .channel-info p {
        white-space: normal; /* **התיקון: מאפשר ירידת שורה חופשית** */
        overflow: visible; /* **התיקון: מבטל הסתרה** */
        text-overflow: clip; /* **התיקון: מבטל קיטום** */
        display: block; /* **התיקון: מבטל את ה-flex box של הקיטום** */
        max-height: none; /* **התיקון: מבטל הגבלת גובה** */
    }
}}

/* התאמות למצב כהה */
@media (prefers-color-scheme: dark) {
    .view-icon {
        color: #ccc;
    }
    .view-icon:hover, .view-icon.active {
        color: #fff;
    }
    .channels-container.list-view .channel-info h3,
    .channels-container.list-view .channel-info p {
        color: #e0e0e0;
    }
}

/*
 * מבטיח שהכפתורים בטאבים יוצבו בצורה נכונה
 */
.tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.tab-controls {
  display: flex;
  gap: 1rem;
}

/*
 * עיצוב כפתורי החלפת התצוגה והחיפוש
 */
.view-toggle-btn, .search-icon {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: #008080;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease-in-out;
}

.view-toggle-btn:hover, .search-icon:hover {
  transform: scale(1.1);
  color: #006666;
}

/*
 * עיצוב כפתורי החיפוש בתוך החיפוש המוקפץ
 */
#clear-search, #close-search-panel, #close-search-results {
  background: none;
  border: none;
  font-size: 1.25rem;
  color: #555;
  cursor: pointer;
  padding: 0;
}

/* כפתור צף חדש */
.floating-sport-btn {
    position: fixed;
    bottom: 6rem; /* מיקום מעל כפתורי הטאבים */
    right: 1rem;
    background: #fff;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-sport-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}

.floating-sport-btn img {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

.floating-sport-btn.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none; /* מבטל אפשרות ללחוץ עליו לפני שהוא גלוי */
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.floating-sport-btn.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto; /* מאפשר לחיצה */
    transition: opacity 0.5s ease, transform 0.2s ease;
}

/* כפתור צף חדש - נשאר כדי לקבוע מיקום ועיצוב */
.floating-sport-btn {
    position: fixed;
    bottom: 6rem; /* מיקום מעל כפתורי הטאבים */
    right: 1rem;
    background: #2493f9;
    border-radius: 50%;
    width: 60px;
    height: 60px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.floating-sport-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
}
@media screen and (max-width: 600px) {
    .floating-sport-btn {
        bottom: 5rem; /* התאמה למסכים קטנים */
        width: 50px;
        height: 50px;
    }
    .floating-sport-btn img {
        width: 30px;
        height: 30px;
    }
}