/* Portfolio Responsive Fixes - Pure CSS without @apply */

/* Container and Layout */
.container {
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    padding: 0 1rem;
    box-sizing: border-box;
    position: relative;
}

/* Ensure all elements stay within viewport */
body, html {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    position: relative;
    -webkit-overflow-scrolling: touch;
}

/* Fix for viewport units on mobile */
@supports (-webkit-touch-callout: none) {
    html, body {
        height: -webkit-fill-available;
    }
}

/* Prevent horizontal scroll on all elements */
body * {
    max-width: 100%;
}

/* Fix for images and media */
img, video, iframe, object, embed, svg, canvas, figure, picture {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Ensure tables are responsive */
table {
    width: 100% !important;
    max-width: 100% !important;
    border-collapse: collapse;
    table-layout: fixed;
}

/* Fix for pre and code blocks */
pre, code, kbd, samp {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
    max-width: 100%;
    display: block;
}

/* Fix for form elements */
input, textarea, select, button {
    max-width: 100%;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

@media (min-width: 640px) {
    .container {
        padding: 0 1.5rem;
    }
}

@media (min-width: 1024px) {
    .container {
        padding: 0 2rem;
    }
}

/* Enhanced Filter Buttons - Mobile First */
.portfolio-filters {
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.filter-btn {
    padding: 0.625rem 0.75rem;
    background-color: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.3s ease;
    font-size: 0.875rem;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex: 0 1 auto;
    min-width: 100px;
    max-width: 140px;
    text-decoration: none;
    cursor: pointer;
}

.filter-btn:hover {
    border-color: #0F9D58;
    color: #0F9D58;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    transform: translateY(-1px);
}

.filter-btn.active {
    background-color: #0F9D58;
    color: white;
    border-color: #0F9D58;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    transform: scale(1.02);
}

/* Mobile Filter Layout */
@media (max-width: 640px) {
    .portfolio-filters {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        justify-content: center;
        margin: 0 auto;
        width: 100%;
    }
    
    .filter-btn {
        padding: 0.5rem 0.625rem;
        font-size: 0.75rem;
        min-width: auto;
        max-width: none;
        flex: 0 1 auto;
        width: auto;
        min-height: 36px;
    }
    
    .filter-btn i {
        font-size: 0.875rem;
        margin-right: 0.25rem;
    }
}

/* Extra small devices - phones in portrait mode */
@media (max-width: 480px) {
    .portfolio-filters {
        gap: 0.375rem;
        padding: 0 0.5rem;
    }
    
    .filter-btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.7rem;
        min-height: 32px;
        border-radius: 0.375rem;
    }
    
    .filter-btn i {
        font-size: 0.75rem;
        margin-right: 0.125rem;
    }
    
    /* Make sure buttons wrap nicely on very small screens */
    .portfolio-filters .filter-btn {
        flex: 0 0 auto;
        width: auto;
        max-width: calc(50% - 0.2rem);
    }
}

/* Small tablets and large phones in landscape */
@media (min-width: 481px) and (max-width: 640px) {
    .filter-btn {
        padding: 0.5rem 0.625rem;
        font-size: 0.8rem;
        min-height: 38px;
    }
    
    .filter-btn i {
        font-size: 0.875rem;
    }
}

/* Large tablets */
@media (min-width: 769px) and (max-width: 1024px) {
    .filter-btn {
        min-width: 95px;
        max-width: 130px;
        padding: 0.625rem 0.75rem;
    }
    
    .portfolio-filters {
        gap: 0.5rem;
    }
}

/* Fixed Filter Section Styles */
/* Filter section styles */
section.py-8 {
    background-color: white;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    border-bottom: 1px solid #e5e7eb;
    backdrop-filter: blur(8px);
    padding: 1rem 0;
}

/* Tablet layout adjustments */
@media (max-width: 768px) and (min-width: 641px) {
    .filter-btn {
        min-width: 90px;
        padding: 0.5rem 0.75rem;
        font-size: 0.8rem;
    }
    
    .portfolio-filters {
        gap: 0.5rem;
    }
}

/* Adjust portfolio grid top margin for fixed filter */
.portfolio-grid-section {
    margin-top: 8rem; /* Reduced space to account for fixed filter section */
}

/* Responsive adjustments for fixed filter */
@media (max-width: 768px) {
    .fixed-filter-section {
        top: 4rem; /* Smaller header on mobile */
        padding: 1rem 0; /* Reduce padding on mobile */
    }
    
    .portfolio-grid-section {
        margin-top: 10rem; /* Smaller margin on mobile */
    }
}

@media (max-width: 640px) {
    .fixed-filter-section {
        padding: 1rem 0; /* Even less padding on small screens */
    }
    
    .portfolio-grid-section {
        margin-top: 15rem; /* Adjusted for smaller padding */
    }
}

/* Ensure fixed filter doesn't overlap with content */
body {
    scroll-padding-top: 15rem;
}

/* Fixed filter animation on scroll */
/* These styles were removed as the fixed filter section is no longer needed */

/* Enhanced View Toggle */
.view-toggle-container {
    display: flex;
    justify-content: center;
    margin-top: 1.5rem;
}

.view-toggle-wrapper {
    background-color: #f3f4f6;
    padding: 0.25rem;
    border-radius: 0.75rem;
    display: flex;
    position: relative;
}

.view-toggle-btn {
    padding: 0.75rem 1.25rem;
    color: #6b7280;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    min-height: 44px;
    min-width: 80px;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
}

.view-toggle-btn.active {
    background-color: white;
    color: #0F9D58;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
}

.view-toggle-btn:hover {
    color: #0F9D58;
}

.view-toggle-btn i {
    font-size: 1.125rem;
}

@media (max-width: 640px) {
    .view-toggle-btn {
        padding: 0.75rem;
        min-width: 60px;
    }
    
    .view-toggle-btn span {
        display: none;
    }
}

/* Portfolio Cards - Mobile First Responsive */
.portfolio-card {
    background-color: white;
    border-radius: 1rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid transparent;
    width: 100%;
}

.portfolio-card:hover {
    border-color: #0F9D58;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(-4px);
}

.portfolio-card-image {
    position: relative;
    overflow: hidden;
    height: 180px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.portfolio-card-overlay {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.portfolio-card:hover .portfolio-card-overlay {
    background-color: rgba(0, 0, 0, 0.7);
}

.portfolio-card-actions {
    opacity: 0;
    transition: opacity 0.3s ease;
    display: flex;
    gap: 0.75rem;
}

.portfolio-card:hover .portfolio-card-actions {
    opacity: 1;
}

.portfolio-action-btn {
    width: 3rem;
    height: 3rem;
    background-color: white;
    color: #374151;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
    border: none;
    cursor: pointer;
}

.portfolio-action-btn:hover {
    background-color: #0F9D58;
    color: white;
    transform: scale(1.1);
}

.portfolio-card-content {
    padding: 1.5rem;
}

.portfolio-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 0.5rem;
    transition: color 0.3s ease;
}

.portfolio-card-title:hover {
    color: #0F9D58;
}

.portfolio-card-description {
    color: #6b7280;
    font-size: 0.875rem;    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.portfolio-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.portfolio-tag {
    padding: 0.25rem 0.75rem;
    background-color: #f3f4f6;
    color: #374151;
    font-size: 0.75rem;
    border-radius: 9999px;
    font-weight: 500;
}

.portfolio-tag.primary {
    background-color: rgba(15, 157, 88, 0.1);
    color: #0F9D58;
}

.portfolio-card-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Desktop hover effects */
@media (min-width: 768px) {
    .portfolio-card:hover {
        transform: translateY(-4px) scale(1.02);
    }
    
    .portfolio-card-image {
        height: 220px;
    }
}

/* Portfolio Grid Responsive */
#portfolioGrid {
    display: grid;
    gap: 2rem;
    transition: all 0.5s ease;
}

/* Mobile: 1 column */
@media (max-width: 767px) {
    #portfolioGrid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Tablet: 2 columns */
@media (min-width: 768px) and (max-width: 1023px) {
    #portfolioGrid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Desktop: 3 columns */
@media (min-width: 1024px) {
    #portfolioGrid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* List View Styles */
.portfolio-grid-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.portfolio-card-list {
    display: flex;
    background: white;
    border-radius: 0.75rem;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
}

.portfolio-card-list:hover {
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    transform: translateY(-2px);
}

.portfolio-card-list .portfolio-card-image {
    width: 33.333333%;
    flex-shrink: 0;
    height: 200px;
}

.portfolio-card-list .portfolio-card-content {
    flex: 1;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Mobile List View */
@media (max-width: 640px) {
    .portfolio-card-list {
        flex-direction: column;
    }
    
    .portfolio-card-list .portfolio-card-image {
        width: 100%;
        height: 12rem;
    }
    
    .portfolio-card-list .portfolio-card-content {
        padding: 1rem;
    }
}

/* Portfolio Stats Responsive */
.portfolio-stats {
    display: grid;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

@media (max-width: 767px) {
    .portfolio-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}

@media (min-width: 768px) {
    .portfolio-stats {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Search Bar Responsive */
#portfolioSearch {
    width: 100%;
    padding: 0.625rem 0.75rem 0.625rem 2.5rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    transition: all 0.3s ease;
    font-size: 0.875rem;
}

#portfolioSearch:focus {
    outline: none;
    border-color: #0F9D58;
    box-shadow: 0 0 0 3px rgba(15, 157, 88, 0.1);
}

@media (max-width: 640px) {
    #portfolioSearch {
        padding: 0.625rem 0.75rem 0.625rem 2.25rem;
        font-size: 0.8rem;
    }
}

/* Filter Info and Sort Controls */
#portfolioInfo {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    flex-wrap: wrap;
    gap: 1rem;
}

@media (max-width: 640px) {
    #portfolioInfo {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }
    
    #portfolioInfo .flex {
        justify-content: center;
    }
}

/* Sort Select */
#sortSelect {
    padding: 0.5rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    background-color: white;
}

#sortSelect:focus {
    outline: none;
    border-color: #0F9D58;
    box-shadow: 0 0 0 2px rgba(15, 157, 88, 0.1);
}

/* Loading and No Results States */
#loadingSpinner,
#noResults {
    text-align: center;
    padding: 4rem 1rem;
}

@media (max-width: 640px) {
    #loadingSpinner,
    #noResults {
        padding: 2rem 1rem;
    }
}

/* Load More Button */
#loadMoreBtn {
    background-color: #0F9D58;
    color: white;
    padding: 0.75rem 2rem;
    border-radius: 0.5rem;
    border: none;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

#loadMoreBtn:hover {
    background-color: #0d8049;
    transform: translateY(-2px);
    box-shadow: 0 10px 25px rgba(15, 157, 88, 0.3);
}

/* Modal Responsive */
#portfolioModal {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 60;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

#portfolioModal .bg-white {
    background-color: white;
    border-radius: 0.5rem;
    max-width: 56rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

@media (max-width: 640px) {
    #portfolioModal {
        padding: 0.5rem;
    }
    
    #portfolioModal .p-6 {
        padding: 1rem;
    }
}
