/* Super Ace Attempts Gallery Styles */

/* Main Container */
.gallery-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
}

/* Player Search Styles */
.player-filter {
    position: relative;
}

.player-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.player-search-input {
    padding-right: 35px;
    background: var(--theme-bg-primary);
    color: var(--theme-text-primary);
    border: 1px solid var(--theme-border-color);
}

.clear-player-filter {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: none;
    color: var(--theme-text-secondary);
    cursor: pointer;
    padding: 5px;
    z-index: 2;
}

.clear-player-filter:hover {
    color: var(--theme-danger);
}

.player-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--theme-bg-primary);
    border: 1px solid var(--theme-border-color);
    border-top: none;
    border-radius: 0 0 8px 8px;
    box-shadow: var(--theme-shadow);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.search-result-item {
    padding: 10px;
    cursor: pointer;
    border-bottom: 1px solid var(--theme-border-color);
    transition: background-color 0.2s;
}

.search-result-item:hover {
    background: var(--theme-bg-secondary);
}

.search-result-item:last-child {
    border-bottom: none;
}

.player-result {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-avatar-small {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    object-fit: cover;
}

.player-avatar-placeholder-small {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: var(--theme-accent);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

.player-info {
    flex: 1;
}

.player-info .player-name {
    font-weight: 600;
    color: var(--theme-text-primary);
}

.player-info .player-pdga {
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
}

.no-results,
.search-error {
    padding: 15px;
    text-align: center;
    color: var(--theme-text-secondary);
}

.search-error {
    color: var(--theme-danger);
}

/* Highlight Animation for Newly Uploaded Video */
@keyframes highlightPulse {
    0% {
        box-shadow: 0 0 0 0 var(--theme-success);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 20px 10px var(--theme-success);
        transform: scale(1.02);
    }
    100% {
        box-shadow: 0 0 0 0 var(--theme-success);
        transform: scale(1);
    }
}

.video-item.highlight-animation {
    animation: highlightPulse 1s ease-in-out 3;
    border: 2px solid var(--theme-success);
    border-radius: 1rem;
    overflow: hidden;
    position: relative;
}

.video-item.highlight-animation::before {
    content: "Your Upload!";
    position: absolute;
    top: 10px;
    left: 10px;
    background: var(--theme-success);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    z-index: 10;
    animation: fadeOut 3s forwards;
}

@keyframes fadeOut {
    0%, 70% {
        opacity: 1;
    }
    100% {
        opacity: 0;
    }
}

/* Header Section */
.gallery-header {
    margin-bottom: 3rem;
}

.gallery-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--theme-text-primary);
    margin-bottom: 0.5rem;
    display: flex;
    align-items: center;
}

.gallery-title i {
    color: var(--theme-info);
}

.gallery-subtitle {
    font-size: 1.1rem;
    color: var(--theme-text-secondary);
    margin-bottom: 1.5rem;
}

.gallery-controls {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 1rem;
}

.filter-row {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
}

.filter-item {
    display: flex;
    flex-direction: column;
}

.filter-item .form-label {
    font-weight: 500;
    color: var(--theme-text-secondary);
    margin-bottom: 0.25rem;
    font-size: 0.875rem;
}

.filter-item .form-select {
    background-color: var(--theme-surface-1);
    border-color: var(--theme-border-color);
    color: var(--theme-text-primary);
    font-size: 0.875rem;
    padding: 0.375rem 0.75rem;
}

.filter-item .form-select:focus {
    background-color: var(--theme-surface-1);
    border-color: var(--theme-info);
    box-shadow: 0 0 0 0.2rem rgba(59, 130, 246, 0.25);
    color: var(--theme-text-primary);
}

@media (min-width: 768px) {
    .filter-row {
        flex-direction: row;
        gap: 1rem;
    }
    
    .filter-item {
        flex: 1;
        min-width: 0;
    }
}

.gallery-stats {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--theme-border-color);
}

.stat-item {
    color: var(--theme-text-secondary);
    font-size: 0.95rem;
    display: flex;
    align-items: center;
}

.stat-item i {
    color: var(--theme-info);
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    background: var(--theme-surface-1);
    border-radius: 1rem;
    box-shadow: var(--theme-shadow);
}

