/* ===== تحسينات الأجهزة المحمولة ===== */
:root {
    /* متغيرات إضافية للأجهزة المحمولة */
    --mobile-header-height: 7rem;
    --mobile-padding: 1.5rem;
}

/* ===== تحسينات عامة للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    section {
        padding: 8rem 0;
    }
    
    .container {
        padding: 0 var(--mobile-padding);
    }
    
    .section-header {
        margin-bottom: 4rem;
    }
    
    .hero {
        padding-top: var(--mobile-header-height);
    }
}

/* ===== تحسينات الهيدر للأجهزة المحمولة ===== */
@media (max-width: 768px) {
    header {
        padding: 1rem 0;
        background: rgba(15, 15, 26, 0.9);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        box-shadow: var(--shadow-md);
    }
    
    .logo h1 {
        font-size: 2rem;
    }
    
    .logo p {
        font-size: 1.2rem;
    }
    
    .menu-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        z-index: 1001;
    }
    
    .menu-items {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        height: 100vh;
        background: var(--bg-dark);
        flex-direction: column;
        justify-content: center;
        align-items: center;
        z-index: 1000;
        transition: var(--transition-normal);
        padding: 2rem;
    }
    
    .menu-items.active {
        right: 0;
    }
    
    .menu-items ul {
        flex-direction: column;
        align-items: center;
        gap: 2.5rem;
    }
    
    .menu-items a {
        font-size: 2rem;
    }
    
    .menu-backdrop {
        display: block;
    }
}

/* ===== تحسينات قسم البطل للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .hero-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .hero-image {
        order: -1;
        margin: 0 auto;
        max-width: 80%;
    }
    
    .hero-text {
        text-align: center;
    }
    
    .hero-title {
        font-size: 4rem;
    }
    
    .hero-subtitle {
        font-size: 1.6rem;
        margin: 0 auto 2rem;
    }
    
    .hero-cta {
        justify-content: center;
        margin-top: 2rem;
    }
    
    .hero-badges {
        justify-content: center;
    }
}

@media (max-width: 576px) {
    .hero-title {
        font-size: 3.5rem;
    }
    
    .hero-cta {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }
    
    .hero-badges {
        flex-direction: column;
        align-items: center;
    }
    
    .badge {
        width: 100%;
        justify-content: center;
    }
}

/* ===== تحسينات قسم نبذة عني للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .about-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .about-image {
        margin: 0 auto;
        max-width: 80%;
    }
    
    .about-text h3 {
        font-size: 2.5rem;
        text-align: center;
    }
    
    .about-features {
        grid-template-columns: 1fr; /* Ensure single column layout */
        gap: 2rem;
    }

    /* START: تعديل لإظهار النصوص داخل .feature وتصحيح سلوك البرداية */
    .about-features .feature,
    .skills-features .feature {
        /* main.css has position:relative, overflow:hidden, and padding */
        /* We ensure height adjusts to content here for responsive views */
        height: auto;
    }

    .about-features .feature p,
    .skills-features .feature p {
        /* main.css should provide position:relative, z-index:2, color, font-size, line-height, margins */
        /* We ensure display properties for visibility here if they were overridden */
        display: block;
        visibility: visible;
        opacity: 1;
        height: auto; /* Allow paragraph to determine its own height based on content */
    }
    /* END: تعديل لإظهار النصوص داخل .feature */
    
    .about-cta {
        justify-content: center;
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }
}

