/* Super Ace Video Card Component */
.super-ace-video-card {
    background: var(--theme-surface-1);
    border-radius: 0.75rem;
    overflow: hidden;
    box-shadow: var(--theme-shadow);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    border: 1px solid var(--theme-border-color);
}

.super-ace-video-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--theme-shadow-lg);
}

/* Video Container */
.super-ace-video-card .video-container {
    position: relative;
    aspect-ratio: 9/16; /* Portrait orientation to match video */
    overflow: hidden;
    background: #000;
    cursor: pointer;
}

/* Inline Video */
.super-ace-video-card .inline-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: #000;
}

/* Video Thumbnail */
.super-ace-video-card .video-thumbnail {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--theme-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.super-ace-video-card .thumbnail-image {
    width: 100%;
    height: 100%;
    object-fit: cover; /* This will crop to fill the square, centering the content */
}

.super-ace-video-card .placeholder-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: var(--theme-surface-3);
    color: var(--theme-text-muted);
    font-size: 3rem;
}

/* Generating Thumbnail Placeholder */
.super-ace-video-card .placeholder-thumbnail.generating-thumbnail {
    background: linear-gradient(135deg,
    var(--theme-surface-2) 0%,
    var(--theme-surface-3) 50%,
    var(--theme-surface-2) 100%);
    animation: shimmer 2s ease-in-out infinite;
}

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

.super-ace-video-card .thumbnail-generating-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    text-align: center;
    padding: 2rem;
}

.super-ace-video-card .spinner-container {
    font-size: 2.5rem;
    color: var(--theme-primary);
    opacity: 0.8;
}

.super-ace-video-card .spinner-container i {
    animation: spin 1s linear infinite;
}

.super-ace-video-card .generating-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    letter-spacing: -0.01em;
}

.super-ace-video-card .generating-subtext {
    font-size: 0.875rem;
    color: var(--theme-text-muted);
    opacity: 0.7;
}

/* Video Overlay */
.super-ace-video-card .video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0) 50%,
    rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.super-ace-video-card .video-container:hover .video-overlay {
    opacity: 1;
}

.super-ace-video-card .play-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.super-ace-video-card .play-button:hover {
    transform: scale(1.1);
}

.super-ace-video-card .play-button i {
    color: #000;
    font-size: 1.5rem;
    margin-left: 3px;
}

.super-ace-video-card .duration-badge {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
}

.super-ace-video-card .verified-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--theme-success);
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
}

/* Super Ace Label */
.super-ace-video-card .super-ace-label {
    position: absolute;
    top: 8px;
    left: 8px;
    background: linear-gradient(135deg, #ec4899 0%, #f43f5e 100%);
    color: white;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(236, 72, 153, 0.3);
    z-index: 10;
}

/* Video Controls Overlay */
.super-ace-video-card .video-controls-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 100;
    align-items: center;
    justify-content: flex-end;
}

.super-ace-video-card .video-control-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    padding: 0;
}

.super-ace-video-card .video-control-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.super-ace-video-card .video-control-btn i {
    font-size: 14px;
}

/* Fullscreen mode styles */
.video-container.fullscreen-mode {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #000;
}

.video-container.fullscreen-mode .inline-video {
    width: 100%;
    height: 100%;
    max-width: 100vw;
    max-height: 100vh;
    object-fit: contain; /* Maintain aspect ratio in fullscreen */
}

.video-container.fullscreen-mode .video-controls-overlay {
    position: fixed;
    bottom: 20px;
    right: 20px;
}

/* Larger controls in fullscreen */
.video-container.fullscreen-mode .video-control-btn {
    width: 48px;
    height: 48px;
}

.video-container.fullscreen-mode .video-control-btn i {
    font-size: 18px;
}

/* Mobile-specific fullscreen styles */
@media (max-width: 768px) {
    /* iOS video fullscreen fixes */
    .inline-video::-webkit-media-controls-fullscreen-button {
        display: none !important; /* Hide native fullscreen button since we have our own */
    }

    /* Ensure video fills screen properly in fullscreen */
    .video-container.fullscreen-mode .inline-video,
    .inline-video[webkit-playsinline]:fullscreen {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        max-width: none !important;
        max-height: none !important;
        object-fit: contain !important;
        z-index: 9999 !important;
        background: #000 !important;
    }

    /* Ensure controls stay visible in mobile fullscreen */
    .video-container.fullscreen-mode .video-controls-overlay {
        position: fixed !important;
        z-index: 10000 !important;
    }

    /* Fallback fullscreen styles */
    .video-container.fallback-fullscreen {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        z-index: 9999 !important;
        background: #000 !important;
    }

    /* Prevent body scroll when in fullscreen */
    body.video-fullscreen-active {
        overflow: hidden !important;
        position: fixed !important;
        width: 100% !important;
        height: 100% !important;
    }
}

