/**
 * ============================================
 * PORTFOLIO MODAL STYLES - تنسيقات النافذة المنبثقة
 * ============================================
 * تصميم أنيق ومتجاوب للنافذة المنبثقة لعرض تفاصيل الأعمال
 */

/* ===== Modal Container ===== */
.portfolio-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.portfolio-modal.active {
    opacity: 1;
    visibility: visible;
}

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

/* ===== Overlay ===== */
.portfolio-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    cursor: pointer;
}

/* ===== Modal Container ===== */
.portfolio-modal-container {
    position: relative;
    width: 100%;
    max-width: 700px;
    max-height: 90vh;
    background: white;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10000;
}

.portfolio-modal.active .portfolio-modal-container {
    transform: scale(1) translateY(0);
}

/* ===== Modal Content ===== */
.portfolio-modal-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    max-height: 90vh;
    overflow-y: auto;
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE and Edge */
}

/* ===== Hide Scrollbar ===== */
.portfolio-modal-content::-webkit-scrollbar {
    display: none; /* Chrome, Safari, Opera */
}

/* ===== Header ===== */
.portfolio-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 10;
    flex-shrink: 0;
}

.portfolio-modal-category {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 1rem;
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: white;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.portfolio-modal-category i {
    font-size: 0.875rem;
}

.portfolio-modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.05);
    border: none;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #64748b;
    flex-shrink: 0;
}

.portfolio-modal-close:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    transform: rotate(90deg);
}

.portfolio-modal-close i {
    font-size: 1rem;
}

/* ===== Body ===== */
.portfolio-modal-body {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    padding: 1rem;
}

/* ===== Media Section ===== */
.portfolio-modal-media {
    position: relative;
    width: 100%;
    border-radius: 16px;
    overflow: hidden;
    background: #f8fafc;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.portfolio-modal-video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border: none;
    border-radius: 16px;
}

.portfolio-modal-image {
    width: 100%;
    height: auto;
    max-height: 500px;
    object-fit: contain;
    border-radius: 16px;
    display: block;
}

/* ===== Title & Description (Below Media) ===== */
.portfolio-modal-header-text {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.portfolio-modal-title {
    font-size: 1.75rem;
    font-weight: 800;
    color: #1e293b;
    line-height: 1.3;
    margin: 0;
}

.portfolio-modal-description {
    font-size: 0.9375rem;
    color: #64748b;
    line-height: 1.7;
    margin: 0;
}

/* ===== Info Section ===== */
.portfolio-modal-info {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ===== Meta Info ===== */
.portfolio-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.portfolio-modal-meta-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #475569;
    font-weight: 600;
    flex-direction: row;
}

.portfolio-modal-meta-item i {
    color: #3b82f6;
    font-size: 1rem;
    flex-shrink: 0;
}

.portfolio-modal-meta-item span {
    display: inline-block;
}

/* ===== Divider ===== */
.portfolio-modal-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(0, 0, 0, 0.1), transparent);
    margin: 0.5rem 0;
}

/* ===== Section Title (Unified) ===== */
.portfolio-modal-section-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1e293b;
    margin: 0 0 0.625rem 0;
}

/* ===== Scope of Work ===== */
.portfolio-modal-scope {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.portfolio-modal-scope-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.portfolio-modal-scope-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #3b82f6;
    transition: all 0.3s ease;
}

.portfolio-modal-scope-badge:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

/* ===== Technologies ===== */
.portfolio-modal-tech {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.portfolio-modal-tech-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.portfolio-modal-tech-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.375rem 0.875rem;
    background: rgba(139, 92, 246, 0.08);
    border: 1px solid rgba(139, 92, 246, 0.15);
    border-radius: 50px;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #8b5cf6;
    transition: all 0.3s ease;
}

.portfolio-modal-tech-badge:hover {
    background: rgba(139, 92, 246, 0.15);
    border-color: rgba(139, 92, 246, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.15);
}

/* ===== Action Button ===== */
.portfolio-modal-actions {
    margin-top: auto;
    display: flex;
    justify-content: flex-start;
}

.portfolio-modal-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: linear-gradient(135deg, #3b82f6, #8b5cf6);
    color: white;
    border: none;
    border-radius: 50px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.3);
}

.portfolio-modal-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb, #7c3aed);
}

.portfolio-modal-btn i {
    font-size: 0.875rem;
}

/* ===== Responsive Design ===== */
@media (max-width: 1024px) {
    .portfolio-modal-container {
        max-width: 95%;
    }
}