/* ===== تحسينات قسم الخدمات للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .services-grid {
        grid-template-columns: repeat(auto-fill, minmax(25rem, 1fr));
        gap: 2rem;
    }
    
    .service-card {
        height: 22rem;
    }
    
    .service-icon {
        width: 6rem;
        height: 6rem;
    }
    
    .service-icon i {
        font-size: 2.5rem;
    }
    
    .service-card h3 {
        font-size: 1.8rem;
    }
    
    .services-cta {
        margin-top: 3rem;
    }
}

@media (max-width: 576px) {
    .services-grid {
        grid-template-columns: 1fr;
    }
}

/* ===== تحسينات قسم الأعمال للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .portfolio-filter {
        gap: 0.5rem;
        margin-bottom: 3rem;
    }
    
    .filter-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1.4rem;
    }
    
    .portfolio-grid {
        grid-template-columns: repeat(auto-fill, minmax(25rem, 1fr));
        gap: 2rem;
    }
    
    .portfolio-image img {
        height: 20rem;
    }
    
    .portfolio-info h3 {
        font-size: 1.8rem;
    }
    
    .portfolio-cta {
        margin-top: 3rem;
    }
}

@media (max-width: 576px) {
    .portfolio-grid {
        grid-template-columns: 1fr;
    }
    
    .portfolio-filter {
        flex-wrap: wrap;
        justify-content: center;
    }
}

/* ===== تحسينات قسم المهارات للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .skills-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .skills-text h3 {
        font-size: 2.5rem;
        text-align: center;
    }
    
    .skills-features {
        grid-template-columns: 1fr;
        gap: 2rem;
        /* The rules for .skills-features .feature and .skills-features .feature p */
        /* are now covered by the more general rules added above for .about-features */
    }
    
    .skills-circles {
        grid-template-columns: repeat(2, 1fr);
        gap: 3rem;
    }
    
    .circular-progress {
        width: 12rem;
        height: 12rem;
    }
    
    .circular-progress h4 {
        margin-top: 13rem;
        font-size: 1.4rem;
    }
}

@media (max-width: 576px) {
    .skills-circles {
        grid-template-columns: 1fr;
    }
}

/* ===== تحسينات قسم التواصل للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .contact-content {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
    
    .contact-info,
    .contact-form {
        padding: 2rem;
    }
    
    .contact-info h3,
    .contact-form h3 {
        font-size: 2.2rem;
        margin-bottom: 2rem;
        text-align: center;
    }
    
    .contact-item {
        margin-bottom: 2rem;
    }
    
    .social-links {
        justify-content: center;
    }
    
    .contact-map {
        margin-top: 2rem;
    }
    
    .form-group {
        margin-bottom: 1.5rem;
    }
}

/* ===== تحسينات قسم الشهادات للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .testimonials-slider {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .testimonial-item {
        padding: 2rem;
    }
    
    .testimonial-content {
        margin-bottom: 2rem;
    }
    
    .testimonial-author {
        gap: 1.5rem;
    }
    
    .author-image {
        width: 5rem;
        height: 5rem;
    }
    
    .testimonials-controls {
        margin-top: 2rem;
    }
}

/* ===== تحسينات قسم الأسئلة الشائعة للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .faq-content {
        max-width: 100%;
    }
    
    .faq-question {
        padding: 1.5rem;
    }
    
    .faq-question h3 {
        font-size: 1.6rem;
    }
    
    .faq-toggle {
        width: 2.5rem;
        height: 2.5rem;
    }
    
    .faq-answer {
        padding: 0 1.5rem 1.5rem;
    }
    
    .faq-cta {
        margin-top: 3rem;
    }
}

/* ===== تحسينات قسم النشرة البريدية للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .newsletter-content {
        flex-direction: column;
        text-align: center;
        gap: 2rem;
        padding: 3rem 2rem;
    }
    
    .newsletter-text h2 {
        font-size: 2.5rem;
    }
    
    .newsletter-form .form-group {
        flex-direction: column;
        gap: 1.5rem;
    }
}

/* ===== تحسينات الفوتر للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    footer {
        padding: 6rem 0 2rem;
    }
    
    .footer-content {
        grid-template-columns: 1fr;
        gap: 3rem;
        text-align: center;
    }
    
    .footer-logo h2 {
        font-size: 2.2rem;
    }
    
    .footer-links h3,
    .footer-contact h3 {
        font-size: 1.8rem;
    }
    
    .footer-links ul {
        align-items: center;
    }
    
    .footer-contact p {
        justify-content: center;
    }
    
    .social-links {
        justify-content: center;
    }
}

/* ===== تحسينات زر التمرير للأعلى للأجهزة المحمولة ===== */
@media (max-width: 576px) {
    .scroll-to-top {
        bottom: 2rem;
        right: 2rem;
        width: 4rem;
        height: 4rem;
        font-size: 1.6rem;
    }
}

/* ===== تحسينات المؤشر المخصص للأجهزة المحمولة ===== */
@media (max-width: 992px) {
    .cursor,
    .cursor-follower {
        display: none;
    }
}

