/* ==========================================================================
   PORTFOLIO SECTION - UPDATED & ENHANCED
   ========================================================================== */

.portfolio {
    background: linear-gradient(135deg, #f5f7ff 0%, #ffffff 100%);
    padding: clamp(70px, 8vw, 100px) 0;
}

/* Portfolio Filters */
.portfolio-filters {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: clamp(8px, 1vw, 10px);
    margin-bottom: clamp(40px, 5vw, 50px);
    padding: 0 clamp(10px, 2vw, 20px);
}

.filter-btn {
    padding: clamp(10px, 1.5vw, 12px) clamp(20px, 2.5vw, 24px);
    background: white;
    border: 2px solid var(--gray-light);
    border-radius: 50px;
    font-weight: 500;
    color: var(--gray);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: clamp(0.85rem, 1vw, 0.95rem);
    position: relative;
    overflow: hidden;
}

.filter-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.6s ease, height 0.6s ease;
    z-index: 0;
}

.filter-btn:hover {
    border-color: transparent;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(121, 105, 210, 0.2);
    background: var(--gradient);
}

.filter-btn:hover::before {
    width: 300px;
    height: 300px;
}

.filter-btn.active {
    background: var(--gradient);
    border-color: transparent;
    color: white;
    box-shadow: 0 6px 15px rgba(121, 105, 210, 0.25);
    transform: translateY(-2px);
}

.filter-btn span {
    position: relative;
    z-index: 1;
}

.filter-btn:active {
    transform: translateY(0);
}

/* Portfolio Grid */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(350px, 100%), 1fr));
    gap: clamp(25px, 3vw, 30px);
    margin-bottom: clamp(40px, 5vw, 60px);
}

/* Project Card */
.project-card {
    background: white;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    border-color: rgba(121, 105, 210, 0.2);
}

.project-image {
    position: relative;
    height: clamp(220px, 30vw, 250px);
    overflow: hidden;
}

.project-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

.project-card:hover .project-image img {
    transform: scale(1.08);
}

.project-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    /*background: linear-gradient(135deg, rgba(121, 105, 210, 0.9) 0%, rgba(104, 118, 217, 0.9) 100%);*/
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.4s ease;
   
}

.project-card:hover .project-overlay {
    opacity: 1;
}

.overlay-content {
    display: flex;
    gap: clamp(12px, 1.5vw, 15px);
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.project-card:hover .overlay-content {
    transform: translateY(0);
}

.view-project,
.live-demo,
.view-case-study,
.view-prototype,
.app-store,
.view-brandbook {
    padding: clamp(10px, 1.5vw, 12px) clamp(15px, 2vw, 20px);
    background: white;
    color: var(--primary);
    text-decoration: none;
    border-radius: var(--radius);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: clamp(6px, 0.8vw, 8px);
    transition: all 0.3s ease;
    font-size: clamp(0.8rem, 1vw, 0.9rem);
    min-height: 44px;
}

.view-project:hover,
.live-demo:hover,
.view-case-study:hover,
.view-prototype:hover,
.app-store:hover,
.view-brandbook:hover {
    background: var(--dark);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Project Badge */
.project-badge {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 2;
}

.badge-web,
.badge-marketing,
.badge-design,
.badge-mobile,
.badge-branding {
    padding: clamp(5px, 0.8vw, 6px) clamp(10px, 1.5vw, 12px);
    border-radius: 20px;
    font-size: clamp(0.75rem, 0.9vw, 0.8rem);
    font-weight: 600;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

.badge-web { 
    background: var(--primary);
    border: 1px solid rgba(121, 105, 210, 0.3);
}
.badge-marketing { 
    background: var(--secondary);
    border: 1px solid rgba(104, 118, 217, 0.3);
}
.badge-design { 
    background: var(--accent);
    border: 1px solid rgba(255, 107, 107, 0.3);
}
.badge-mobile { 
    background: var(--info);
    border: 1px solid rgba(41, 204, 200, 0.3);
}
.badge-branding { 
    background: var(--info-light);
    border: 1px solid rgba(102, 204, 255, 0.3);
}

/* Project Info */
.project-info {
    padding: clamp(20px, 3vw, 25px);
}

.project-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: clamp(12px, 1.5vw, 15px);
    padding-bottom: 12px;
    border-bottom: 1px solid rgba(121, 105, 210, 0.1);
}

.project-category {
    color: var(--primary);
    font-weight: 600;
    font-size: clamp(0.8rem, 1vw, 0.9rem);
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 4px 12px;
    background: rgba(121, 105, 210, 0.08);
    border-radius: 4px;
}

.project-date {
    color: var(--gray);
    font-size: clamp(0.8rem, 1vw, 0.9rem);
}

.project-info h3 {
    font-size: clamp(1.2rem, 1.5vw, 1.4rem);
    margin-bottom: clamp(8px, 1vw, 10px);
    color: var(--dark);
    line-height: 1.3;
}

.project-info p {
    color: var(--gray);
    margin-bottom: clamp(15px, 2vw, 20px);
    line-height: 1.6;
    font-size: clamp(0.9rem, 1vw, 1rem);
}

/* Project Stats - Enhanced Beauty */
.project-stats {
    display: flex;
    gap: clamp(15px, 2vw, 20px);
    margin-bottom: clamp(15px, 2vw, 20px);
    padding-bottom: clamp(15px, 2vw, 20px);
    border-bottom: 1px solid rgba(121, 105, 210, 0.1);
    position: relative;
}

.project-stats::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 60px;
    height: 3px;
    background: var(--gradient);
    border-radius: 2px;
    transition: width 0.3s ease;
}

.project-card:hover .project-stats::after {
    width: 120px;
}

.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: clamp(10px, 1.5vw, 12px) clamp(12px, 1.8vw, 16px);
    background: linear-gradient(135deg, rgba(121, 105, 210, 0.05) 0%, rgba(104, 118, 217, 0.05) 100%);
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    min-width: 80px;
    border: 1px solid rgba(121, 105, 210, 0.08);
}