/* Swipe indicator for mobile fullscreen */
@media (max-width: 768px) and (pointer: coarse) {
    .video-container.fullscreen-mode::before {
        content: '↓ Swipe down to exit • Swipe up for next ↑';
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0, 0, 0, 0.7);
        color: white;
        padding: 8px 16px;
        border-radius: 20px;
        font-size: 12px;
        z-index: 10001;
        animation: fadeInOut 4s ease-in-out;
        pointer-events: none;
    }
}

@keyframes fadeInOut {
    0% {
        opacity: 0;
    }
    20% {
        opacity: 1;
    }
    80% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Video Info */
.super-ace-video-card .video-info {
    padding: 1rem;
    background: var(--theme-surface-1);
    border-top: 1px solid var(--theme-border-color);
}

.super-ace-video-card .player-info {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 0.75rem;
}

.super-ace-video-card .player-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 3px solid var(--theme-primary);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.15);
}

.super-ace-video-card .player-avatar-placeholder {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--theme-primary) 0%, var(--theme-primary-light, #66b3ff) 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.3rem;
    flex-shrink: 0;
    border: 3px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2);
}

.super-ace-video-card .player-details {
    flex: 1;
    min-width: 0;
}

.super-ace-video-card .player-name {
    color: var(--theme-text-primary);
    font-weight: 700;
    font-size: 1.05rem;
    margin-bottom: 0.5rem;
    letter-spacing: -0.01em;
}

.super-ace-video-card .player-name-link {
    color: var(--theme-text-primary);
    text-decoration: none;
    transition: color 0.2s;
}

.super-ace-video-card .player-name-link:hover {
    color: var(--theme-primary);
    text-decoration: underline;
}

/* Location Info Row */
.super-ace-video-card .location-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.5rem;
}

.super-ace-video-card .location-item {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
}

.super-ace-video-card .location-item i {
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    opacity: 0.7;
}

.super-ace-video-card .par-badge {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    padding: 0.1rem 0.4rem;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

/* Disc Information */
.super-ace-video-card .disc-info {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.75rem;
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.super-ace-video-card .disc-info i {
    font-size: 0.9rem;
    animation: spin 4s linear infinite;
}

/* Meta Info Row */
.super-ace-video-card .meta-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.super-ace-video-card .event-date {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.825rem;
    color: var(--theme-text-muted);
    font-weight: 500;
}

.super-ace-video-card .event-date i {
    font-size: 0.8rem;
    opacity: 0.7;
}

.super-ace-video-card .event-link {
    color: var(--theme-primary);
    text-decoration: none;
    font-size: 0.825rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    transition: all 0.2s ease;
    padding: 0.3rem 0.6rem;
    background: var(--theme-primary-bg, rgba(0, 123, 255, 0.08));
    border-radius: 6px;
    font-weight: 600;
    border: 1px solid var(--theme-primary-border, rgba(0, 123, 255, 0.2));
}

.super-ace-video-card .event-link:hover {
    color: white;
    background: var(--theme-primary);
    text-decoration: none;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.super-ace-video-card .event-link i {
    font-size: 0.8rem;
}

/* Video Description */
.super-ace-video-card .video-description {
    padding: 0.75rem;
    margin: 0.75rem 0;
    background: var(--theme-surface-2);
    border-radius: 8px;
    border-left: 3px solid var(--theme-primary);
}

.super-ace-video-card .video-description p {
    margin: 0;
    color: var(--theme-text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    font-style: italic;
}

/* Engagement Stats Bar */
.super-ace-video-card .engagement-bar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem;
    margin: -1rem;
    margin-top: 0.75rem;
    background: linear-gradient(to right,
    var(--theme-surface-2) 0%,
    var(--theme-surface-1) 100%);
    border-top: 1px solid var(--theme-border-color);
    border-radius: 0 0 0.75rem 0.75rem;
}

.super-ace-video-card .engagement-stat {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.super-ace-video-card .engagement-stat i {
    font-size: 0.9rem;
    color: var(--theme-text-muted);
}

.super-ace-video-card .engagement-stat .stat-label {
    font-size: 0.75rem;
    color: var(--theme-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.super-ace-video-card .engagement-stat .stat-value {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--theme-text-primary);
}

.super-ace-video-card .engagement-stat.verified {
    margin-left: auto;
}

.super-ace-video-card .engagement-stat.verified i {
    color: var(--theme-success);
    font-size: 1.1rem;
}

/* Grid Layout for Multiple Cards */
.super-ace-video-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

/* Responsive */
@media (max-width: 768px) {
    .super-ace-video-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: 1rem;
    }
}

@media (max-width: 576px) {
    .super-ace-video-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }

    .super-ace-video-card .video-info {
        padding: 0.75rem;
    }

    .super-ace-video-card .player-avatar,
    .super-ace-video-card .player-avatar-placeholder {
        width: 40px;
        height: 40px;
        font-size: 1rem;
    }

    .super-ace-video-card .player-name {
        font-size: 0.85rem;
    }

    .super-ace-video-card .attempt-details {
        font-size: 0.75rem;
        gap: 0.25rem;
    }
}

@media (max-width: 380px) {
    .super-ace-video-grid {
        grid-template-columns: 1fr;
    }
}

/* Instagram-style Controls */
.instagram-controls {
    position: absolute;
    right: 15px;
    bottom: 80px; /* Position above existing video controls */
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 15;
}

.interaction-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    outline: none;
    padding: 0;
}

.interaction-btn:hover {
    transform: scale(1.1);
    background: rgba(0, 0, 0, 0.8);
}

.interaction-btn:active {
    transform: scale(0.95);
}

.heart-button {
    font-size: 22px;
}

.heart-button.liked {
    color: #ff3040;
    animation: heartBeat 0.3s ease-in-out;
}

.heart-button.liked i::before {
    content: "\f004"; /* Solid heart */
}

@keyframes heartBeat {
    0% {
        transform: scale(1);
    }
    25% {
        transform: scale(1.3);
    }
    50% {
        transform: scale(1.1);
    }
    100% {
        transform: scale(1);
    }
}

.stat-count {
    color: white;
    font-size: 13px;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
    margin-bottom: 8px;
}

.view-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: white;
    margin-top: 12px;
}

.view-stats i {
    font-size: 18px;
    opacity: 0.9;
}

/* Heart Animation for Double Tap */
.heart-animation-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 20;
}

