/* BrawnyAI Video Gallery Custom Styles - Phase 1.5 Native Integration */
:root {
    /* We inherit background and text colors directly from the theme now. 
       Adding subtle variables for layout geometry. */
    --vimeo-radius-lg: 16px;
    --vimeo-radius-md: 12px;
    --vimeo-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    --vimeo-shadow-hover: 0 10px 30px rgba(0, 0, 0, 0.1);
    --vimeo-accent-glow: 0 0 10px var(--ghost-accent-color, rgba(138, 43, 226, 0.3));
}

.brawny-video-container .gh-main {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 4%;
}

/* 1. Gallery Grid View */
#vimeo-app-root {
    width: 100%;
    padding: 0 1%; /* Let gh-main padding handle most of the sides */
    padding-bottom: 6rem; /* Space before subscribe footer */
}

.vimeo-user-stats {
    font-size: 0.95rem;
    opacity: 0.8;
    margin-bottom: 1.5rem;
    text-align: right;
    font-weight: 600;
    color: inherit;
    padding-right: 10px;
}

.vimeo-watched-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: var(--ghost-accent-color, rgba(138, 43, 226, 0.9));
    color: white;
    font-size: 0.75rem;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 700;
    z-index: 10;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.vimeo-gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2rem;
    padding-top: 1rem;
}

.vimeo-card {
    border-radius: var(--vimeo-radius-lg);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid rgba(128, 128, 128, 0.15); /* very subtle border */
    background: transparent;
}

.vimeo-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--vimeo-shadow-hover);
    border-color: var(--ghost-accent-color, #ccc);
}

.vimeo-thumbnail-wrapper {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: #e8e8e8; /* Loader state placeholder */
    border-radius: var(--vimeo-radius-lg);
}

.vimeo-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.vimeo-card:hover .vimeo-thumbnail {
    transform: scale(1.04);
}

.vimeo-duration {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 0.85rem;
    font-weight: 600;
}

.vimeo-info {
    padding: 1.25rem 0.5rem;
}

.vimeo-grid-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--ghost-accent-color, #8A2BE2);
    font-weight: 600;
    margin-bottom: 0.4rem;
}

.vimeo-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: inherit; /* Use default Ghost theme text color */
}

/* 2. Player View Architecture */
.vimeo-player-layout {
    display: grid;
    grid-template-columns: minmax(0, 2.5fr) minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
}

@media (max-width: 1024px) {
    .vimeo-player-layout {
        grid-template-columns: 1fr;
    }
}

.vimeo-main-stage {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Moved title above the player */
.vimeo-player-title {
    font-size: 2.2rem;
    line-height: 1.3;
    font-weight: 700;
    margin: 0 0 0.5rem 0;
    color: inherit; 
}

.vimeo-iframe-wrapper {
    position: relative;
    width: 100%;
    padding-top: 56.25%; /* 16:9 Aspect Ratio */
    background: #000;
    border-radius: var(--vimeo-radius-lg);
    overflow: hidden;
    box-shadow: var(--vimeo-shadow);
    transition: padding 0.3s ease, aspect-ratio 0.3s ease;
    margin: 0 auto; /* Keep it centered if max-height restricts width */
}

.vimeo-iframe-wrapper iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: none;
}

.vimeo-details-open {
    padding: 1rem 0;
    line-height: 1.7;
}

.vimeo-meta-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    margin-top: 1rem;
}

.vimeo-btn {
    background: transparent;
    color: inherit;
    border: 1px solid rgba(128,128,128,0.3);
    padding: 0.6rem 1.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.vimeo-btn.primary {
    background: var(--ghost-accent-color, #000);
    border-color: var(--ghost-accent-color, #000);
    color: #fff; /* Primary always needs white text */
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.vimeo-btn:hover {
    background: rgba(128,128,128,0.1);
}

.vimeo-btn.primary:hover {
    filter: brightness(110%);
    box-shadow: var(--vimeo-accent-glow);
}

/* Ghost Native Member Visibility Lock */
.is-logged-in .vimeo-btn-subscribe {
    display: none !important;
}

/* Sidebar Up Next */
.vimeo-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.vimeo-sidebar-header h3 {
    margin: 0;
    font-size: 1.4rem;
    font-weight: 700;
    opacity: 0.8;
}

.vimeo-shuffle-btn {
    font-size: 0.85rem;
    padding: 0.4rem 0.8rem;
}

.vimeo-shuffle-btn.active {
    background: var(--ghost-accent-color, #000);
    color: #fff;
    border-color: var(--ghost-accent-color, #000);
}

.vimeo-sidebar-list {
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.vimeo-sidebar-item {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1.2rem;
    cursor: pointer;
    transition: background 0.2s;
    border-radius: var(--vimeo-radius-md);
    padding: 0.5rem;
}

.vimeo-sidebar-item:hover {
    background: rgba(128,128,128,0.08); /* Ghost agnostic hover */
}

.vimeo-sidebar-item .vimeo-thumbnail-wrapper {
    border-radius: var(--vimeo-radius-md);
}

.vimeo-sidebar-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: inherit;
}

.vimeo-back-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--ghost-accent-color, #000);
    cursor: pointer;
    font-weight: 600;
    margin-bottom: 2rem;
    transition: opacity 0.2s;
    font-size: 1.5rem;
}

.vimeo-view-count {
    color: var(--ghost-accent-color, #8A2BE2);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    display: block; /* So it sits nicely under title */
}

.vimeo-back-nav:hover {
    opacity: 0.7;
}

/* Utilities */
.loader-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(128,128,128,0.2);
    border-radius: 50%;
    border-top-color: var(--ghost-accent-color, #000);
    animation: spin 1s ease-in-out infinite;
    margin: 0 auto 1rem auto;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Toast Notifications */
.vimeo-toast-container {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.vimeo-toast {
    background: var(--ghost-accent-color, #000);
    color: #fff;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    opacity: 0;
    transform: translateY(100%);
    animation: slideInUp 0.3s forwards, fadeOutDown 0.3s 2.5s forwards;
}

@keyframes slideInUp {
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutDown {
    to { opacity: 0; transform: translateY(100%); }
}

/* Custom Fullscreen Button (for 9:16 portrait videos where Vimeo hides its own) */
.vimeo-fullscreen-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    border: none;
    padding: 8px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.3s;
    backdrop-filter: blur(4px);
}

.vimeo-iframe-wrapper:hover .vimeo-fullscreen-btn {
    opacity: 1;
}

.vimeo-fullscreen-btn:hover {
    background: var(--ghost-accent-color, rgba(0,0,0,0.85));
}

/* When wrapper enters native fullscreen mode */
.vimeo-iframe-wrapper:fullscreen,
.vimeo-iframe-wrapper:-webkit-full-screen,
.vimeo-ios-fullscreen {
    padding-top: 0 !important;
    border-radius: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
    max-height: none !important;
}

.vimeo-ios-fullscreen {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 999999 !important;
    margin: 0 !important;
}

.vimeo-iframe-wrapper:fullscreen iframe,
.vimeo-iframe-wrapper:-webkit-full-screen iframe,
.vimeo-ios-fullscreen iframe {
    position: relative;
    max-width: 100vw;
    max-height: 100vh;
    width: 100%;
    height: 100%;
}
