/* ==========================================
   PORTFOLIO PAGE
   ========================================== */

.portfolio-main {
    min-height: 100vh;
    padding: var(--spacing-xl) 0;
}

.portfolio-header {
    margin-bottom: var(--spacing-xl);
}

.portfolio-header h1 {
    font-size: 2.5rem;
    margin-bottom: var(--spacing-lg);
    color: #1a56db;
    -webkit-text-fill-color: #1a56db;
}

/* ==================== TABS ==================== */
.tabs {
    display: flex;
    gap: var(--spacing-md);
    border-bottom: 2px solid #e5e7eb;
}

.tab-btn {
    padding: var(--spacing-md) 0;
    background: none;
    border: none;
    color: #6b7280;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition);
    border-bottom: 3px solid transparent;
    position: relative;
    bottom: -2px;
}

.tab-btn:hover {
    color: var(--primary);
}

.tab-btn.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ==================== FILTER ==================== */
.filter-section {
    display: flex;
    align-items: center;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.filter-section label {
    color: #6b7280;
    font-weight: 500;
}

.filter-dropdown {
    padding: 0.5rem 1rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    color: #111827;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
}

.filter-dropdown:hover,
.filter-dropdown:focus {
    border-color: var(--primary);
    outline: none;
}

/* ==================== MASONRY GRID ==================== */
.masonry-grid {
    column-count: 2;
    column-gap: 12px;
    padding: 0 var(--spacing-md);
}

@media (min-width: 768px) {
    .masonry-grid {
        column-count: 3;
    }
}

@media (min-width: 1024px) {
    .masonry-grid {
        column-count: 4;
        column-gap: 16px;
    }
}

/* ==================== GALLERY ITEMS ==================== */
.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    cursor: pointer;
    width: 100%;
    margin-bottom: 12px;
    break-inside: avoid;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    aspect-ratio: 1 / 1;
}

.gallery-item:hover {
    border-color: var(--primary);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.gallery-item-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

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

.gallery-item-label {
    color: var(--primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ==================== TAB CONTENT ==================== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

/* ==================== MODAL ==================== */
/* Modal styles are inherited from style.css (.portfolio-modal) */

.modal-body {
    padding: var(--spacing-xl);
}

.modal-section {
    display: none;
}

.modal-section.active {
    display: block;
}

/* ==================== COMPARISON SLIDER ==================== */
.comparison-slider {
    position: relative;
    width: 100%;
    max-width: 800px;
    margin: 0 auto var(--spacing-xl);
    overflow: hidden;
    border-radius: 8px;
}

.comparison-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.before-image {
    clip-path: inset(0 0 0 0);
}

.before-image.hidden {
    display: none;
}

.comparison-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Base container for slider */
.comparison-slider {
    background: #e5e7eb;
}

.comparison-slider::before {
    content: '';
    position: absolute;
    width: 100%;
    padding-bottom: 100%; /* 1:1 aspect ratio */
}

.comparison-slider img {
    display: block;
}

/* Slider handle */
.slider-handle {
    position: absolute;
    top: 0;
    left: 50%;
    width: 100%;
    height: 100%;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    cursor: col-resize;
    z-index: 5;
    margin: 0;
    padding: 0;
    border: none;
}

.slider-handle::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 4px;
    height: 100%;
    background: var(--primary);
    cursor: col-resize;
    box-shadow: 0 0 10px rgba(26, 86, 219, 0.5);
}

.slider-handle::-moz-range-thumb {
    width: 4px;
    height: 100%;
    background: var(--primary);
    cursor: col-resize;
    border: none;
    box-shadow: 0 0 10px rgba(26, 86, 219, 0.5);
}

/* Slider labels */
.slider-labels {
    position: absolute;
    bottom: var(--spacing-md);
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: var(--spacing-md);
    z-index: 6;
}

.toggle-btn {
    padding: 0.5rem 1rem;
    background: #ffffff;
    color: #111827;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.85rem;
    font-weight: 500;
}

.toggle-btn:hover {
    background: #f3f4f6;
    border-color: var(--primary);
}

.toggle-btn.active {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* ==================== VIDEO CONTAINER ==================== */
.video-container {
    width: 100%;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: var(--spacing-xl);
}

.video-container video {
    width: 100%;
    height: auto;
    display: block;
}

/* ==================== MODAL ACTIONS ==================== */
.modal-actions {
    display: flex;
    justify-content: center;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.action-btn {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    padding: 0.75rem 1.5rem;
    background: #f3f4f6;
    color: #111827;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    cursor: pointer;
    transition: all var(--transition);
    font-weight: 500;
}

.action-btn:hover {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .masonry-grid {
        grid-template-columns: 1fr;
    }

    .modal-body {
        padding: var(--spacing-lg);
    }

    .slider-labels {
        bottom: var(--spacing-sm);
        gap: var(--spacing-sm);
    }

    .toggle-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.75rem;
    }
}

/* ==================== MODAL OVERRIDE FIX ==================== */
/* Ensure modal never overflows viewport */
.portfolio-modal .portfolio-modal-content {
    max-width: 90vw !important;
    max-height: 90vh !important;
}

.portfolio-modal .portfolio-modal-image,
.portfolio-modal .portfolio-modal-video {
    max-width: 85vw !important;
    max-height: 85vh !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain;
}

/* Responsive for small screens */
@media (max-width: 768px) {
    .portfolio-modal {
        padding: 12px;
    }
    
    .portfolio-modal .portfolio-modal-image,
    .portfolio-modal .portfolio-modal-video {
        max-width: 92vw !important;
        max-height: 80vh !important;
    }
    
    .portfolio-modal-close {
        top: 12px;
        right: 12px;
        width: 36px;
        height: 36px;
    }
}
