.share-modal {
    display: none;
    position: fixed;
    z-index: 10010;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.share-modal-content {
    background-color: #1a1a1a;
    margin: 10% auto;
    padding: 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
    color: white;
}

.share-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid #333;
    padding-bottom: 10px;
}

.share-modal-header h3 {
    margin: 0;
    font-size: 20px;
}

.share-modal-close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.share-modal-close:hover {
    color: #fff;
}

.share-content-info {
    display: flex;
    margin-bottom: 20px;
    gap: 15px;
}

#share-thumbnail {
    width: 120px;
    height: 68px;
    object-fit: cover;
    border-radius: 5px;
}

.share-text h4 {
    margin: 0;
    font-size: 16px;
}

.share-links {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.share-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    border-radius: 5px;
    text-decoration: none;
    color: white;
    font-weight: bold;
    transition: background-color 0.3s;
}

.share-button i {
    margin-right: 10px;
}

.share-button.x {
    background-color: #000000;
}

.share-button.facebook {
    background-color: #4267B2;
}

.share-button:hover {
    opacity: 0.9;
}

.share-copy-container {
    display: flex;
    margin-top: 10px;
}

#share-url {
    flex-grow: 1;
    padding: 10px;
    border: 1px solid #333;
    border-radius: 5px 0 0 5px;
    background-color: #222;
    color: white;
}

.copy-button {
    padding: 10px 15px;
    background-color: #00a0ff;
    border: none;
    border-radius: 0 5px 5px 0;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.copy-button i {
    margin-right: 5px;
}

.copy-button:hover {
    background-color: #0084d6;
}

.share-button.native {
    background-color: #4CAF50;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none; /* Remove any border */
    outline: none; /* Remove outline as well */
    font-size: inherit; /* Match font size with other buttons */
    font-weight: bold; /* Match font weight with other buttons */
}

.share-button.native:hover {
    background-color: #45a049;
}

.share-button.native i {
    margin-right: 10px; /* Match icon spacing of other buttons */
    font-size: inherit; /* Ensure icon size is consistent */
}


/* Mobile adjustments */
@media (max-width: 768px) {
    .share-modal-content {
        margin: 20% auto;
        width: 95%;
    }
    
    .share-content-info {
        flex-direction: column;
    }
    
    #share-thumbnail {
        width: 100%;
        height: auto;
        max-height: 150px;
    }
    .episode-share-button {
        opacity: 1 !important; /* Force full opacity on mobile */
        visibility: visible !important;
    }
}

/* Mobile landscape adjustments for share modal */
@media (max-width: 915px) and (orientation: landscape) {
    .share-modal-content {
        margin: 5% auto; /* Reduce top margin in landscape */
        max-height: 85vh; /* Limit height to prevent overflow */
        overflow-y: auto; /* Allow scrolling if content is too tall */
    }
    
    .share-content-info {
        flex-direction: row; /* Keep horizontal layout if possible */
        align-items: center;
    }
    
    #share-thumbnail {
        width: 100px; /* Smaller thumbnail in landscape */
        height: 56px; /* Maintain aspect ratio */
        min-width: 100px; /* Prevent thumbnail from shrinking too much */
    }
    
    .share-modal-body {
        padding: 10px; /* Reduce padding to save space */
    }
    
    .share-links {
        gap: 5px; /* Reduce gap between buttons */
    }
    
    .share-button {
        padding: 8px; /* Smaller padding on buttons */
    }
}

/* iPhone SE and other very small devices */
@media (max-width: 375px) {
    .share-modal-content {
        width: 95%;
        margin: 15% auto;
    }
    
    .share-content-info {
        flex-direction: column;
    }
    
    #share-thumbnail {
        width: 100%;
        height: auto;
        max-height: 120px;
    }
    
    .share-button i {
        font-size: 14px;
    }
    
    .share-modal-header h3 {
        font-size: 18px;
    }
}

/* For very short heights (like iPhone in landscape) */
@media (max-height: 450px) {
    .share-modal-content {
        margin: 2% auto;
        max-height: 90vh;
    }
    
    .share-content-info {
        margin-bottom: 10px;
    }
    
    .share-modal-header {
        margin-bottom: 10px;
        padding-bottom: 5px;
    }
}

/* Mobile portrait adjustments for share modal */
@media (max-width: 480px) and (orientation: portrait) {
    .share-modal-content {
        width: 90%;
        margin: 15% auto;
        padding: 15px; /* Slightly reduced padding */
    }
    
    .share-content-info {
        margin: 0 5px 15px 5px;
        flex-direction: column; /* Stack elements vertically */
    }
    
    #share-thumbnail {
        width: 100%; /* Full width of container */
        height: auto;
        max-height: 180px; /* Limit height but allow proper scaling */
        object-fit: cover; /* Ensure image covers area nicely */
        margin: 0 auto 10px auto; /* Center the thumbnail with margin below */
        border-radius: 8px; /* Slightly larger radius for bigger thumbnail */
    }
    
    .share-text {
        padding: 0 5px;
        text-align: center; /* Center text below thumbnail */
        width: 100%; /* Full width */
    }
    
    .share-links {
        padding: 0 5px; /* Add padding to links container */
    }
    
    .share-copy-container {
        margin: 5px; /* Add margin around copy container */
    }
    
    #share-url {
        padding: 8px; /* Slightly smaller padding for input */
        font-size: 14px; /* Smaller font size */
    }
    
    .copy-button {
        padding: 8px 10px; /* Smaller padding for button */
    }
}

/* Additional adjustments for very narrow phones */
@media (max-width: 320px) {
    .share-modal-content {
        width: 95%;
        padding: 10px;
    }
    
    .share-modal-header h3 {
        font-size: 16px;
    }
    
    .share-button {
        font-size: 14px;
    }
}



/* Player share button */
.vjs-share-button {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 2px;
    padding: 0 8px;
}

.vjs-share-button div {
    display: flex;
    align-items: center;
    height: 100%;
}

.vjs-share-button:hover {
    color: #00a0ff;
}

.vjs-share-button i {
    font-size: 15px;
    line-height: 60px;
}

.vjs-share-button span {
    font-size: 10px;
    font-weight: bold;
}

/* Show detail share button */
.show-detail-share-button {
    display: inline-flex;
    align-items: center;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 8px 15px;
    margin-left: 10px;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.show-detail-share-button i {
    margin-right: 5px;
}

.show-detail-share-button:hover {
    background-color: rgba(0, 160, 255, 0.7);
}

/* Episode card share button */
.episode-share-button {
    position: absolute;
    top: 10px;
    right: 10px;
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.3s, background-color 0.3s;
}

.show-detail-episode-card:hover .episode-share-button {
    opacity: 1;
}

.episode-share-button:hover {
    background-color: rgba(0, 160, 255, 0.7);
}

/* Fix for extremely narrow screens (below 320px) */
@media (max-width: 400px) {
    .share-copy-container {
        flex-direction: column;
        gap: 5px;
    }
    
    #share-url {
        width: 100%;
        border-radius: 5px; /* Restore full rounded corners */
    }
    
    .copy-button {
        width: 100%;
        border-radius: 5px; /* Full rounded corners */
        justify-content: center;
        padding: 8px;
    }
}

/* Additional adjustments for small screens */
@media (max-width: 320px) {
    .share-copy-container {
        margin-top: 5px;
    }
    
    #share-url {
        font-size: 12px;
        padding: 6px;
    }
    
    .copy-button {
        padding: 6px 10px;
        font-size: 12px;
    }
    
    .copy-button i {
        font-size: 12px;
    }
}
