/**
 * ملف التحسينات والجماليات
 * Improvements & Enhancements CSS
 */

/* ========== تحسينات عامة ========== */

/* تحسين Smooth Scrolling */
html {
    scroll-behavior: smooth;
}

/* تحسين تجربة التفاعل */
* {
    -webkit-tap-highlight-color: transparent;
}

/* تحسين الأزرار */
button, .btn, a.btn {
    position: relative;
    overflow: hidden;
    transition: all 0.3s ease;
}

button::before, .btn::before, a.btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

button:hover::before, .btn:hover::before, a.btn:hover::before {
    width: 300px;
    height: 300px;
}

/* تأثير النبض للعناصر المهمة */
@keyframes pulse {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(102, 126, 234, 0.7);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(102, 126, 234, 0);
    }
}

.pulse-effect {
    animation: pulse 2s infinite;
}

/* ========== تحسينات Portfolio ========== */

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 30px;
    padding: 20px;
}

.portfolio-item {
    background: white;
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.portfolio-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.portfolio-item:hover::before {
    transform: scaleX(1);
}

.portfolio-item:hover {
    transform: translateY(-10px) scale(1.02);
    box-shadow: 0 20px 40px rgba(102, 126, 234, 0.2);
}

.portfolio-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.portfolio-item:hover .portfolio-image {
    transform: scale(1.1);
}

/* تحسين مشغل الصوت والفيديو */
audio, video {
    border-radius: 8px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.1);
}

audio::-webkit-media-controls-panel {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

/* ========== تحسينات النصوص ========== */

.section-title {
    position: relative;
    padding-bottom: 15px;
    margin-bottom: 30px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 60px;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 100%);
    border-radius: 2px;
}

/* تأثير تدرج النص */
.gradient-text {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ========== تحسينات البطاقات ========== */

.card-hover-effect {
    transition: all 0.3s ease;
    border: 1px solid transparent;
}

.card-hover-effect:hover {
    border-color: #667eea;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.2);
}

/* ========== تأثيرات التحميل ========== */

.skeleton-loader {
    background: linear-gradient(90deg, 
        #f0f0f0 25%, 
        #e0e0e0 50%, 
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ========== تحسينات القوائم ========== */

.list-with-icons {
    list-style: none;
    padding: 0;
}

.list-with-icons li {
    position: relative;
    padding-right: 30px;
    margin-bottom: 15px;
    transition: transform 0.3s ease;
}

.list-with-icons li::before {
    content: '✓';
    position: absolute;
    right: 0;
    color: #667eea;
    font-weight: bold;
    font-size: 18px;
}

.list-with-icons li:hover {
    transform: translateX(-5px);
}

/* ========== Badge و Tags ========== */

.badge-modern {
    display: inline-block;
    padding: 6px 15px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
    transition: all 0.3s ease;
}

.badge-modern:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

/* ========== تحسين النماذج ========== */

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    transition: all 0.3s ease;
}

/* ========== Loading Spinner ========== */

.spinner {
    width: 50px;
    height: 50px;
    margin: 20px auto;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ========== تأثيرات الظل ========== */

.shadow-sm { box-shadow: 0 2px 5px rgba(0,0,0,0.05); }
.shadow-md { box-shadow: 0 5px 15px rgba(0,0,0,0.1); }
.shadow-lg { box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.shadow-xl { box-shadow: 0 20px 60px rgba(0,0,0,0.2); }

.shadow-colored {
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

/* ========== تحسينات التمرير ========== */

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* ========== تأثيرات الانتقال ========== */

.fade-in {
    animation: fadeIn 0.5s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.slide-up {
    animation: slideUp 0.5s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.slide-in-right {
    animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ========== زر العودة للأعلى المحسّن ========== */

#scrollTopBtn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    z-index: 1000;
    box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
}

#scrollTopBtn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.6);
}

#scrollTopBtn.show {
    display: flex;
    animation: fadeInScale 0.3s ease;
}

@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.5);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* ========== تحسينات الأيقونات ========== */

.icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    color: #667eea;
    font-size: 24px;
    transition: all 0.3s ease;
}

.icon-wrapper:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: rotate(360deg);
}

/* ========== تحسينات الجداول ========== */

table {
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px rgba(0,0,0,0.08);
}

table thead tr {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

table tbody tr {
    transition: all 0.3s ease;
}

table tbody tr:hover {
    background: rgba(102, 126, 234, 0.05);
    transform: scale(1.01);
}

/* ========== تأثيرات الصور ========== */

.image-zoom {
    overflow: hidden;
    border-radius: 10px;
}

.image-zoom img {
    transition: transform 0.5s ease;
}

.image-zoom:hover img {
    transform: scale(1.2);
}

/* ========== تحسينات Tooltip ========== */

[data-tooltip] {
    position: relative;
    cursor: pointer;
}

[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%) translateY(-10px);
    padding: 8px 12px;
    background: #333;
    color: white;
    font-size: 13px;
    border-radius: 6px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    z-index: 1000;
}

[data-tooltip]:hover::after {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ========== تحسينات الوضع الليلي (اختياري) ========== */

@media (prefers-color-scheme: dark) {
    .auto-dark {
        background: #1a1a1a;
        color: #ffffff;
    }
}

/* ========== Responsive Improvements ========== */

@media (max-width: 768px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 10px;
    }
    
    #scrollTopBtn {
        width: 45px;
        height: 45px;
        bottom: 20px;
        left: 20px;
        font-size: 18px;
    }
    
    .icon-wrapper {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
}

/* ========== Print Styles ========== */

@media print {
    .no-print, #scrollTopBtn, button, .btn {
        display: none !important;
    }
    
    * {
        box-shadow: none !important;
        animation: none !important;
    }
}

/* ========== تحسين الأداء ========== */

.will-change-transform {
    will-change: transform;
}

.will-change-opacity {
    will-change: opacity;
}

/* ========== Utility Classes ========== */

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-left { text-align: left; }
.text-justify { text-align: justify; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }

.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.p-10 { padding: 10px; }
.p-20 { padding: 20px; }
.p-30 { padding: 30px; }

.rounded { border-radius: 10px; }
.rounded-full { border-radius: 50%; }

.flex { display: flex; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

.hidden { display: none; }
.visible { display: block; }