/* Portfolio Page Specific Styles */

/* Portfolio Hero */
.portfolio-hero {
    padding: 8rem 0 4rem;
    background: var(--bg-secondary);
    text-align: center;
    position: relative;
    overflow: hidden;
}

.portfolio-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at 30% 20%, rgba(99, 102, 241, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(139, 92, 246, 0.1) 0%, transparent 50%);
}

.portfolio-hero-content {
    position: relative;
    z-index: 1;
}

.portfolio-hero h1 {
    margin-bottom: 1.5rem;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.portfolio-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.portfolio-stats .stat {
    padding: 2rem 1rem;
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    transition: all var(--transition-smooth);
}

.portfolio-stats .stat:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Portfolio Filter */
.portfolio-filter {
    background: var(--bg-primary);
    padding: 2rem 0;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 4rem;
    z-index: 100;
    backdrop-filter: blur(20px);
}

.portfolio-filter .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-buttons {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 2rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    font-size: 0.875rem;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.view-toggle {
    display: flex;
    gap: 0.5rem;
}

.view-btn {
    width: 2.5rem;
    height: 2.5rem;
    border: 1px solid var(--border-color);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 0.5rem;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.view-btn:hover,
.view-btn.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

/* Portfolio Gallery */
.portfolio-gallery {
    padding: 4rem 0;
    background: var(--bg-primary);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.gallery-grid.masonry {
    column-count: 3;
    column-gap: 2rem;
    grid-template-columns: none;
}

.gallery-grid.masonry .portfolio-item {
    break-inside: avoid;
    margin-bottom: 2rem;
    display: inline-block;
    width: 100%;
}

.portfolio-item {
    position: relative;
    border-radius: 1rem;
    overflow: hidden;
    background: var(--bg-secondary);
    transition: all var(--transition-smooth);
    opacity: 0;
    transform: translateY(30px);
}

.portfolio-item.visible {
    opacity: 1;
    transform: translateY(0);
}

.portfolio-item.hidden {
    display: none;
}

.portfolio-item:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-xl);
}

.portfolio-image {
    position: relative;
    width: 100%;
    overflow: hidden;
}

.portfolio-image img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    transition: transform var(--transition-smooth);
}

.gallery-grid.masonry .portfolio-image img {
    height: auto;
    min-height: 200px;
}

.portfolio-item:hover .portfolio-image img {
    transform: scale(1.1);
}

/* Video Thumbnail */
.video-thumbnail {
    position: relative;
}

.play-button {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-color);
    border: none;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.play-button:hover {
    background: var(--primary-color);
    color: white;
    transform: translate(-50%, -50%) scale(1.1);
}

.play-button i {
    margin-left: 3px; /* Slight offset to center the play icon */
}

/* Video thumbnail container */
.video-thumbnail {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
}

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

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

.video-thumbnail:hover .play-button {
    background: var(--primary-color);
    color: white;
}

/* Video Modal Styles */
.video-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.video-modal-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

.video-modal-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: all 0.3s ease;
    color: #333;
}

.video-modal-close:hover {
    background: white;
    transform: scale(1.1);
}

.video-modal video {
    width: 100%;
    height: auto;
    max-height: 90vh;
    display: block;
}

/* Portfolio Overlay */
.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.6) 50%,
        transparent 100%
    );
    display: flex;
    align-items: flex-end;
    padding: 2rem;
    color: white;
    opacity: 0;
    transition: opacity var(--transition-smooth);
}

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

.portfolio-info {
    width: 100%;
}

.portfolio-info h3 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: white;
}

.portfolio-info p {
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 1rem;
    font-size: 0.875rem;
}

.portfolio-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.tag {
    padding: 0.25rem 0.75rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border-radius: 2rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: white;
}

.portfolio-actions {
    display: flex;
    gap: 0.5rem;
}

.action-btn {
    width: 2.5rem;
    height: 2.5rem;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.action-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: scale(1.1);
}

/* Load More */
.load-more {
    text-align: center;
}

/* Lightbox */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
}

.lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    background: var(--bg-primary);
    border-radius: 1rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    transform: scale(0.8);
    transition: transform var(--transition-smooth);
}

.lightbox.active .lightbox-content {
    transform: scale(1);
}

.lightbox-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 3rem;
    height: 3rem;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    z-index: 3;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-close:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.lightbox-image {
    position: relative;
    overflow: auto; /* Enable scrolling */
    flex: 1;
    display: flex;
    align-items: flex-start; /* Align to top for better scroll behavior */
    justify-content: center;
    min-height: 0; /* Important for flexbox */
    max-height: 90vh; /* Ensure container doesn't exceed viewport */
    -webkit-overflow-scrolling: touch; /* Smooth momentum scrolling on iOS */
    scroll-behavior: smooth;
}

.lightbox-image img {
    max-width: none; /* Remove width constraint to allow full-size images */
    max-height: none; /* Remove height constraint to allow full-size images */
    width: auto;
    height: auto;
    min-width: 100%; /* Ensure image takes at least full container width */
    object-fit: contain;
    display: block;
    cursor: grab; /* Indicate that image can be dragged/scrolled */
}

