/* Modern Portfolio Section - Complete Redesign */
:root {
    --portfolio-primary: #1e3c72;
    --portfolio-secondary: #2a5298;
    --portfolio-accent: #64b5f6;
    --portfolio-text: #2c3e50;
    --portfolio-light: #666666;
    --portfolio-white: #ffffff;
    --portfolio-gray: #f8f9fa;
}

/* Portfolio Section Container */
.modern-portfolio-section {
    position: relative;
    background: var(--portfolio-white);
    padding: 80px 0;
    overflow: hidden;
    direction: rtl;
}

.modern-portfolio-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--portfolio-accent), transparent);
    opacity: 0.3;
}

/* Portfolio Grid Layout */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 30px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    position: relative;
    z-index: 2;
}

/* Portfolio Card */
.portfolio-card {
    background: var(--portfolio-white);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    cursor: pointer;
    border: 1px solid rgba(30, 60, 114, 0.1);
}

.portfolio-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(30, 60, 114, 0.05) 0%, 
        rgba(100, 181, 246, 0.05) 50%, 
        rgba(30, 60, 114, 0.05) 100%);
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
    border-radius: 20px;
}

.portfolio-card:hover::before {
    opacity: 1;
}

.portfolio-card:hover {
    transform: translateY(-15px) scale(1.02);
    box-shadow: 0 20px 40px rgba(30, 60, 114, 0.2);
    border-color: rgba(100, 181, 246, 0.3);
}

/* Card Image Container */
.portfolio-card-image {
    position: relative;
    height: 280px;
    overflow: hidden;
    border-radius: 20px 20px 0 0;
    display: block;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.portfolio-card-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: block !important;
    position: relative;
    z-index: 1;
    visibility: visible !important;
    opacity: 1 !important;
    filter: brightness(0.95);
}

.portfolio-card:hover .portfolio-card-image img {
    transform: scale(1.05);
    filter: brightness(1);
}

/* Image Overlay */
.portfolio-card-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, 
        rgba(30, 60, 114, 0.9) 0%, 
        rgba(100, 181, 246, 0.8) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    backdrop-filter: blur(2px);
}

.portfolio-card:hover .portfolio-card-overlay {
    opacity: 1;
}

.portfolio-overlay-content {
    text-align: center;
    color: var(--portfolio-white);
    transform: translateY(30px) scale(0.9);
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.portfolio-card:hover .portfolio-overlay-content {
    transform: translateY(0) scale(1);
}

.portfolio-overlay-icon {
    width: 70px;
    height: 70px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 1.8rem;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.portfolio-card:hover .portfolio-overlay-icon {
    transform: scale(1.1);
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.6);
}

.portfolio-overlay-content h4 {
    font-size: 1.2rem;
    font-weight: 700;
    margin: 0;
    font-family: 'Tajawal', sans-serif;
    text-transform: uppercase;
    letter-spacing: 2px;
}

/* Card Content */
.portfolio-card-content {
    padding: 30px;
    position: relative;
    z-index: 2;
    background: var(--portfolio-white);
    text-align: center !important;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.portfolio-card-category {
    display: inline-block;
    background: linear-gradient(135deg, var(--portfolio-accent), var(--portfolio-secondary));
    color: var(--portfolio-white);
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 15px;
    font-family: 'Tajawal', sans-serif;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(100, 181, 246, 0.3);
    text-align: center !important;
}

.portfolio-card-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--portfolio-text);
    margin-bottom: 15px;
    font-family: 'Tajawal', sans-serif;
    line-height: 1.3;
    transition: color 0.3s ease;
    text-align: center !important;
    width: 100%;
}

.portfolio-card:hover .portfolio-card-title {
    background: linear-gradient(135deg, var(--portfolio-primary), var(--portfolio-accent));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.portfolio-card-description {
    color: var(--portfolio-light);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 25px;
    font-family: 'Tajawal', sans-serif;
    font-weight: 400;
    text-align: center !important;
    width: 100%;
}

/* Card Footer */
.portfolio-card-footer {
    display: flex;
    justify-content: center !important;
    align-items: center;
    padding-top: 20px;
    border-top: 1px solid rgba(30, 60, 114, 0.1);
    position: relative;
    width: 100%;
    flex-direction: column;
    gap: 10px;
}

.portfolio-card-tech {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.portfolio-tech-tag {
    background: rgba(100, 181, 246, 0.1);
    color: var(--portfolio-accent);
    padding: 6px 14px;
    border-radius: 15px;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: 'Tajawal', sans-serif;
    border: 1px solid rgba(100, 181, 246, 0.2);
    transition: all 0.3s ease;
}

.portfolio-tech-tag:hover {
    background: rgba(100, 181, 246, 0.2);
    transform: translateY(-2px);
}

.portfolio-card-link {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--portfolio-primary), var(--portfolio-secondary));
    color: var(--portfolio-white);
    text-decoration: none;
    padding: 12px 22px;
    border-radius: 25px;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Tajawal', sans-serif;
    box-shadow: 0 4px 15px rgba(30, 60, 114, 0.3);
    position: relative;
    overflow: hidden;
}

