/* ——— DESKTOP ——— */
.series-videos-page-container {
    --attachment-red: #8B0000;
    --attachment-red-light: rgba(139, 0, 0, 0.12);
    --attachment-red-shadow: rgba(139, 0, 0, 0.15);

    display: grid;
    grid-template-columns: 1fr 2fr; /* left sidebar | main */
    gap: 20px;
    margin: 0 auto;

    /* let the browser fill holes */
    grid-auto-flow: row dense;
}

/* fixed positions */
.series-videos-page-video-list { /* left column, span all rows */
    grid-column: 1;
    grid-row: 4 / -1;
}

/* right-hand column blocks */
.series-videos-page-player,
.video-attachment-container,
.video-free-text-container,
.series-videos-page-info {
    grid-column: 2; /* all stack in col 2; rows decided automatically */
}

.series-videos-page-video-list {
    background-color: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    max-height: 700px;
    overflow-y: auto;
    border: 1px solid #e9ecef;
}

.series-videos-page-player {
    background-color: #000;
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.series-videos-page-info {
    background-color: #fff;
    border-radius: 8px;
    padding: 20px;
    border: 1px solid #e9ecef;
}

.series-videos-page-list .video-item {
    display: flex;
    align-items: center;
    padding: 15px;
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    border-radius: 8px;
    margin-bottom: 10px;
    transition: all 0.3s ease;
}

.series-videos-page-list .video-item:hover {
    background-color: #e8f8f9;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.series-videos-page-list .video-item.active {
    background-color: #9ee3ec;
    color: #333;
    box-shadow: 0 4px 12px rgba(158, 227, 236, 0.4);
}

.series-videos-page-list .video-item img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    margin-left: 15px;
    flex-shrink: 0;
}

.series-videos-page-list .video-item-info {
    flex: 1;
    text-align: right;
}

.series-videos-page-list .video-item-info h5 {
    margin: 0 0 5px 0;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.3;
}

.series-videos-page-list .video-item-info p {
    margin: 0;
    font-size: 14px;
    opacity: 0.8;
    line-height: 1.2;
}

.series-videos-page-list .video-item.active .video-item-info h5,
.series-videos-page-list .video-item.active .video-item-info p {
    color: #333;
}

/* Loading state */
.series-videos-page-player.loading {
    display: flex;
    align-items: center;
    justify-content: center;
}

.series-videos-page-player.loading::before {
    content: "טוען...";
    color: white;
    font-size: 18px;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

/* Edit Button Styles */
.series-videos-page-list .video-item {
    position: relative;
}

.edit-video-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background-color: #8B0000;
    color: white;
    padding: 6px 8px;
    border-radius: 4px;
    font-size: 12px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 4px;
    text-decoration: none;
}

.edit-video-btn:hover {
    background-color: #660000;
    color: white;
    text-decoration: none;
}

.edit-video-btn.visible {
    opacity: 1;
}

.edit-video-btn svg {
    width: 12px;
    height: 12px;
    fill: currentColor;
}

/* Login Required Message */
.login-required-message {
    background-color: #f8f9fa;
    padding: 40px;
    text-align: center;
    border: 2px solid #007cba;
    border-radius: 8px;
    margin: 20px 0;
}

.login-required-message h3 {
    color: #007cba;
    margin-bottom: 20px;
    font-size: 1.2em;
}

.login-required-message p {
    color: #666;
    margin-bottom: 25px;
}

/* Login Button */
.login-button {
    display: inline-block;
    background-color: #007cba;
    color: white;
    padding: 12px 25px;
    border-radius: 5px;
    text-decoration: none;
    font-weight: bold;
    transition: background-color 0.3s ease;
}

.login-button:hover,
.login-button.hover {
    background-color: #005a87;
    color: white;
    text-decoration: none;
}

/* Video Teacher Info */
.video-teacher-info {
    background-color: #f8f9fa;
    padding: 20px;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.video-teacher-info h4 {
    margin-bottom: 15px;
    color: #333;
}

.video-teacher-info p {
    margin-bottom: 10px;
    color: #666;
}

.video-teacher-info p:last-child {
    margin-bottom: 0;
}

/* Video Free Text */
.video-free-text {
    background-color: #f8f9fa;
    padding: 15px;
    border-radius: 8px;
    line-height: 1.6;
    border: 1px solid #e9ecef;
}

/* ========================================
   FREE TEXT READ MORE FUNCTIONALITY
   ======================================== */

/* Base free text content styles */
.video-free-text-content {
    line-height: 1.6;
    word-wrap: break-word;
    overflow-wrap: break-word;
    text-align: right;
    direction: rtl;
}

/* Truncated state - limits content to 2 lines */
.video-free-text-content.truncated {
    max-height: calc(1.6em * 2);
    overflow: hidden;
}

/* Read more link styles */
.video-free-text-read-more {
    color: #007cba;
    cursor: pointer;
    font-weight: bold;
    text-decoration: none;
    transition: color 0.3s ease;
    direction: rtl;
    margin-right: 0;
    margin-left: 5px;
}

.video-free-text-read-more:hover {
    color: #005a87;
    text-decoration: underline;
}

.video-free-text-read-more:focus {
    outline: 2px solid #007cba;
    outline-offset: 2px;
}

.video-attachment-container {
    display: none; /* Hidden by default, shown when content is added */
}

.video-attachment-container.is-visible {
    display: block;
}

.video-attachment-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.video-attachment-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background-color: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    box-shadow: none;
    color: #1f2d3d;
    font-weight: 600;
    text-decoration: none;
    transition: box-shadow 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
    direction: rtl;
}

.video-attachment-item:hover,
.video-attachment-item:focus {
    box-shadow: 0 4px 12px var(--attachment-red-shadow);
    background-color: #ffffff;
    border-color: var(--attachment-red);
    color: var(--attachment-red);
    outline: none;
    text-decoration: none;
}

.video-attachment-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--attachment-red-light);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--attachment-red);
    flex-shrink: 0;
}

.video-attachment-icon .fa {
    font-size: 14px;
}

.video-attachment-title {
    font-size: 13px;
}

.video-attachment-message {
    margin: 0;
    padding: 10px 12px;
    background-color: #fff5f5;
    border: 1px solid var(--attachment-red-shadow);
    border-radius: 6px;
    color: var(--attachment-red);
    font-weight: 500;
}

/* ——— MOBILE ——— */
@media (max-width: 768px) {
    .series-videos-page-container {
        grid-template-columns: 1fr; /* single column */
        gap: 15px;
        /* grid-auto-flow: row;   "dense" no longer needed */
    }

    /* reset columns so everything spans full width */
    .series-videos-page-video-list,
    .series-videos-page-player,
    .video-attachment-container,
    .video-free-text-container,
    .series-videos-page-info {
        grid-column: 1;
        grid-row: auto; /* normal flow */
    }

    .series-videos-page-video-list {
        max-height: 500px;
    }

    /*.series-videos-page-player {*/
    /*    padding-bottom: 56.25%; !* Maintain 16:9 aspect ratio on mobile *!*/
    /*}*/

    .series-videos-page-list .video-item {
        padding: 10px;
    }

    .series-videos-page-list .video-item img {
        width: 50px;
        height: 50px;
        margin-left: 10px;
    }
}