.lightbox-image img:active {
    cursor: grabbing;
}

/* Custom scrollbar for better UX */
.lightbox-image::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

.lightbox-image::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
}

.lightbox-image::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 6px;
    opacity: 0.7;
}

.lightbox-image::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
    opacity: 1;
}

.lightbox-info {
    width: 300px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border-color);
}

.lightbox-info h3 {
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.lightbox-info p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.lightbox-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.lightbox-tags .tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.lightbox-navigation {
    position: absolute;
    top: 50%;
    left: 1rem;
    right: 1rem;
    display: flex;
    justify-content: space-between;
    pointer-events: none;
}

.nav-btn {
    width: 3rem;
    height: 3rem;
    background: rgba(0, 0, 0, 0.7);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.nav-btn:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

/* Project Modal Styles */
.project-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
}

.project-modal .modal-content {
    background: var(--bg-primary);
    border-radius: 20px;
    max-width: 800px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.project-modal .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: var(--accent-color);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    transition: all 0.3s ease;
}

.project-modal .modal-close:hover {
    background: var(--primary-color);
    transform: scale(1.1);
}

.project-details {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    padding: 30px;
}

.project-details .project-image {
    border-radius: 12px;
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: 600;
}

.project-info h2 {
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 2rem;
}

.project-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.6;
    margin-bottom: 25px;
}

.project-meta {
    margin-bottom: 25px;
}

.meta-item {
    margin-bottom: 10px;
    color: var(--text-secondary);
}

.meta-item strong {
    color: var(--text-primary);
    margin-right: 8px;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.project-tags .tag {
    background: var(--gradient-primary);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

@media (max-width: 768px) {
    .project-details {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 20px;
    }
    
    .project-info h2 {
        font-size: 1.5rem;
    }
}

/* Enhanced portfolio item styles */
.portfolio-item .portfolio-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.portfolio-btn {
    background: rgba(255, 255, 255, 0.9);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--primary-color);
}

.portfolio-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.1);
}

/* Responsive Design */
@media (max-width: 992px) {
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
        gap: 1.5rem;
    }
    
    .gallery-grid.masonry {
        column-count: 2;
    }
    
    .portfolio-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 1rem;
    }
    
    .lightbox-content {
        flex-direction: column;
        max-width: 95vw;
        max-height: 95vh;
    }
    
    .lightbox-info {
        order: -1;
        width: 100%;
        max-height: 200px;
        overflow-y: auto;
        border-left: none;
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem;
    }
    
    .lightbox-image {
        flex: 1;
        min-height: 300px;
        max-height: 60vh; /* Limit height on mobile to ensure scrolling works */
        overflow: auto; /* Ensure scrolling is enabled on mobile */
    }
    
    .lightbox-image img {
        min-width: 100%; /* Ensure image fills container width on mobile */
        width: auto;
        height: auto;
    }
}


@media (max-width: 768px) {
    .portfolio-hero {
        padding: 6rem 0 3rem;
    }
    
    .portfolio-filter .container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-buttons {
        justify-content: center;
    }
    
    .view-toggle {
        justify-content: center;
    }
    
    .gallery-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
        gap: 1rem;
    }
    
    .gallery-grid.masonry {
        column-count: 1;
    }
    
    .portfolio-stats {
        grid-template-columns: 1fr;
        gap: 1rem;
        max-width: 300px;
    }
    
    .portfolio-overlay {
        padding: 1.5rem;
    }
    
    .lightbox-content {
        margin: 1rem;
        max-width: calc(100vw - 2rem);
        max-height: calc(100vh - 2rem);
    }
}

@media (max-width: 480px) {
    .filter-buttons {
        gap: 0.5rem;
    }
    
    .filter-btn {
        padding: 0.5rem 1rem;
        font-size: 0.75rem;
    }
    
    .portfolio-image img {
        height: 250px;
    }
    
    .portfolio-overlay {
        padding: 1rem;
    }
    
    .portfolio-info h3 {
        font-size: 1rem;
    }
    
    .action-btn {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }
}

/* Scroll indicator for large images in lightbox */
.scroll-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    z-index: 10;
    opacity: 1;
    transition: opacity 0.5s ease;
    pointer-events: none;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.scroll-indicator i {
    animation: bounceUp 2s infinite;
}

@keyframes bounceUp {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-5px);
    }
    60% {
        transform: translateY(-3px);
    }
}

/* Hide scroll indicator on very small screens */
@media (max-width: 480px) {
    .scroll-indicator {
        font-size: 0.8rem;
        padding: 0.5rem 1rem;
    }
}

/* Animation Classes */
.fade-in {
    animation: fadeIn 0.6s ease-out;
}

.slide-in-up {
    animation: slideInUp 0.6s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* Loading Animation */
.loading-placeholder {
    background: var(--bg-secondary);
    border-radius: 1rem;
    height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}

.loading-placeholder::after {
    content: '';
    width: 3rem;
    height: 3rem;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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