.portfolio-card-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.portfolio-card-link:hover::before {
    left: 100%;
}

.portfolio-card-link:hover {
    transform: translateX(-5px) translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.4);
}

/* Featured Badge */
.portfolio-featured {
    position: absolute;
    top: 20px;
    right: 20px;
    background: linear-gradient(135deg, #ff6b6b, #ff8e53);
    color: var(--portfolio-white);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    z-index: 3;
    font-family: 'Tajawal', sans-serif;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    animation: pulse 2s infinite;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(255, 107, 107, 0.4);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 20px rgba(255, 107, 107, 0.6);
    }
}

/* Section CTA */
.portfolio-cta {
    text-align: center;
    margin-top: 60px;
    padding: 40px 20px;
    background: linear-gradient(135deg, rgba(30, 60, 114, 0.05), rgba(100, 181, 246, 0.05));
    border-radius: 20px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.portfolio-cta h3 {
    font-size: 1.8rem;
    color: var(--portfolio-text);
    margin-bottom: 15px;
    font-family: 'Tajawal', sans-serif;
}

.portfolio-cta p {
    color: var(--portfolio-light);
    margin-bottom: 25px;
    font-family: 'Tajawal', sans-serif;
}

.portfolio-cta-button {
    display: inline-block;
    background: linear-gradient(135deg, var(--portfolio-primary), var(--portfolio-accent));
    color: var(--portfolio-white);
    text-decoration: none;
    padding: 15px 35px;
    border-radius: 30px;
    font-size: 1.1rem;
    font-weight: 700;
    transition: all 0.3s ease;
    font-family: 'Tajawal', sans-serif;
}

.portfolio-cta-button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(30, 60, 114, 0.3);
}

/* Additional centering rules with higher specificity */
.modern-portfolio-section .portfolio-card-content {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
}

.modern-portfolio-section .portfolio-card-title {
    text-align: center !important;
    align-self: center !important;
    width: 100% !important;
}

.modern-portfolio-section .portfolio-card-description {
    text-align: center !important;
    align-self: center !important;
    width: 100% !important;
}

.modern-portfolio-section .portfolio-card-footer {
    justify-content: center !important;
    align-items: center !important;
    width: 100% !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
}

.modern-portfolio-section .portfolio-card-link {
    margin: 0 auto !important;
    display: inline-flex !important;
}

/* Force centering for all text elements */
.portfolio-card * {
    text-align: center !important;
}

/* RTL specific centering rules */
[dir="rtl"] .portfolio-card-content,
[dir="rtl"] .portfolio-card-title,
[dir="rtl"] .portfolio-card-description,
[dir="rtl"] .portfolio-card-footer {
    text-align: center !important;
    direction: rtl;
}

[dir="rtl"] .portfolio-card-footer {
    justify-content: center !important;
}

/* Universal centering override */
.portfolio-card-content,
.portfolio-card-title,
.portfolio-card-description,
.portfolio-card-footer {
    text-align: center !important;
}

/* Responsive Design */
@media (max-width: 768px) {
    .modern-portfolio-section {
        padding: 60px 0;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 25px;
        padding: 0 15px;
    }
    
    .portfolio-title {
        font-size: 2rem;
    }
    
    .portfolio-card-image {
        height: 200px;
    }
    
    .portfolio-card-content {
        padding: 20px;
    }
    
    .portfolio-cta {
        margin-top: 40px;
        padding: 30px 15px;
    }
}

@media (max-width: 480px) {
    .portfolio-card-footer {
        flex-direction: column;
        gap: 15px;
        align-items: flex-start;
    }
    
    .portfolio-card-tech {
        width: 100%;
    }
    
    .portfolio-cta-button {
        width: 100%;
        text-align: center;
    }
}

/* --- View All Portfolio Button --- */
.portfolio-view-all-container {
    text-align: center;
    margin: 3rem 0;
}

.portfolio-view-all-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    font-size: 1.1rem;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(30, 60, 114, 0.3);
    border: 2px solid transparent;
    font-family: 'Tajawal', sans-serif;
}

.portfolio-view-all-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(30, 60, 114, 0.4);
    border-color: rgba(255, 255, 255, 0.2);
}

.portfolio-view-all-btn i {
    transition: transform 0.3s ease;
}

.portfolio-view-all-btn:hover i {
    transform: translateX(-3px);
}

/* Mobile Responsive for Portfolio Button */
@media (max-width: 768px) {
    .portfolio-view-all-btn {
        padding: 0.9rem 1.8rem;
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .portfolio-view-all-container {
        margin: 2rem 0;
    }
    
    .portfolio-view-all-btn {
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }
}