/* ===== تحسينات إضافية للأجهزة المحمولة ===== */
@media (max-width: 576px) {
    html {
        font-size: 50%;
    }
    
    .section-title {
        font-size: 3rem;
    }
    
    .section-subtitle {
        font-size: 1.4rem;
    }
    
    .glow-button {
        padding: 1rem 2rem;
    }
}

/* ===== تحسينات للأجهزة اللوحية ===== */
@media (min-width: 577px) and (max-width: 992px) {
    html {
        font-size: 55%;
    }
}

/* ===== تحسينات للشاشات الكبيرة ===== */
@media (min-width: 1400px) {
    html {
        font-size: 65%;
    }
    
    .container {
        max-width: 140rem;
    }
}

/* ===== تحسينات لوضع الطباعة ===== */
@media print {
    .menu-toggle,
    .theme-toggle,
    .scroll-to-top,
    .hero-cta,
    .about-cta,
    .services-cta,
    .portfolio-cta,
    .faq-cta,
    .contact-form,
    .newsletter-content,
    footer {
        display: none !important;
    }
    
    body {
        background: white;
        color: black;
    }
    
    .container {
        width: 100%;
        max-width: 100%;
        padding: 0;
    }
    
    section {
        padding: 2rem 0;
        page-break-inside: avoid;
    }
    
    .hero-content,
    .about-content,
    .skills-content,
    .contact-content {
        grid-template-columns: 1fr 1fr;
    }
    
    .enhanced-glass,
    .neumorphic-card,
    .glass-card {
        background: white;
        box-shadow: none;
        border: 1px solid #eee;
    }
    
    .text-light {
        color: black !important;
    }
    
    .neon-text,
    .glitch-text,
    .accent-text {
        color: black;
        text-shadow: none;
    }
}

/* ===== تحسينات لوضع الرؤية المنخفضة ===== */
.low-vision-mode {
    --primary-color: #ffcc00;
    --secondary-color: #ff6b6b;
    --accent-color: #00d9ff;
    --dark-color: #000000;
    --light-color: #ffffff;
    --text-dark: #000000;
    --text-light: #ffffff;
    --text-muted: #cccccc;
    --bg-dark: #000000;
    --bg-light: #ffffff;
    --bg-gradient: linear-gradient(135deg, #000000, #333333);
}

.low-vision-mode * {
    font-size: 110% !important;
    line-height: 1.8 !important;
    letter-spacing: 0.5px !important;
}

.low-vision-mode .neon-text,
.low-vision-mode .glitch-text {
    text-shadow: none !important;
    animation: none !important;
}

.low-vision-mode .enhanced-glass,
.low-vision-mode .glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--dark-color) !important;
}