@media (max-width: 768px) {
    .portfolio-modal-container {
        max-width: 95%;
        border-radius: 16px;
    }
    
    .portfolio-modal-header {
        padding: 0.75rem 1.25rem;
    }
    
    .portfolio-modal-body {
        padding: 1.5rem;
        gap: 1.25rem;
    }
    
    .portfolio-modal-title {
        font-size: 1.5rem;
    }
    
    .portfolio-modal-description {
        font-size: 0.875rem;
    }
    
    .portfolio-modal-image {
        max-height: 350px;
    }
    
    .portfolio-modal-meta {
        gap: 1rem;
    }
    
    .portfolio-modal-btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .portfolio-modal {
        padding: 0.5rem;
    }
    
    .portfolio-modal-container {
        border-radius: 12px;
    }
    
    .portfolio-modal-header {
        padding: 0.625rem 1rem;
    }
    
    .portfolio-modal-body {
        padding: 1rem;
        gap: 1rem;
    }
    
    .portfolio-modal-title {
        font-size: 1.25rem;
    }
    
    .portfolio-modal-description {
        font-size: 0.8125rem;
    }
    
    .portfolio-modal-image {
        max-height: 250px;
    }
    
    .portfolio-modal-category {
        padding: 0.375rem 1rem;
        font-size: 0.75rem;
    }
    
    .portfolio-modal-close {
        width: 36px;
        height: 36px;
    }
    
    .portfolio-modal-meta {
        flex-direction: column;
        gap: 0.75rem;
    }
}

/* ===== RTL Support ===== */
[dir="rtl"] .portfolio-modal-header {
    direction: rtl;
}

[dir="rtl"] .portfolio-modal-category {
    flex-direction: row-reverse;
}

[dir="rtl"] .portfolio-modal-info {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .portfolio-modal-header-text {
    direction: rtl;
}

[dir="rtl"] .portfolio-modal-title,
[dir="rtl"] .portfolio-modal-description {
    text-align: right;
    direction: rtl;
}

[dir="rtl"] .portfolio-modal-meta {
    direction: rtl;
}

[dir="rtl"] .portfolio-modal-meta-item {
    flex-direction: row-reverse;
    direction: rtl;
}

[dir="rtl"] .portfolio-modal-meta-item i {
    order: 2;
}

[dir="rtl"] .portfolio-modal-meta-item span {
    order: 1;
    text-align: right;
}

[dir="rtl"] .portfolio-modal-section-title {
    direction: rtl;
    text-align: right;
}

[dir="rtl"] .portfolio-modal-scope {
    direction: rtl;
}

[dir="rtl"] .portfolio-modal-scope-list {
    direction: rtl;
}

[dir="rtl"] .portfolio-modal-tech {
    direction: rtl !important;
}

[dir="rtl"] .portfolio-modal-tech-list {
    direction: rtl !important;
}

[dir="rtl"] .portfolio-modal-actions {
    justify-content: flex-start;
}

[dir="rtl"] .portfolio-modal-btn {
    flex-direction: row-reverse;
}

/* ===== LTR Support ===== */
[dir="ltr"] .portfolio-modal-header {
    direction: ltr;
}

[dir="ltr"] .portfolio-modal-info {
    direction: ltr;
    text-align: left;
}

[dir="ltr"] .portfolio-modal-header-text {
    direction: ltr;
}

[dir="ltr"] .portfolio-modal-title,
[dir="ltr"] .portfolio-modal-description {
    text-align: left;
    direction: ltr;
}

[dir="ltr"] .portfolio-modal-meta {
    direction: ltr;
}

[dir="ltr"] .portfolio-modal-meta-item {
    flex-direction: row;
    direction: ltr;
}

[dir="ltr"] .portfolio-modal-actions {
    justify-content: flex-start;
}

[dir="ltr"] .portfolio-modal-meta-item i {
    order: 1;
}

[dir="ltr"] .portfolio-modal-meta-item span {
    order: 2;
    text-align: left;
}

[dir="ltr"] .portfolio-modal-section-title {
    direction: ltr;
    text-align: left;
}

[dir="ltr"] .portfolio-modal-scope {
    direction: ltr;
}

[dir="ltr"] .portfolio-modal-scope-list {
    direction: ltr;
}

[dir="ltr"] .portfolio-modal-tech {
    direction: ltr !important;
}

/* ===== Animation Effects ===== */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes modalFadeOut {
    from {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
    to {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }
}

/* ===== Loading State ===== */
.portfolio-modal-media.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 400px;
}

.portfolio-modal-media.loading::after {
    content: '';
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top-color: #00d4ff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* ===== Accessibility ===== */
.portfolio-modal-close:focus {
    outline: 2px solid #00d4ff;
    outline-offset: 2px;
}

.portfolio-modal-btn:focus {
    outline: 2px solid #00d4ff;
    outline-offset: 2px;
}

/* ===== Print Styles ===== */
@media print {
    .portfolio-modal {
        display: none;
    }
}