.empty-icon {
    font-size: 4rem;
    color: var(--theme-text-muted);
    margin-bottom: 1.5rem;
}

.empty-state h3 {
    color: var(--theme-text-primary);
    font-weight: 600;
    margin-bottom: 1rem;
}

.empty-state p {
    color: var(--theme-text-secondary);
    margin-bottom: 2rem;
}

/* Instagram-style Gallery Grid */
.video-gallery {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 3rem;
}

/* Gallery item wrapper for action buttons */
.gallery-item-wrapper {
    position: relative;
}

.gallery-item-wrapper .video-actions {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 200;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.gallery-item-wrapper:hover .video-actions {
    opacity: 1;
}

.gallery-item-wrapper .action-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.8);
    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;
}

.gallery-item-wrapper .action-btn:hover {
    background: rgba(0, 0, 0, 0.9);
    transform: scale(1.1);
}

.gallery-item-wrapper .action-btn i {
    font-size: 14px;
}

.video-item {
    background: var(--theme-surface-1);
    border-radius: 0.75rem;
    overflow: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--theme-shadow-sm);
    cursor: pointer;
}

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

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

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

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

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

.video-item:hover .thumbnail-image {
    transform: scale(1.05);
}

.placeholder-thumbnail {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, var(--theme-surface-2) 0%, var(--theme-surface-3) 100%);
}

.placeholder-thumbnail i {
    font-size: 3rem;
    color: var(--theme-text-muted);
}

/* Video Overlay */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.video-item:hover .video-overlay {
    opacity: 1;
}

.play-button {
    background: rgba(255, 255, 255, 0.9);
    color: var(--theme-text-primary);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transform: scale(0.8);
    transition: all 0.3s ease;
}

.video-item:hover .play-button {
    transform: scale(1);
    background: rgba(255, 255, 255, 1);
}

.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;
}

.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;
}

/* Video Controls Overlay */
.video-controls-overlay {
    position: absolute;
    bottom: 10px;
    right: 10px;
    display: flex;
    gap: 8px;
    z-index: 10;
}

.video-control-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    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;
}

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

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

/* Video Info */
.video-info {
    padding: 1rem;
}

.player-info {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
}

.player-avatar-placeholder {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--theme-info);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    flex-shrink: 0;
}

.player-details {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-weight: 600;
    color: var(--theme-text-primary);
    font-size: 0.95rem;
    margin-bottom: 0.25rem;
}

.attempt-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: var(--theme-text-secondary);
    margin-bottom: 0.25rem;
}

.event-link {
    color: var(--theme-primary);
    text-decoration: none;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    transition: color 0.2s ease;
}

.event-link:hover {
    color: var(--theme-primary-hover);
    text-decoration: underline;
}

.event-link i {
    font-size: 0.75rem;
}

.course-name {
    font-weight: 500;
}

.hole-info,
.par-info {
    color: var(--theme-text-muted);
}

.upload-date {
    font-size: 0.8rem;
    color: var(--theme-text-muted);
}

.video-description {
    font-size: 0.9rem;
    color: var(--theme-text-secondary);
    line-height: 1.4;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* Loading Indicator */
.loading-indicator {
    text-align: center;
    padding: 2rem;
    color: var(--theme-text-secondary);
}

.loading-spinner {
    margin-bottom: 1rem;
}

.scroll-trigger {
    height: 1px;
    margin-bottom: 2rem;
}

/* Video Modal */
.modal-portrait {
    max-width: 600px; /* Optimized for portrait video */
}

.video-modal-content {
    background: var(--theme-surface-1);
    border: 1px solid var(--theme-border-color);
}

.video-modal-content .modal-header {
    background: var(--theme-surface-2);
    border-bottom: 1px solid var(--theme-border-color);
}

.video-modal-content .modal-title {
    color: var(--theme-text-primary);
}

.video-player-container {
    position: relative;
    background: #000;
    aspect-ratio: 9/16; /* Portrait orientation for mobile videos */
    max-height: 80vh;
    margin: 0 auto;
}

.modal-video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.video-modal-info {
    padding: 1.5rem;
    background: var(--theme-surface-1);
}

.modal-player-info {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
}

.modal-avatar-container {
    position: relative;
    flex-shrink: 0;
}

.modal-player-avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    object-fit: cover;
}