/* ===== تحسينات لوضع القراءة ===== */
.reading-mode {
    --primary-color: #4a6da7;
    --secondary-color: #a74a6d;
    --accent-color: #4aa77c;
    --dark-color: #f8f9fa;
    --light-color: #333333;
    --text-dark: #333333;
    --text-light: #333333;
    --text-muted: #666666;
    --bg-dark: #f8f9fa;
    --bg-light: #ffffff;
    --bg-gradient: linear-gradient(135deg, #f8f9fa, #ffffff);
}

.reading-mode .wave-background,
.reading-mode .grid-background {
    background: var(--bg-dark) !important;
}

.reading-mode .wave-background::before,
.reading-mode .grid-background::before {
    display: none !important;
}

.reading-mode .wave {
    display: none !important;
}

.reading-mode .enhanced-glass,
.reading-mode .glass-card,
.reading-mode .neumorphic-card {
    background: white !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #eee !important;
}

.reading-mode .hero-shapes .shape {
    display: none !important;
}

/* ===== تحسينات لوضع توفير البطارية ===== */
.battery-saver-mode {
    --transition-fast: 0s !important;
    --transition-normal: 0s !important;
    --transition-slow: 0s !important;
}

.battery-saver-mode * {
    transition: none !important;
    animation: none !important;
}

.battery-saver-mode .cursor,
.battery-saver-mode .cursor-follower,
.battery-saver-mode .wave,
.battery-saver-mode .hero-shapes .shape,
.battery-saver-mode .progress-glow {
    display: none !important;
}

/* ===== تحسينات لوضع الإضاءة المنخفضة ===== */
.dark-mode {
    --primary-color: #4a6da7;
    --secondary-color: #a74a6d;
    --accent-color: #4aa77c;
    --dark-color: #121212;
    --light-color: #f5f5f5;
    --text-dark: #f5f5f5;
    --text-light: #f5f5f5;
    --text-muted: #aaaaaa;
    --bg-dark: #121212;
    --bg-light: #1e1e1e;
    --bg-gradient: linear-gradient(135deg, #121212, #1e1e1e);
}

.dark-mode .shadow-neon {
    box-shadow: 0 0 5px rgba(74, 109, 167, 0.3) !important;
}

.dark-mode .neon-text {
    text-shadow: 0 0 5px rgba(74, 109, 167, 0.3) !important;
}

/* ===== تحسينات لوضع الإضاءة العالية ===== */
.light-mode {
    --primary-color: #4a6da7;
    --secondary-color: #a74a6d;
    --accent-color: #4aa77c;
    --dark-color: #ffffff;
    --light-color: #333333;
    --text-dark: #333333;
    --text-light: #333333;
    --text-muted: #666666;
    --bg-dark: #ffffff;
    --bg-light: #f8f9fa;
    --bg-gradient: linear-gradient(135deg, #ffffff, #f8f9fa);
}

.light-mode .wave-background,
.light-mode .grid-background {
    background: var(--bg-dark) !important;
}

.light-mode .wave-background::before,
.light-mode .grid-background::before {
    display: none !important;
}

.light-mode .wave {
    display: none !important;
}

.light-mode .enhanced-glass,
.light-mode .glass-card,
.light-mode .neumorphic-card {
    background: white !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    border: 1px solid #eee !important;
}

/* ===== تحسينات لوضع التركيز ===== */
.focus-mode .hero-badges,
.focus-mode .hero-shapes,
.focus-mode .about-shape,
.focus-mode .social-links,
.focus-mode .footer-links,
.focus-mode .footer-contact,
.focus-mode .newsletter-content,
.focus-mode .testimonials-slider,
.focus-mode .portfolio-filter {
    display: none !important;
}

.focus-mode .section-header {
    margin-bottom: 3rem !important;
}

.focus-mode .section-title {
    font-size: 3rem !important;
}

.focus-mode .section-subtitle {
    font-size: 1.4rem !important;
}

.focus-mode .title-separator {
    width: 10rem !important;
}

/* ===== تحسينات لوضع الوصول ===== */
.accessibility-mode * {
    font-family: Arial, sans-serif !important;
    letter-spacing: 0.5px !important;
    word-spacing: 2px !important;
    line-height: 1.8 !important;
}

.accessibility-mode a:focus,
.accessibility-mode button:focus,
.accessibility-mode input:focus,
.accessibility-mode textarea:focus {
    outline: 3px solid var(--primary-color) !important;
    outline-offset: 3px !important;
}

.accessibility-mode .neon-text,
.accessibility-mode .glitch-text {
    text-shadow: none !important;
    animation: none !important;
}

.accessibility-mode .enhanced-glass,
.accessibility-mode .glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--dark-color) !important;
}

/* ===== تحسينات لوضع الطاقة المنخفضة ===== */
.low-power-mode {
    --transition-fast: 0s !important;
    --transition-normal: 0s !important;
    --transition-slow: 0s !important;
}

.low-power-mode * {
    transition: none !important;
    animation: none !important;
}

.low-power-mode .cursor,
.low-power-mode .cursor-follower,
.low-power-mode .wave,
.low-power-mode .hero-shapes .shape,
.low-power-mode .progress-glow,
.low-power-mode .floating-image {
    display: none !important;
}

.low-power-mode .enhanced-glass,
.low-power-mode .glass-card {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    background: var(--dark-color) !important;
}

/* ===== تحسينات لوضع الاتصال البطيء ===== */
.slow-connection-mode img {
    max-width: 100%;
    height: auto;
    max-height: 300px;
    object-fit: contain;
}

.slow-connection-mode .hero-image img,
.slow-connection-mode .about-image img {
    max-height: 200px;
}

.slow-connection-mode .portfolio-image img {
    height: 150px;
}

/* Ensure this is the last line if no more content */