.stat::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1;
}

.stat:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(121, 105, 210, 0.12);
    border-color: rgba(121, 105, 210, 0.2);
}

.stat:hover::before {
    opacity: 0.05;
}

.stat i {
    font-size: clamp(1rem, 1.2vw, 1.2rem);
    color: var(--primary);
    z-index: 2;
    position: relative;
    transition: all 0.3s ease;
}

.stat:hover i {
    color: var(--primary);
    transform: scale(1.2);
}

.stat span {
    font-size: clamp(0.8rem, 0.9vw, 0.85rem);
    font-weight: 600;
    color: var(--dark);
    text-align: center;
    line-height: 1.3;
    z-index: 2;
    position: relative;
    transition: color 0.3s ease;
}

.stat:hover span {
    color: var(--dark);
}

/* Special icons colors */
.stat i.fa-chart-line { color: #4CAF50; }
.stat i.fa-clock { color: #FF9800; }
.stat i.fa-star { color: #FFC107; }
.stat i.fa-users { color: #2196F3; }
.stat i.fa-bullseye { color: #9C27B0; }
.stat i.fa-dollar-sign { color: #4CAF50; }
.stat i.fa-heart { color: #E91E63; }
.stat i.fa-bolt { color: #FF9800; }
.stat i.fa-user-check { color: #00BCD4; }
.stat i.fa-download { color: #673AB7; }
.stat i.fa-chart-bar { color: #3F51B5; }
.stat i.fa-thumbs-up { color: #009688; }
.stat i.fa-award { color: #FF9800; }
.stat i.fa-server { color: #607D8B; }
.stat i.fa-rocket { color: #E91E63; }

/* Project Tech Tags */
.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: clamp(6px, 0.8vw, 8px);
}

.tech-tag {
    padding: clamp(5px, 0.8vw, 6px) clamp(10px, 1.5vw, 12px);
    background: linear-gradient(135deg, rgba(121, 105, 210, 0.08) 0%, rgba(104, 118, 217, 0.08) 100%);
    border-radius: 20px;
    font-size: clamp(0.75rem, 0.9vw, 0.8rem);
    color: var(--dark);
    border: 1px solid rgba(121, 105, 210, 0.15);
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background: var(--gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(121, 105, 210, 0.2);
}

/* Portfolio CTA */
.portfolio-cta {
    background: white;
    border-radius: var(--radius-lg);
    padding: clamp(40px, 5vw, 50px);
    text-align: center;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.cta-content h3 {
    font-size: clamp(1.6rem, 2.5vw, 2rem);
    margin-bottom: clamp(12px, 1.5vw, 15px);
    color: var(--dark);
    line-height: 1.3;
}

.cta-content p {
    color: var(--gray-light);
    margin-bottom: clamp(25px, 3vw, 30px);
    font-size: clamp(0.95rem, 1.2vw, 1.1rem);
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

.cta-buttons {
    display: flex;
    gap: clamp(15px, 2vw, 20px);
    justify-content: center;
    margin-bottom: clamp(30px, 4vw, 40px);
    flex-wrap: wrap;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: clamp(20px, 3vw, 30px);
    padding-top: clamp(30px, 4vw, 40px);
    border-top: 1px solid var(--gray-light);
}

.stat-item {
    text-align: center;
    padding: clamp(15px, 2vw, 20px);
    background: linear-gradient(135deg, rgba(121, 105, 210, 0.03) 0%, rgba(104, 118, 217, 0.03) 100%);
    border-radius: var(--radius);
    transition: all 0.3s ease;
}

.stat-item:hover {
    transform: translateY(-5px);
    background: linear-gradient(135deg, rgba(121, 105, 210, 0.08) 0%, rgba(104, 118, 217, 0.08) 100%);
    box-shadow: 0 10px 25px rgba(121, 105, 210, 0.1);
}

.stat-item h4 {
    font-size: clamp(2rem, 2.8vw, 2.5rem);
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: clamp(3px, 0.5vw, 5px);
    line-height: 1;
    font-weight: 800;
}

.stat-item p {
    color: var(--gray);
    font-size: clamp(0.8rem, 1vw, 0.9rem);
    line-height: 1.4;
}

/* ==========================================================================
   PROJECT MODAL - ENHANCED
   ========================================================================== */

.project-modal .modal-content {
    max-width: min(900px, 90vw);
    margin: 5% auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.15);
}

.project-modal .modal-body {
    padding: 0;
}

.project-detail-header {
    background: var(--gradient);
    color: white;
    padding: clamp(30px, 4vw, 40px);
    position: relative;
    overflow: hidden;
}

.project-detail-header::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 300px;
    height: 300px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
}

.project-detail-header h2 {
    color: white;
    margin-bottom: 10px;
    font-size: clamp(1.5rem, 2.5vw, 2.2rem);
    position: relative;
    z-index: 1;
}

.project-detail-meta {
    display: flex;
    gap: clamp(20px, 3vw, 30px);
    margin-top: 20px;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.project-detail-content {
    padding: clamp(30px, 4vw, 40px);
    display: grid;
    grid-template-columns: minmax(300px, 2fr) minmax(250px, 1fr);
    gap: clamp(30px, 4vw, 40px);
}

.project-detail-info h3 {
    margin-bottom: 20px;
    color: var(--dark);
    font-size: clamp(1.2rem, 1.8vw, 1.5rem);
}

.project-detail-info p {
    color: var(--gray);
    margin-bottom: 20px;
    line-height: 1.8;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
}

.project-features {
    margin: 30px 0;
}

.project-features h4 {
    margin-bottom: 15px;
    color: var(--dark);
    font-size: clamp(1.1rem, 1.5vw, 1.3rem);
}

.project-features ul {
    list-style: none;
}

.project-features li {
    padding: 10px 0;
    color: var(--gray);
    border-bottom: 1px solid var(--gray-light);
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: clamp(0.9rem, 1vw, 1rem);
}

.project-features li:last-child {
    border-bottom: none;
}

.project-features li i {
    color: var(--primary);
    font-size: 0.9rem;
}

.project-sidebar {
    background: var(--gray-light);
    padding: clamp(25px, 3vw, 30px);
    border-radius: var(--radius);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section:last-child {
    margin-bottom: 0;
}

.sidebar-section h4 {
    color: var(--dark);
    margin-bottom: 15px;
    font-size: clamp(1rem, 1.3vw, 1.1rem);
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(121, 105, 210, 0.2);
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tech-stack span {
    padding: 8px 15px;
    background: white;
    border-radius: var(--radius);
    font-size: clamp(0.85rem, 1vw, 0.9rem);
    color: var(--dark);
    border: 1px solid rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.tech-stack span:hover {
    background: var(--gradient);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(121, 105, 210, 0.2);
}

.project-results {
    background: white;
    padding: 20px;
    border-radius: var(--radius);
    margin-top: 20px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--gray-light);
}

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

.result-value {
    font-weight: 700;
    color: var(--primary);
    font-size: 1.1rem;
}

/* ==========================================================================
   RESPONSIVE DESIGN
   ========================================================================== */

/* Tablet Landscape (1200px and below) */
@media (max-width: 1200px) {
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    }
    
    .project-detail-content {
        grid-template-columns: minmax(300px, 1.5fr) minmax(250px, 1fr);
    }
}

/* Tablet Portrait (992px and below) */
@media (max-width: 992px) {
    .portfolio-grid {
        grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
    }
    
    .project-detail-content {
        grid-template-columns: 1fr;
    }
    
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* Mobile Landscape (768px and below) */
@media (max-width: 768px) {
    .portfolio-filters {
        gap: clamp(5px, 1vw, 8px);
        justify-content: flex-start;
        overflow-x: auto;
        padding-bottom: 15px;
        -webkit-overflow-scrolling: touch;
    }
    
    .filter-btn {
        flex: 0 0 auto;
        padding: 10px 18px;
        font-size: 0.85rem;
    }
    
    .overlay-content {
        flex-direction: column;
        gap: 10px;
    }
    
    .cta-buttons {
        flex-direction: column;
        align-items: center;
    }
    
    .project-stats {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .stat {
        flex: 1;
        min-width: calc(50% - 10px);
        max-width: calc(50% - 10px);
    }
    
    .project-detail-meta {
        flex-direction: column;
        gap: 10px;
    }
}

/* Mobile Portrait (576px and below) */
@media (max-width: 576px) {
    .portfolio {
        padding: clamp(50px, 6vw, 70px) 0;
    }
    
    .portfolio-cta {
        padding: clamp(30px, 4vw, 40px) clamp(20px, 3vw, 25px);
    }
    
    .cta-content h3 {
        font-size: clamp(1.3rem, 2vw, 1.6rem);
    }
    
    .cta-content p {
        font-size: clamp(0.85rem, 1vw, 0.95rem);
    }
    
    .stats-bar {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .project-stats {
        flex-direction: column;
        align-items: stretch;
    }
    
    .stat {
        min-width: 100%;
        max-width: 100%;
        flex-direction: row;
        justify-content: flex-start;
        gap: 12px;
    }
    
    .project-image {
        height: 200px;
    }
    
    .project-info {
        padding: 20px;
    }
    
    .project-info h3 {
        font-size: 1.2rem;
    }
    
    .project-info p {
        font-size: 0.9rem;
    }
}

/* Small Mobile (400px and below) */
@media (max-width: 400px) {
    .portfolio-filters {
        justify-content: flex-start;
    }
    
    .filter-btn {
        padding: 8px 14px;
        font-size: 0.8rem;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    .cta-buttons .btn {
        width: 100%;
        justify-content: center;
    }
    
    .stat {
        padding: 10px 12px;
    }
    
    .stat i {
        font-size: 1rem;
    }
    
    .stat span {
        font-size: 0.8rem;
    }
}

/* ==========================================================================
   TOUCH DEVICE OPTIMIZATIONS
   ========================================================================== */

@media (hover: none) and (pointer: coarse) {
    .filter-btn:hover {
        transform: none;
    }
    
    .filter-btn:active {
        background: var(--gradient);
        color: white;
    }
    
    .project-card:hover {
        transform: none;
        box-shadow: var(--shadow);
    }
    
    .stat:hover {
        transform: none;
        box-shadow: 0 4px 15px rgba(121, 105, 210, 0.1);
    }
    
    .stat:active {
        transform: scale(0.98);
        background: rgba(121, 105, 210, 0.1);
    }
    
    .tech-tag:hover {
        transform: none;
    }
    
    .tech-tag:active {
        background: var(--gradient);
        color: white;
    }
    
    .filter-btn,
    .view-project,
    .live-demo,
    .view-case-study,
    .view-prototype,
    .app-store,
    .view-brandbook,
    .stat,
    .tech-tag {
        min-height: 44px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
}

/* ==========================================================================
   HIGH DPI SCREENS
   ========================================================================== */

@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .project-card,
    .portfolio-cta,
    .project-sidebar {
        border-width: 0.5px;
    }
}

/* ==========================================================================
   PRINT STYLES
   ========================================================================== */

@media print {
    .portfolio {
        background: white !important;
        padding: 40px 0;
    }
    
    .portfolio-filters,
    .project-overlay,
    .portfolio-cta {
        display: none;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
    
    .project-card {
        box-shadow: none;
        border: 1px solid #ddd;
    }
    
    .project-card:hover {
        transform: none;
        box-shadow: none;
    }
    
    .stat {
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
    }
    
    .stat i {
        color: #666 !important;
    }
    
    .tech-tag {
        background: #f5f5f5 !important;
        border: 1px solid #ddd !important;
        color: #333 !important;
    }
}