.modal-avatar-placeholder {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--theme-info);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1.2rem;
}

.modal-player-details {
    flex: 1;
}

.modal-player-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--theme-text-primary);
    margin-bottom: 0.5rem;
}

.modal-attempt-details {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    color: var(--theme-text-secondary);
    margin-bottom: 0.25rem;
}

.modal-event-link {
    margin-bottom: 0.5rem;
}

.modal-event-link .event-link {
    font-size: 0.9rem;
}

.modal-upload-date {
    color: var(--theme-text-muted);
    font-size: 0.9rem;
}

.modal-verified-badge {
    background: var(--theme-success);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.85rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    align-self: flex-start;
}

.modal-description {
    background: var(--theme-surface-2);
    padding: 1rem;
    border-radius: 0.5rem;
    color: var(--theme-text-primary);
    line-height: 1.5;
    border: 1px solid var(--theme-border-color);
}

/* Loading Skeleton Animation */
@keyframes skeleton-loading {
    0% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
    100% {
        opacity: 1;
    }
}

.video-item.loading {
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.video-item.loading .video-thumbnail {
    background: linear-gradient(90deg, var(--theme-surface-2) 25%, var(--theme-surface-3) 50%, var(--theme-surface-2) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Responsive Design */

/* Tablet Layout - 2 columns */
@media (max-width: 992px) {
    .video-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .gallery-title {
        font-size: 2rem;
    }
    
    .gallery-controls {
        justify-content: flex-start;
        margin-top: 1rem;
    }
    
    .gallery-stats {
        justify-content: flex-start;
    }
}

/* Mobile Layout - 1 column */
@media (max-width: 576px) {
    .gallery-container {
        padding: 1rem 0.75rem;
    }
    
    .gallery-header {
        margin-bottom: 2rem;
    }
    
    .video-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .gallery-title {
        font-size: 1.75rem;
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .gallery-subtitle {
        font-size: 1rem;
    }
    
    .gallery-stats {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .video-item {
        border-radius: 0.5rem;
    }
    
    .video-info {
        padding: 0.75rem;
    }
    
    .player-info {
        gap: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    .attempt-details {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    /* Modal adjustments for mobile */
    .modal-xl {
        max-width: 95vw;
    }
    
    .video-modal-info {
        padding: 1rem;
    }
    
    .modal-player-info {
        gap: 0.75rem;
    }
    
    .modal-player-avatar,
    .modal-avatar-placeholder {
        width: 40px;
        height: 40px;
    }
    
    .modal-player-name {
        font-size: 1rem;
    }
    
    .modal-attempt-details {
        flex-direction: column;
        gap: 0.25rem;
    }
}

/* Very small screens */
@media (max-width: 380px) {
    .gallery-container {
        padding: 0.75rem 0.5rem;
    }
    
    .gallery-title {
        font-size: 1.5rem;
    }
    
    .play-button {
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
    
    .video-info {
        padding: 0.5rem;
    }
    
    .player-avatar,
    .player-avatar-placeholder {
        width: 35px;
        height: 35px;
    }
    
    .player-name {
        font-size: 0.9rem;
    }
}

/* Print Styles */
@media print {
    .gallery-controls,
    .video-overlay,
    .loading-indicator {
        display: none !important;
    }
    
    .video-gallery {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
    
    .video-item {
        break-inside: avoid;
        box-shadow: none;
        border: 1px solid #ccc;
    }
    
    /* Keep portrait aspect ratio in print */
}

/* Action Buttons (Delete/Edit) */
.video-actions {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 15;
}

.action-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;
}

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

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

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

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

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

/* Attribution Modal Styles */
.player-options-list {
    max-height: 400px;
    overflow-y: auto;
}

.player-group {
    border-bottom: 1px solid var(--theme-border-color);
    padding-bottom: 1rem;
}

.player-group:last-child {
    border-bottom: none;
}

.player-group h6 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.5rem;
}

.player-option {
    cursor: pointer;
    transition: background-color 0.2s ease;
}

.player-option:hover {
    background-color: var(--theme-surface-2);
}

.player-option input[type="radio"] {
    cursor: pointer;
}

.player-avatar-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    object-fit: cover;
}

.player-avatar-placeholder-small {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--theme-info);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
}

/* Fade out animation for deleted items */
@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}