.floating-heart {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 100px;
    color: white;
    animation: floatingHeart 1s ease-out forwards;
    pointer-events: none;
    z-index: 21;
}

@keyframes floatingHeart {
    0% {
        transform: translate(-50%, -50%) scale(0);
        opacity: 0;
    }
    15% {
        transform: translate(-50%, -50%) scale(1.2);
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) scale(1.5);
        opacity: 0;
    }
}

/* Adjust positioning when video is playing */
.super-ace-video-card .video-container.playing .instagram-controls {
    opacity: 1;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .instagram-controls {
        right: 10px;
        bottom: 70px;
    }

    .interaction-btn {
        width: 40px;
        height: 40px;
    }

    .heart-button {
        font-size: 20px;
    }

    .stat-count {
        font-size: 12px;
    }
}

/* Video Management Actions (Edit/Delete) */
.video-management-actions {
    position: absolute;
    bottom: 15px;
    left: 15px;
    display: flex;
    gap: 8px;
    z-index: 25; /* Above other video overlays */
}

.management-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    opacity: 0.9;
    font-size: 14px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.management-btn:hover {
    opacity: 1;
    transform: scale(1.1);
}

.management-btn:active {
    transform: scale(0.95);
}

.management-btn.edit-btn {
    background: var(--theme-info);
    color: white;
}

.management-btn.edit-btn:hover {
    background: var(--theme-info-hover, #0056b3);
    box-shadow: 0 2px 12px rgba(0, 123, 255, 0.4);
}

.management-btn.delete-btn {
    background: var(--theme-danger);
    color: white;
}

.management-btn.delete-btn:hover {
    background: var(--theme-danger-hover, #c82333);
    box-shadow: 0 2px 12px rgba(220, 53, 69, 0.4);
}

/* Ensure buttons don't interfere with existing elements */
.video-management-actions .management-btn {
    position: relative;
    z-index: 26;
}

/* Mobile adjustments for management buttons */
@media (max-width: 768px) {
    .video-management-actions {
        bottom: 12px;
        left: 12px;
        gap: 6px;
    }

    .management-btn {
        width: 32px;
        height: 32px;
        font-size: 12px;
    }
}

/* Dark Mode Adjustments */
[data-bs-theme="dark"] {
    .super-ace-video-card .video-info {
        background: linear-gradient(to bottom,
        var(--theme-surface-1) 0%,
        var(--theme-surface-2) 100%);
        border-top-color: var(--theme-border-color);
    }

    .super-ace-video-card .player-avatar {
        border-color: var(--theme-primary);
    }

    .super-ace-video-card .hole-info {
        background: rgba(0, 123, 255, 0.15);
    }

    .super-ace-video-card .event-link {
        background: rgba(0, 123, 255, 0.1);
    }

    .super-ace-video-card .event-link:hover {
        background: var(--theme-primary);
        color: white;
    }

    /* Dark mode management button adjustments */

    .management-btn.edit-btn {
        background: var(--theme-info);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .management-btn.delete-btn {
        background: var(--theme-danger);
        border: 1px solid rgba(255, 255, 255, 0.1);
    }
}