/* ===== CSS RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    /* Elegant Light Theme Colors */
    --primary-color: #4f46e5;
    --secondary-color: #6366f1;
    --accent-color: #0ea5e9;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-light: #94a3b8;
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-tertiary: #e2e8f0;
    --border-color: #e2e8f0;
    --shadow-light: 0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-medium: 0 10px 24px rgba(15, 23, 42, 0.10);
    --shadow-heavy: 0 22px 60px rgba(15, 23, 42, 0.18);
    --gradient-primary: linear-gradient(135deg, #4f46e5 0%, #6366f1 100%);
    --gradient-secondary: linear-gradient(135deg, #0ea5e9 0%, #4f46e5 100%);
    --gradient-bg: linear-gradient(135deg, #0f172a 0%, #1e293b 100%);

    /* Modern Effects */
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.2);
    --blur-intensity: 12px;
    --cursor-size: 20px;
}

[data-theme="dark"] {
    /* Elegant Dark Theme Colors */
    --primary-color: #818cf8;
    --secondary-color: #a5b4fc;
    --accent-color: #38bdf8;
    --text-primary: #e5e7eb;
    --text-secondary: #94a3b8;
    --text-light: #64748b;
    --bg-primary: #0b1020;
    --bg-secondary: #0f172a;
    --bg-tertiary: #111827;
    --border-color: #1f2a44;
    --shadow-light: 0 2px 8px rgba(0, 0, 0, 0.35);
    --shadow-medium: 0 10px 24px rgba(0, 0, 0, 0.45);
    --shadow-heavy: 0 26px 70px rgba(0, 0, 0, 0.55);
    --gradient-bg: linear-gradient(135deg, #0b1020 0%, #0f172a 100%);

    --glass-bg: rgba(11, 16, 32, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
}

html {
    scroll-behavior: smooth;
    font-size: 16px;
    overflow-x: hidden;
}

body {
    font-family: 'Cairo', sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--bg-primary);
    transition: all 0.3s ease;
    overflow-x: hidden;
}

/* Custom Premium Cursor */
.cursor-dot,
.cursor-outline {
    pointer-events: none;
    position: fixed;
    top: 0;
    left: 0;
    border-radius: 50%;
    z-index: 10000;
    opacity: 0;
    transform: translate(-50%, -50%);
    transition: opacity 0.3s ease, width 0.3s cubic-bezier(0.19, 1, 0.22, 1), height 0.3s cubic-bezier(0.19, 1, 0.22, 1), background-color 0.3s ease, border-radius 0.3s ease, transform 0.2s cubic-bezier(0.19, 1, 0.22, 1);
}

.cursor-dot {
    width: 6px;
    height: 6px;
    background-color: var(--primary-color);
    box-shadow: 0 0 10px var(--primary-color);
}

.cursor-outline {
    width: 36px;
    height: 36px;
    border: 1.5px solid var(--primary-color);
    background-color: transparent;
    opacity: 0.6;
}

body.cursor-active .cursor-dot {
    opacity: 1;
}

body.cursor-active .cursor-outline {
    opacity: 0.8;
}

/* Context Aware States */
.cursor-outline.hover-link {
    transform: translate(-50%, -50%) scale(0.2);
    opacity: 0;
}

.cursor-dot.hover-link {
    transform: translate(-50%, -50%) scale(2);
    background-color: var(--accent-color);
    box-shadow: 0 0 10px var(--accent-color);
}

.cursor-outline.hover-text {
    width: 3px;
    height: 24px;
    border-radius: 4px;
    background-color: var(--primary-color);
    border: none;
    transform: translate(-50%, -50%);
    opacity: 0.6;
}

.cursor-dot.hover-text {
    opacity: 0;
}

.cursor-outline.hover-image {
    transform: translate(-50%, -50%) scale(2);
    border: none;
    background-color: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.cursor-outline.hover-image::after {
    content: "عرض";
    font-size: 5px;
    color: white;
    font-weight: 700;
    text-transform: uppercase;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.cursor-outline.active {
    transform: translate(-50%, -50%) scale(0.7);
    background-color: var(--primary-color);
    opacity: 0.4;
    border-color: transparent;
}

/* Hide default cursor only when custom is active */
body.cursor-active,
body.cursor-active * {
    cursor: none !important;
}

/* Complete removal on mobile */
@media (max-width: 768px),
(pointer: coarse) {

    .cursor-dot,
    .cursor-outline {
        display: none !important;
    }

    body,
    body.cursor-active,
    body.cursor-active * {
        cursor: auto !important;
    }

    a,
    button,
    [role="button"],
    .portfolio-image {
        cursor: pointer !important;
    }
}

/* Glassmorphism Classes */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(var(--blur-intensity));
    -webkit-backdrop-filter: blur(var(--blur-intensity));
    border: 1px solid var(--glass-border);
}

/* Reading Progress Bar */
.progress-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: transparent;
    z-index: 1001;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    width: 0%;
    transition: width 0.1s ease;
    box-shadow: 0 0 10px var(--primary-color);
}

/* Scroll to top */
.scroll-btn {
    position: fixed;
    bottom: 30px;
    left: 30px;
    /* Arabic RTL compatibility */
    width: 50px;
    height: 50px;
    background: var(--gradient-primary);
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-medium);
}

.scroll-btn.show {
    opacity: 1;
    visibility: visible;
}

.scroll-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ===== NAVIGATION ===== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: transparent;
    backdrop-filter: blur(10px);
    border-bottom: 1px solid transparent;
    z-index: 1000;
    transition: all 0.3s ease;
}

[data-theme="dark"] .navbar {
    background: transparent;
}

.navbar.scrolled {
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: var(--shadow-medium);
    border-bottom: 1px solid var(--border-color);
}

[data-theme="dark"] .navbar.scrolled {
    background: rgba(11, 16, 32, 0.70);
}

.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    max-width: 1200px;
    margin: 0 auto;
}

.nav-logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: none;
}

.nav-menu {
    display: flex;
    list-style: none;
    gap: 2rem;
}

.nav-link {
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
    position: relative;
}

.nav-link::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--gradient-primary);
    transition: width 0.3s ease;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 100%;
}

.nav-link:hover {
    color: var(--primary-color);
}

/* Transparent navbar on top: ensure white contrast over hero */
.navbar:not(.scrolled) .nav-link {
    color: #ffffff;
}

.navbar:not(.scrolled) .nav-logo,
.navbar:not(.scrolled) .theme-toggle {
    color: #ffffff;
}

.navbar:not(.scrolled) .bar {
    background: #ffffff;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    cursor: pointer;
    gap: 4px;
}

.bar {
    width: 25px;
    height: 3px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.theme-toggle {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    background: var(--bg-tertiary);
    transform: rotate(180deg);
}

/* ===== HERO SECTION ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    background: var(--gradient-bg);
    overflow: hidden;
}

.hero-container {
    text-align: center;
    z-index: 2;
    position: relative;
}

.hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.hero-image {
    margin-bottom: 2rem;
}

.profile-image {
    position: relative;
    width: 200px;
    height: 200px;
    margin: 0 auto;
    border-radius: 50%;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: var(--shadow-heavy);
}

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

.profile-image:hover img {
    transform: scale(1.1);
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, rgba(14, 165, 233, 0.3), rgba(124, 77, 255, 0.3));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.profile-image:hover .image-overlay {
    opacity: 1;
}

.hero-title {
    font-size: 3.5rem;
    font-weight: 900;
    color: white;
    margin-bottom: 1rem;
    line-height: 1.2;
}

.title-line {
    display: block;
    font-size: 1.5rem;
    font-weight: 400;
    opacity: 0.9;
}

.title-name {
    display: block;
    background: linear-gradient(45deg, #ffffff, #e0e7ff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-subtitle {
    font-size: 1.25rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 2rem;
    border: none;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn-primary {
    background: var(--gradient-primary);
    color: #ffffff;
    border: 0;
    box-shadow: 0 10px 25px rgba(124, 77, 255, 0.25), 0 6px 16px rgba(0, 229, 255, 0.2);
}

.btn-primary:hover {
    transform: translateY(-3px) scale(1.01);
    box-shadow: 0 18px 40px rgba(124, 77, 255, 0.35), 0 10px 24px rgba(0, 229, 255, 0.28);
}

.btn-secondary {
    background: linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
        var(--gradient-primary) border-box;
    color: var(--text-primary);
    border: 2px solid transparent;
}

.btn-secondary:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

/* Hero-specific button contrast */
.hero .btn-secondary {
    background: transparent;
    color: #ffffff;
    border: 2px solid rgba(255, 255, 255, 0.55);
}

.hero .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.12);
}

.hero-scroll {
    position: absolute;
    bottom: 0.5rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

/* Enhance hero scroll indicator and button focus */
.scroll-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.25);
    padding: 0.6rem 1rem;
    border-radius: 9999px;
    cursor: pointer;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    user-select: none;
    transition: transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
    color: rgba(255, 255, 255, 0.9);
    font-size: 0.9rem;
}

.scroll-indicator:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateY(-2px);
}

.scroll-indicator:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
}

.scroll-arrow {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.35);
    background: rgba(255, 255, 255, 0.06);
}

.scroll-arrow i {
    color: #ffffff;
    font-size: 0.95rem;
    animation: bounce 2s infinite;
}

.btn:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.35);
}

@media (min-width: 769px) {
    .hero .btn {
        min-width: 200px;
    }
}

.hero-bg {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    overflow: hidden;
}

.bg-shape {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    animation: float 6s ease-in-out infinite;
}

.shape-1 {
    width: 300px;
    height: 300px;
    top: 10%;
    left: 10%;
    animation-delay: 0s;
}

.shape-2 {
    width: 200px;
    height: 200px;
    top: 60%;
    right: 10%;
    animation-delay: 2s;
}

.shape-3 {
    width: 150px;
    height: 150px;
    bottom: 20%;
    left: 60%;
    animation-delay: 4s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* ===== SECTIONS ===== */
section {
    padding: 5rem 0;
    scroll-margin-top: 90px;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-title {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
    position: relative;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 5px;
    background: var(--gradient-primary);
    border-radius: 8px;
}

.section-subtitle {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
}

/* ===== CV SECTION ===== */
.cv-section {
    background: var(--bg-secondary);
}

.personal-info {
    margin-bottom: 4rem;
}

.info-card {
    background: var(--bg-primary);
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
}

.info-card h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: 12px;
    transition: all 0.3s ease;
}

.info-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-light);
}

.info-item i {
    font-size: 1.2rem;
    color: var(--primary-color);
    width: 24px;
    text-align: center;
}

.info-item div {
    flex: 1;
}

.info-label {
    display: block;
    font-size: 0.9rem;
    color: var(--text-light);
    margin-bottom: 0.25rem;
}

.info-value {
    display: block;
    font-weight: 600;
    color: var(--text-primary);
}

/* ===== TIMELINE ===== */
.timeline-container {
    margin-bottom: 4rem;
}

.timeline-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 3rem;
}

.timeline {
    position: relative;
    max-width: 800px;
    margin: 0 auto;
}

.timeline::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 2px;
    height: 100%;
    background: var(--gradient-primary);
}

.timeline-item {
    position: relative;
    margin-bottom: 3rem;
    width: 50%;
}

.timeline-item:nth-child(odd) {
    left: 0;
    padding-right: 2rem;
}

.timeline-item:nth-child(even) {
    left: 50%;
    padding-left: 2rem;
}

.timeline-dot {
    position: absolute;
    top: 0;
    width: 16px;
    height: 16px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 4px solid var(--bg-primary);
    box-shadow: var(--shadow-medium);
}

.timeline-item:nth-child(odd) .timeline-dot {
    right: -8px;
}

.timeline-item:nth-child(even) .timeline-dot {
    left: -8px;
}

.timeline-content {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.timeline-content:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.timeline-content h4 {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.timeline-content p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* RTL: Fix timeline alignment in rtl layouts */
html[dir="rtl"] .timeline-item:nth-child(odd) {
    left: 50%;
    padding-left: 2rem;
    padding-right: 0;
}

html[dir="rtl"] .timeline-item:nth-child(even) {
    left: 0;
    padding-right: 2rem;
    padding-left: 0;
}

html[dir="rtl"] .timeline-item:nth-child(odd) .timeline-dot {
    left: -8px;
    right: auto;
}

html[dir="rtl"] .timeline-item:nth-child(even) .timeline-dot {
    right: -8px;
    left: auto;
}

/* RTL: Mobile tweaks for timeline */
@media (max-width: 768px) {
    html[dir="rtl"] .timeline::before {
        right: 20px;
        left: auto;
    }

    html[dir="rtl"] .timeline-item {
        padding-right: 3rem !important;
        padding-left: 0 !important;
    }

    html[dir="rtl"] .timeline-dot {
        right: 12px !important;
        left: auto !important;
    }
}

/* ===== SKILLS ===== */
.skills-container {
    margin-bottom: 4rem;
}

.skills-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 3rem;
}

/* ===== SKILLS: Modern, space-efficient redesign ===== */
/* Cards grid: fit more columns and pack tightly */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    grid-auto-flow: dense;
}

/* Category card: subtle gradient border + lighter chrome */
.skill-category {
    padding: 2rem;
    border: 1px solid transparent;
    background: linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
        linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(14, 165, 233, 0.22)) border-box;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

/* Title alignment with improved spacing */
.skill-category h4 {
    margin-bottom: 1.25rem;
}

/* Skills list: denser columns and tighter gaps to use space */
.skills-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

/* Skill item: pill card layout with compact header and progress */
.skill-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.65rem 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid transparent;
    background: linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
        linear-gradient(135deg, color-mix(in oklab, var(--icon-color, var(--primary-color)) 28%, transparent), rgba(99, 102, 241, 0.15)) border-box;
    box-shadow: var(--shadow-light);
}

.skill-item:hover,
.skill-item:focus-within {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
}

/* Compact, consistent icon sizing */
.skill-icon {
    width: 34px;
    height: 34px;
    background: color-mix(in oklab, var(--icon-color, var(--primary-color)) 14%, transparent);
    border: 2px solid color-mix(in oklab, var(--icon-color, var(--primary-color)) 45%, transparent);
}

/* Title row tweaks */
.skill-title {
    gap: 0.35rem;
}

.skill-name {
    font-weight: 800;
}

.skill-level-badge {
    font-weight: 700;
    letter-spacing: 0.2px;
}

/* Experience chip: smaller and tighter */
.skill-experience {
    font-size: 0.8rem;
    opacity: 0.9;
}

/* Progress meter spans full row below header */
.skill-meter {
    grid-column: 1 / -1;
    margin-top: 0.4rem;
}

.skill-bar {
    height: 8px;
    background: color-mix(in oklab, var(--icon-color, var(--bg-tertiary)) 10%, var(--bg-tertiary));
}

.skill-bar::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0));
}

.skill-bar-fill {
    box-shadow: 0 6px 16px color-mix(in oklab, var(--icon-color, rgba(99, 102, 241, 1)) 28%, transparent);
}

/* Dark mode refinements for new surfaces */
[data-theme="dark"] .skill-category {
    background: linear-gradient(#0f172a, #0f172a) padding-box,
        linear-gradient(135deg, rgba(129, 140, 248, 0.25), rgba(56, 189, 248, 0.25)) border-box;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .skill-item {
    background: linear-gradient(#0f172a, #0f172a) padding-box,
        linear-gradient(135deg, color-mix(in oklab, var(--icon-color, var(--primary-color)) 32%, transparent), rgba(129, 140, 248, 0.18)) border-box;
}

/* Wide screens: squeeze more items to reduce dead space */
@media (min-width: 1400px) {
    .skills-list {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* top accent bar */
.skill-category::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 15px 15px 0 0;
    opacity: 0.6;
}

.skill-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem 1rem;
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-secondary);
    box-shadow: var(--shadow-light);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.skill-item:hover,
.skill-item:focus-within {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    border-color: color-mix(in oklab, var(--icon-color, rgba(99, 102, 241, 1)) 35%, transparent);
}

/* header: icon + title + badge */
.skill-item-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.skill-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: color-mix(in oklab, var(--icon-color, var(--primary-color)) 18%, transparent);
    border: 2px solid color-mix(in oklab, var(--icon-color, var(--primary-color)) 55%, transparent);
}

.skill-icon i {
    font-size: 1rem;
    color: var(--icon-color, var(--primary-color));
}

.skill-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.skill-name {
    font-weight: 800;
    color: var(--text-primary);
}

.skill-level-badge {
    font-size: 0.75rem;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    border: 1px solid;
    line-height: 1.1;
    translate: 0 1px;
}

.skill-level-badge.level-beginner {
    color: #2563eb;
    border-color: rgba(37, 99, 235, 0.35);
    background: rgba(37, 99, 235, 0.08);
}

.skill-level-badge.level-intermediate {
    color: #16a34a;
    border-color: rgba(22, 163, 74, 0.35);
    background: rgba(22, 163, 74, 0.08);
}

.skill-level-badge.level-advanced {
    color: #a855f7;
    border-color: rgba(168, 85, 247, 0.35);
    background: rgba(168, 85, 247, 0.08);
}

.skill-level-badge.level-expert {
    color: #ea580c;
    border-color: rgba(234, 88, 12, 0.35);
    background: rgba(234, 88, 12, 0.08);
}

.skill-experience {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: 9999px;
    padding: 0.15rem 0.6rem;
    height: fit-content;
}

.skill-meter {
    grid-column: 1 / -1;
}

.skill-bar {
    position: relative;
    height: 12px;
    background: color-mix(in oklab, var(--icon-color, var(--bg-tertiary)) 12%, var(--bg-tertiary));
    border-radius: 9999px;
    overflow: hidden;
}

.skill-bar-fill {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 0%;
    background: linear-gradient(90deg, color-mix(in oklab, var(--icon-color, var(--primary-color)) 80%, transparent), var(--secondary-color));
    border-radius: 9999px;
    transition: width 1s ease;
    box-shadow: 0 0 0 rgba(99, 102, 241, 0);
}

.skill-item:hover .skill-bar-fill {
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.25);
}

.skill-level-label {
    display: inline-block;
    font-size: 0.75rem;
    color: var(--text-light);
    margin-top: 0.35rem;
}

/* Dark mode tweaks */
[data-theme="dark"] .skill-item {
    background: #0f172a;
}

[data-theme="dark"] .skill-level-label {
    color: var(--text-secondary);
}

/* ===== LANGUAGES ===== */
.languages-container {
    margin-bottom: 2rem;
}

.languages-title {
    font-size: 2rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 3rem;
}

.languages-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 600px;
    margin: 0 auto;
}

.language-item {
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
}

.language-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.language-name {
    font-weight: 600;
    color: var(--text-primary);
}

.language-level {
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.language-progress {
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--gradient-primary);
    border-radius: 4px;
    transition: width 1s ease;
}

/* ===== SERVICES SECTION ===== */
.services-section {
    background: var(--bg-secondary);
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.5rem;
}

.service-card {
    background: var(--bg-primary);
    padding: 1.5rem;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    z-index: 1;
}

.service-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 0 0 0 100%;
    z-index: -1;
    opacity: 0.1;
    transition: all 0.4s ease;
}

.service-card:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
    border-color: var(--primary-color);
}

.service-card:hover::before {
    transform: scale(15);
    opacity: 0.05;
}

.service-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    position: relative;
    transition: all 0.4s ease;
}

.service-icon i {
    font-size: 1.3rem;
    color: var(--primary-color);
    transition: all 0.4s ease;
}

.service-card:hover .service-icon {
    background: var(--gradient-primary);
    border-color: transparent;
    transform: rotateY(360deg);
}

.service-card:hover .service-icon i {
    color: white;
}

.service-card h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.service-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.service-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
    transition: all 0.3s ease;
}

.service-list li:hover {
    color: var(--text-primary);
    transform: translateX(-5px); /* Right to Left move: actually since direction is RTL, translateX(-5px) moves right. For English (LTR) it is Left. Let's make it standard */
}

/* Because the site is RTL */
html[dir="rtl"] .service-list li:hover {
    transform: translateX(-5px); 
}

.service-list li i {
    color: var(--primary-color);
    font-size: 0.8rem;
}

[data-theme="dark"] .service-card {
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(10px);
}

/* ===== PORTFOLIO SECTION ===== */
.portfolio-section {
    background: var(--bg-primary);
}

.filter-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 3rem;
}

.filter-btn {
    background: transparent;
    border: 2px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-btn:hover,
.filter-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.portfolio-item {
    background: var(--bg-primary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
    cursor: pointer;
}

.portfolio-item:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-heavy);
}

.portfolio-image {
    position: relative;
    height: 250px;
    overflow: hidden;
}

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

.portfolio-item:hover .portfolio-image img {
    transform: scale(1.1);
}

.portfolio-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(15, 23, 42, 0.85), rgba(30, 41, 59, 0.85));
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.portfolio-item:hover .portfolio-overlay {
    opacity: 1;
}

.portfolio-overlay i {
    color: white;
    font-size: 2rem;
}

.portfolio-content {
    padding: 1.5rem;
}

.portfolio-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.portfolio-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.portfolio-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.portfolio-tag {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

/* ===== CONTACT SECTION ===== */
.contact-section {
    background: var(--bg-secondary);
}

.contact-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 3rem;
    max-width: 1000px;
    margin: 0 auto;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-primary);
    padding: 2rem;
    border-radius: 15px;
    box-shadow: var(--shadow-medium);
    border: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
    transition: all 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-heavy);
}

.contact-icon {
    width: 60px;
    height: 60px;
    background: var(--gradient-primary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
}

.contact-details h4 {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.contact-details p {
    color: var(--text-secondary);
}

.social-links h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2rem;
    text-align: center;
}

.social-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 2rem;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-primary);
    padding: 1rem;
    border-radius: 12px;
    text-decoration: none;
    color: var(--text-primary);
    box-shadow: var(--shadow-light);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

.social-link:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    color: var(--primary-color);
}

.social-link i {
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

.cv-download {
    text-align: center;
}

/* ===== FOOTER ===== */
.footer {
    background: var(--bg-tertiary);
    padding: 2rem 0;
    text-align: center;
    border-top: 1px solid var(--border-color);
}

.footer-content p {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.footer-content i {
    color: #e74c3c;
    margin: 0 0.25rem;
}

/* ===== MODAL ===== */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(5px);
}

.modal-content {
    background: var(--bg-primary);
    margin: 5% auto;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    animation: modalSlideIn 0.3s ease;
    padding: 0;
    border-radius: 20px;
    width: 90%;
    max-width: 800px;
    max-height: 80vh;
    overflow: hidden;
    position: relative;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    color: white;
    font-size: 2rem;
    font-weight: bold;
    cursor: pointer;
    z-index: 10;
    background: rgba(0, 0, 0, 0.5);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.modal-close:hover {
    background: rgba(0, 0, 0, 0.7);
    transform: rotate(90deg);
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    height: 500px;
}

.modal-image {
    background: var(--bg-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.modal-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.modal-info {
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.modal-info h3 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 1rem;
}

.modal-info p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.modal-tag {
    background: var(--gradient-primary);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
}

.modal-links {
    display: flex;
    gap: 1rem;
}

.modal-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--gradient-primary);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.3s ease;
}

.modal-link:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        left: -100%;
        top: 70px;
        flex-direction: column;
        background: var(--bg-primary);
        width: 100%;
        text-align: center;
        transition: 0.3s;
        box-shadow: var(--shadow-medium);
        padding: 2rem 0;
    }

    .nav-menu.active {
        left: 0;
    }

    .nav-toggle {
        display: flex;
    }

    .nav-toggle.active .bar:nth-child(2) {
        opacity: 0;
    }

    .nav-toggle.active .bar:nth-child(1) {
        transform: translateY(7px) rotate(45deg);
    }

    .nav-toggle.active .bar:nth-child(3) {
        transform: translateY(-7px) rotate(-45deg);
    }

    .hero-title {
        font-size: 2.5rem;
    }

    .title-line {
        font-size: 1.2rem;
    }

    .hero-subtitle {
        font-size: 1rem;
    }

    .hero-buttons {
        flex-direction: column;
        align-items: center;
    }

    .btn {
        width: 100%;
        max-width: 300px;
    }

    .section-title {
        font-size: 2rem;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .timeline::before {
        left: 20px;
    }

    .timeline-item {
        width: 100%;
        left: 0 !important;
        padding-left: 3rem !important;
        padding-right: 0 !important;
    }

    .timeline-dot {
        left: 12px !important;
        right: auto !important;
    }

    .skills-grid {
        grid-template-columns: 1fr;
    }

    /* stack skill items in one column on small screens */
    .skills-list {
        grid-template-columns: 1fr;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
    }

    .contact-content {
        grid-template-columns: 1fr;
    }

    .modal-body {
        grid-template-columns: 1fr;
        height: auto;
    }

    .modal-image {
        height: 250px;
    }

    .social-grid {
        grid-template-columns: 1fr;
    }

    .filter-container {
        flex-direction: column;
        align-items: center;
    }

    .filter-btn {
        width: 200px;
        text-align: center;
    }
}

@media (max-width: 768px) {
    html[dir="rtl"] .nav-menu {
        right: -100%;
        left: auto;
    }

    html[dir="rtl"] .nav-menu.active {
        right: 0;
        left: auto;
    }
}

@media (max-width: 768px) {
    .nav-menu .nav-link {
        color: var(--text-primary) !important;
    }
}


@media (max-width: 480px) {
    .container {
        padding: 0 15px;
    }

    .nav-container {
        padding: 1rem 1.5rem;
    }

    .hero-title {
        font-size: 2rem;
    }

    .profile-image {
        width: 150px;
        height: 150px;
    }

    .section-title {
        font-size: 1.8rem;
    }

    .timeline-title,
    .skills-title,
    .languages-title {
        font-size: 1.5rem;
    }

    .info-card,
    .skill-category,
    .language-item,
    .contact-item {
        padding: 1.5rem;
    }

    .modal-content {
        width: 95%;
        margin: 10% auto;
    }

    .modal-info {
        padding: 1.5rem;
    }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes fadeInLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.fade-in-up {
    animation: fadeInUp 0.6s ease forwards;
}

.fade-in-left {
    animation: fadeInLeft 0.6s ease forwards;
}

.fade-in-right {
    animation: fadeInRight 0.6s ease forwards;
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.hidden {
    display: none;
}

.visible {
    display: block;
}

/* ===== SMOOTH TRANSITIONS ===== */
* {
    transition: color 0.3s ease, background-color 0.3s ease, border-color 0.3s ease;
}

/* RTL: Robust positioning using right offsets to ensure proper alternation */
html[dir="rtl"] .timeline-item {
    left: auto;
}

html[dir="rtl"] .timeline-item:nth-child(odd) {
    right: 0;
    padding-left: 2rem;
    padding-right: 0;
}

html[dir="rtl"] .timeline-item:nth-child(even) {
    right: 50%;
    padding-right: 2rem;
    padding-left: 0;
}

html[dir="rtl"] .timeline-item:nth-child(odd) .timeline-dot {
    left: -8px;
    right: auto;
}

html[dir="rtl"] .timeline-item:nth-child(even) .timeline-dot {
    right: -8px;
    left: auto;
}

/* RTL: Mobile alignment to keep the line and dots on the right */
@media (max-width: 768px) {
    html[dir="rtl"] .timeline::before {
        right: 20px;
        left: auto;
    }

    html[dir="rtl"] .timeline-item {
        right: 0;
        left: auto !important;
        padding-right: 3rem !important;
        padding-left: 0 !important;
    }

    html[dir="rtl"] .timeline-dot {
        right: 12px !important;
        left: auto !important;
    }
}

/* Responsive media to prevent overflow on small screens */
img,
video,
iframe {
    max-width: 100%;
    height: auto;
    display: block;
}

/* Modern viewport units for mobile browsers */
@supports (height: 100svh) {
    .hero {
        min-height: 100svh;
    }
}

@supports (height: 100dvh) {
    .hero {
        min-height: 100dvh;
    }
}

/* Mobile: unify timeline layout to single column and correct RTL/LTR positions */
@media (max-width: 768px) {
    .timeline {
        max-width: 100%;
        margin: 0 auto;
    }

    .timeline::before {
        left: 20px !important;
        right: auto !important;
    }

    html[dir="rtl"] .timeline::before {
        right: 20px !important;
        left: auto !important;
    }

    .timeline-item,
    .timeline-item:nth-child(odd),
    .timeline-item:nth-child(even) {
        width: 100% !important;
        left: 0 !important;
        right: 0 !important;
        padding-left: 3rem !important;
        padding-right: 0 !important;
    }

    html[dir="rtl"] .timeline-item,
    html[dir="rtl"] .timeline-item:nth-child(odd),
    html[dir="rtl"] .timeline-item:nth-child(even) {
        padding-right: 3rem !important;
        padding-left: 0 !important;
    }

    .timeline-dot {
        left: 12px !important;
        right: auto !important;
    }

    html[dir="rtl"] .timeline-dot {
        right: 12px !important;
        left: auto !important;
    }
}

/* Mobile improvements for Portfolio section */
@media (max-width: 768px) {
    .portfolio-section .filter-container {
        flex-direction: row !important;
        justify-content: flex-start;
        flex-wrap: nowrap !important;
        gap: 0.5rem;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-inline: 1rem;
        margin-inline: -1rem;
        scroll-snap-type: x mandatory;
    }

    .portfolio-section .filter-container::-webkit-scrollbar {
        display: none;
    }

    .portfolio-section .filter-btn {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 0.6rem 1rem;
        font-size: 0.9rem;
        border-radius: 9999px;
        width: auto !important;
        text-align: center;
        scroll-snap-align: start;
    }

    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .portfolio-item {
        border-radius: 12px;
    }

    .portfolio-image {
        height: 180px;
    }

    .portfolio-content {
        padding: 1rem;
    }

    .portfolio-title {
        font-size: 1rem;
    }

    .portfolio-description {
        font-size: 0.9rem;
    }
}

/* ===== SKILLS OVERRIDES: ensure new layout wins ===== */
.skills-container .skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    grid-auto-flow: dense;
}

.skills-container .skill-category {
    padding: 2rem;
    border: 1px solid transparent;
    background: linear-gradient(var(--bg-primary), var(--bg-primary)) padding-box,
        linear-gradient(135deg, rgba(99, 102, 241, 0.22), rgba(14, 165, 233, 0.22)) border-box;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.skills-container .skill-category h4 {
    margin-bottom: 1.25rem;
}

.skills-container .skills-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 0.85rem;
}

.skills-container .skill-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.65rem 0.85rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    border: 1px solid transparent;
    background: linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
        linear-gradient(135deg, color-mix(in oklab, var(--icon-color, var(--primary-color)) 28%, transparent), rgba(99, 102, 241, 0.15)) border-box;
    box-shadow: var(--shadow-light);
}

.skills-container .skill-item:hover,
.skills-container .skill-item:focus-within {
    transform: translateY(-3px);
    box-shadow: var(--shadow-medium);
    border-color: transparent;
}

.skills-container .skill-icon {
    width: 34px;
    height: 34px;
    background: color-mix(in oklab, var(--icon-color, var(--primary-color)) 14%, transparent);
    border: 2px solid color-mix(in oklab, var(--icon-color, var(--primary-color)) 45%, transparent);
}

.skills-container .skill-meter {
    grid-column: 1 / -1;
    margin-top: 0.4rem;
}

.skills-container .skill-bar {
    height: 8px;
    background: color-mix(in oklab, var(--icon-color, var(--bg-tertiary)) 10%, var(--bg-tertiary));
}

.skills-container .skill-bar-fill {
    box-shadow: 0 6px 16px color-mix(in oklab, var(--icon-color, rgba(99, 102, 241, 1)) 28%, transparent);
}

/* Dark mode parity for overrides */
[data-theme="dark"] .skills-container .skill-category {
    background: linear-gradient(#0f172a, #0f172a) padding-box,
        linear-gradient(135deg, rgba(129, 140, 248, 0.25), rgba(56, 189, 248, 0.25)) border-box;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

[data-theme="dark"] .skills-container .skill-item {
    background: linear-gradient(#0f172a, #0f172a) padding-box,
        linear-gradient(135deg, color-mix(in oklab, var(--icon-color, var(--primary-color)) 32%, transparent), rgba(129, 140, 248, 0.18)) border-box;
}

@media (min-width: 1400px) {
    .skills-container .skills-list {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    }
}

/* ===== SKILLS: minor fixes for accent and mobile ===== */
.skills-container .skill-category {
    position: relative;
    border-radius: 15px;
}

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

    .skills-container .skills-list {
        grid-template-columns: 1fr;
    }
}

/* ===== SKILLS: Circular cards redesign ===== */
@property --percent {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
}

.skills-container .skills-list {
    /* ensure grid for new cards too */
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.skill-card {
    position: relative;
    display: grid;
    grid-template-rows: auto auto;
    align-items: center;
    justify-items: center;
    text-align: center;
    padding: 1.25rem;
    border-radius: 16px;
    border: 1px solid var(--border-color);
    background: linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
        linear-gradient(135deg, rgba(99, 102, 241, 0.18), rgba(14, 165, 233, 0.18)) border-box;
    box-shadow: var(--shadow-light);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.skill-card:hover,
.skill-card:focus-within {
    transform: translateY(-4px);
    box-shadow: var(--shadow-medium);
    border-color: color-mix(in oklab, var(--icon-color, var(--primary-color)) 35%, transparent);
}

.skill-visual {
    --percent: 0;
    /* will be animated via JS */
    --ring-size: 72px;
    --ring-thickness: 7px;
    position: relative;
    width: var(--ring-size);
    height: var(--ring-size);
    display: grid;
    place-items: center;
    margin-bottom: 0.5rem;
}

.skill-ring {
    position: relative;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    --percent: 0;
    background: conic-gradient(var(--icon-color, var(--primary-color)) 0% calc(var(--percent) * 1%),
            var(--bg-tertiary) calc(var(--percent) * 1%) 100%);
    transition: --percent 0.9s ease;
}

.skill-ring::before {
    content: '';
    position: absolute;
    inset: var(--ring-thickness);
    border-radius: 50%;
    background: var(--bg-secondary);
    box-shadow: inset 0 0 0 1px var(--border-color);
}

.skill-ring-inner {
    position: absolute;
    inset: calc(var(--ring-thickness) + 6px);
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: transparent;
}

.skill-ring-inner i {
    font-size: 0.95rem;
    color: var(--icon-color, var(--primary-color));
}

.skill-percent {
    position: static;
    margin-top: 0.2rem;
    display: inline-block;
    font-weight: 700;
    font-size: 0.8rem;
    color: var(--text-primary);
}

.skill-meta {
    margin-top: 0.5rem;
    display: grid;
    gap: 0.25rem;
    justify-items: center;
}

.skill-meta .skill-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
    line-height: 1.2;
}

.skill-meta .skill-level-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.4rem;
    border-radius: 9999px;
    font-weight: 600;
    line-height: 1;
}

.skill-meta .skill-years {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

[data-theme="dark"] .skill-card {
    background: linear-gradient(#0f172a, #0f172a) padding-box,
        linear-gradient(135deg, rgba(129, 140, 248, 0.22), rgba(56, 189, 248, 0.22)) border-box;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
}

@media (max-width: 768px) {
    .skills-container .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 180px));
        gap: 0.7rem;
    }

    .skill-card {
        max-width: 180px;
        padding: 0.7rem;
    }

    .skill-visual {
        --ring-size: 60px;
        --ring-thickness: 6px;
    }

    .skill-ring-inner i {
        font-size: 0.85rem;
    }

    .skill-meta .skill-name {
        font-size: 0.8rem;
    }

    .skill-meta .skill-level-badge {
        font-size: 0.6rem;
    }

    .skill-meta .skill-years {
        font-size: 0.65rem;
    }
}

/* ===== SKILLS LAYOUT: flatten categories to a single dense grid to remove whitespace ===== */
.skills-container .skills-grid {
    grid-auto-flow: dense;
}

/* Make category and list containers transparent to the grid so all cards flow in one grid */
.skills-container .skill-category {
    display: contents;
}

.skills-container .skills-list {
    display: contents !important;
}

/* Keep category titles as full-width separators inside the unified grid */
.skills-container .skill-category>h4 {
    grid-column: 1 / -1;
    align-self: end;
    margin: 0.5rem 0 0.75rem;
    padding-top: 0.75rem;
    font-weight: 800;
    color: var(--text-primary);
    border-top: 1px dashed var(--border-color);
}

/* Fine-tune icon alignment in titles */
.skills-container .skill-category>h4 i {
    margin-inline-start: 0.25rem;
}

/* ===== SKILLS: Ultra-compact space-efficient design ===== */
.skills-container .skills-grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 240px));
    justify-content: center;
    justify-items: center;
    gap: 0.9rem;
    margin-bottom: 2rem;
}

.skill-card {
    width: 100%;
    max-width: 240px;
    justify-self: center;
    padding: 0.9rem;
    border-radius: 12px;
    background: linear-gradient(var(--bg-secondary), var(--bg-secondary)) padding-box,
        linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(14, 165, 233, 0.15)) border-box;
    box-shadow: 0 6px 16px rgba(15, 23, 42, 0.06);
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.skill-card:hover,
.skill-card:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
    border-color: color-mix(in oklab, var(--icon-color, var(--primary-color)) 30%, transparent);
}

@media (max-width: 768px) {
    .skills-container .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
        gap: 1rem;
    }

    .skill-card {
        max-width: 360px;
    }
}

@media (max-width: 480px) {
    .skills-container .skills-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 160px));
        gap: 0.6rem;
    }

    .skill-card {
        max-width: 160px;
        padding: 0.6rem;
    }

    .skill-visual {
        --ring-size: 52px;
        --ring-thickness: 5px;
    }

    .skill-ring-inner i {
        font-size: 0.75rem;
    }

    .skill-meta .skill-name {
        font-size: 0.75rem;
    }

    .skill-meta .skill-level-badge {
        font-size: 0.55rem;
        padding: 0.05rem 0.3rem;
    }

    .skill-meta .skill-years {
        font-size: 0.6rem;
    }
}

/* ===== SKILLS: Compact section spacing ===== */
.cv-section .skills-container {
    padding-top: clamp(1rem, 3vw, 2.5rem);
    margin-bottom: 2rem;
}

.skills-title {
    font-size: 1.6rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
    margin-bottom: 1.5rem;
}

@media (max-width: 480px) {
    .cv-section .skills-container {
        padding-top: 1rem;
        margin-bottom: 1.5rem;
    }

    .skills-title {
        font-size: 1.4rem;
        margin-bottom: 1.2rem;
    }
}


/* ===== COMMENTS SECTION ===== */
.comments-section {
    padding: 8rem 0;
    background: linear-gradient(135deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
    position: relative;
    overflow: hidden;
}

.comments-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: var(--gradient-primary);
    box-shadow: 0 2px 20px rgba(79, 70, 229, 0.3);
}

.comments-section::after {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(79, 70, 229, 0.05) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 20s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0px) rotate(0deg);
    }

    50% {
        transform: translateY(-20px) rotate(180deg);
    }
}

/* Enhanced Section Header */
.comments-section .section-title {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.title-icon {
    font-size: 2.5rem;
    animation: pulse 2s ease-in-out infinite;
    filter: drop-shadow(0 4px 8px rgba(79, 70, 229, 0.3));
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

.title-decoration {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%);
    width: 100px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
    box-shadow: 0 2px 10px rgba(79, 70, 229, 0.4);
}

.section-stats {
    display: flex;
    justify-content: center;
    gap: 3rem;
    margin-top: 2rem;
}

.stat-item {
    text-align: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 16px;
    border: 1px solid rgba(226, 232, 240, 0.3);
    box-shadow:
        0 8px 25px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    min-width: 120px;
}

[data-theme="dark"] .stat-item {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(31, 42, 68, 0.5);
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(129, 140, 248, 0.1);
}

.stat-item:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow:
        0 15px 35px rgba(15, 23, 42, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.stat-item:nth-child(2):hover {
    box-shadow:
        0 15px 35px rgba(255, 107, 107, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 107, 107, 0.3);
}

.stat-item:nth-child(3):hover {
    box-shadow:
        0 15px 35px rgba(78, 205, 196, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
    border-color: rgba(78, 205, 196, 0.3);
}

.stat-item:nth-child(2) .stat-number {
    color: #FF6B6B;
    text-shadow: 0 2px 4px rgba(255, 107, 107, 0.3);
}

.stat-item:nth-child(3) .stat-number {
    color: #4ECDC4;
    text-shadow: 0 2px 4px rgba(78, 205, 196, 0.3);
}

.stat-number {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 4px rgba(79, 70, 229, 0.2);
}

.stat-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Comment Form */
.comment-form-container {
    margin-bottom: 5rem;
    position: relative;
    z-index: 2;
}

.comment-form {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    padding: 3rem;
    border-radius: 24px;
    box-shadow:
        0 25px 50px rgba(15, 23, 42, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(226, 232, 240, 0.3);
    max-width: 900px;
    margin: 0 auto;
    position: relative;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] .comment-form {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(31, 42, 68, 0.5);
    box-shadow:
        0 25px 50px rgba(0, 0, 0, 0.3),
        0 0 0 1px rgba(129, 140, 248, 0.1),
        inset 0 1px 0 rgba(129, 140, 248, 0.1);
}

.comment-form::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--gradient-primary);
    border-radius: 24px 24px 0 0;
}

.comment-form:hover {
    transform: translateY(-5px);
    box-shadow:
        0 35px 70px rgba(15, 23, 42, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.comment-form .form-group {
    margin-bottom: 1.5rem;
}

.comment-form label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    font-weight: 700;
    color: var(--text-primary);
    font-size: 1rem;
    position: relative;
}

.comment-form label::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--primary-color);
    border-radius: 50%;
    box-shadow: 0 0 10px rgba(79, 70, 229, 0.5);
}

.comment-form input,
.comment-form textarea {
    width: 100%;
    padding: 1.25rem 1.5rem;
    border: 2px solid transparent;
    border-radius: 16px;
    background: rgba(248, 250, 252, 0.8);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(10px);
    box-shadow:
        inset 0 2px 4px rgba(15, 23, 42, 0.06),
        0 1px 3px rgba(15, 23, 42, 0.1);
}

[data-theme="dark"] .comment-form input,
[data-theme="dark"] .comment-form textarea {
    background: rgba(17, 24, 39, 0.8);
    box-shadow:
        inset 0 2px 4px rgba(0, 0, 0, 0.2),
        0 1px 3px rgba(0, 0, 0, 0.3);
}

.comment-form input:focus,
.comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    background: rgba(255, 255, 255, 0.95);
    box-shadow:
        0 0 0 4px rgba(79, 70, 229, 0.15),
        0 10px 25px rgba(79, 70, 229, 0.1),
        inset 0 2px 4px rgba(15, 23, 42, 0.06);
    transform: translateY(-2px) scale(1.02);
}

[data-theme="dark"] .comment-form input:focus,
[data-theme="dark"] .comment-form textarea:focus {
    background: rgba(17, 24, 39, 0.95);
    box-shadow:
        0 0 0 4px rgba(129, 140, 248, 0.2),
        0 10px 25px rgba(129, 140, 248, 0.15),
        inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

.comment-form textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.6;
}

.char-counter {
    text-align: right;
    font-size: 0.875rem;
    color: var(--text-light);
    margin-top: 0.75rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    background: rgba(79, 70, 229, 0.05);
    border-radius: 8px;
    border: 1px solid rgba(79, 70, 229, 0.1);
}

.comment-submit {
    background: var(--gradient-primary);
    color: white;
    border: none;
    padding: 1.25rem 3rem;
    border-radius: 16px;
    font-weight: 700;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 2rem auto 0;
    position: relative;
    overflow: hidden;
    box-shadow:
        0 10px 25px rgba(79, 70, 229, 0.3),
        0 5px 10px rgba(79, 70, 229, 0.2);
}

.comment-submit::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.6s ease;
}

.comment-submit:hover::before {
    left: 100%;
}

.comment-submit:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow:
        0 20px 40px rgba(79, 70, 229, 0.4),
        0 10px 20px rgba(79, 70, 229, 0.3);
}

.comment-submit:active {
    transform: translateY(-1px) scale(1.02);
}

.comment-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
    box-shadow: 0 5px 15px rgba(79, 70, 229, 0.2);
}

.comment-submit i {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
}

.comment-submit:hover i {
    transform: translateX(-2px);
}

/* Comments Container */
.comments-container {
    max-width: 1000px;
    margin: 0 auto;
    position: relative;
    z-index: 2;
}

.comments-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.3);
    box-shadow:
        0 10px 25px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .comments-header {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(31, 42, 68, 0.5);
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(129, 140, 248, 0.1);
}

.comments-header h3 {
    color: var(--text-primary);
    font-size: 1.75rem;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.comments-header h3::before {
    content: '💬';
    font-size: 1.5rem;
    filter: drop-shadow(0 2px 4px rgba(79, 70, 229, 0.3));
}

.comments-sort {
    position: relative;
}

.comments-sort select {
    padding: 0.875rem 1.5rem;
    border: 2px solid transparent;
    border-radius: 12px;
    background: rgba(248, 250, 252, 0.8);
    color: var(--text-primary);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow:
        inset 0 2px 4px rgba(15, 23, 42, 0.06),
        0 2px 8px rgba(15, 23, 42, 0.1);
    appearance: none;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 1rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
    padding-left: 3rem;
}

[data-theme="dark"] .comments-sort select {
    background: rgba(17, 24, 39, 0.8);
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 20 20'%3e%3cpath stroke='%9ca3af' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.5' d='M6 8l4 4 4-4'/%3e%3c/svg%3e");
    background-position: left 1rem center;
    background-repeat: no-repeat;
    background-size: 1rem;
}

.comments-sort select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow:
        0 0 0 3px rgba(79, 70, 229, 0.15),
        0 5px 15px rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

/* Comments List */
.comments-list {
    position: relative;
}

.comments-loading {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.3);
    box-shadow:
        0 10px 25px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .comments-loading {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(31, 42, 68, 0.5);
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(129, 140, 248, 0.1);
}

.comments-loading i {
    font-size: 3rem;
    margin-bottom: 1.5rem;
    display: block;
    color: var(--primary-color);
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.comments-loading span {
    font-size: 1.1rem;
    font-weight: 600;
}

.no-comments {
    text-align: center;
    padding: 5rem 2rem;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    border: 1px solid rgba(226, 232, 240, 0.3);
    box-shadow:
        0 10px 25px rgba(15, 23, 42, 0.1),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .no-comments {
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(31, 42, 68, 0.5);
    box-shadow:
        0 10px 25px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(129, 140, 248, 0.1);
}

.no-comments i {
    font-size: 4rem;
    margin-bottom: 1.5rem;
    display: block;
    color: var(--primary-color);
    opacity: 0.6;
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

.no-comments p {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
}

.comments-items {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Comment Item */
.comment-item {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    padding: 2rem;
    box-shadow:
        0 8px 25px rgba(15, 23, 42, 0.08),
        0 3px 10px rgba(15, 23, 42, 0.05),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(226, 232, 240, 0.3);
    display: flex;
    gap: 1.5rem;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

[data-theme="dark"] .comment-item {
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid rgba(31, 42, 68, 0.5);
    box-shadow:
        0 8px 25px rgba(0, 0, 0, 0.15),
        0 3px 10px rgba(0, 0, 0, 0.1),
        inset 0 1px 0 rgba(129, 140, 248, 0.1);
}

.comment-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.comment-item:hover::before {
    opacity: 1;
}

.comment-item:hover {
    transform: translateY(-5px) scale(1.02);
    box-shadow:
        0 20px 40px rgba(15, 23, 42, 0.12),
        0 8px 20px rgba(15, 23, 42, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.comment-avatar {
    flex-shrink: 0;
    position: relative;
}

.avatar-circle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--avatar-color, var(--primary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.15),
        inset 0 2px 4px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.avatar-circle::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: rotate(-45deg);
    transition: transform 0.6s ease;
}

.comment-item:hover .avatar-circle::before {
    transform: rotate(-45deg) translate(50%, 50%);
}

.avatar-initial {
    font-size: 1.5rem;
    font-weight: 800;
    color: white;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 1;
    position: relative;
}

.avatar-status {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    background: #10B981;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    animation: pulse-status 2s ease-in-out infinite;
}

@keyframes pulse-status {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 2px 8px rgba(16, 185, 129, 0.4);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.6);
    }
}

.comment-item:hover .avatar-circle {
    transform: scale(1.1) rotate(5deg);
    box-shadow:
        0 12px 30px rgba(0, 0, 0, 0.25),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.3);
}

[data-theme="dark"] .comment-header {
    border-bottom: 1px solid rgba(31, 42, 68, 0.5);
}

.comment-author {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    position: relative;
}

.comment-author::before {
    content: '👤';
    font-size: 1rem;
    opacity: 0.7;
}

.comment-time {
    font-size: 0.9rem;
    color: var(--text-light);
    font-weight: 500;
    padding: 0.25rem 0.75rem;
    background: rgba(79, 70, 229, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(79, 70, 229, 0.2);
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.comment-time::before {
    content: '🕒';
    font-size: 0.8rem;
}

.comment-text {
    color: var(--text-secondary);
    line-height: 1.7;
    margin: 0;
    font-size: 1.05rem;
    font-weight: 400;
    text-align: justify;
    position: relative;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.5);
    border-radius: 12px;
    border: 1px solid rgba(226, 232, 240, 0.3);
}

[data-theme="dark"] .comment-text {
    background: rgba(17, 24, 39, 0.5);
    border: 1px solid rgba(31, 42, 68, 0.5);
}

.comment-text::before {
    content: '"';
    position: absolute;
    top: -0.5rem;
    left: 0.5rem;
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
    opacity: 0.3;
}

.comment-text::after {
    content: '"';
    position: absolute;
    bottom: -1rem;
    right: 0.5rem;
    font-size: 2rem;
    color: var(--primary-color);
    font-weight: bold;
    opacity: 0.3;
}

.comment-text-wrapper {
    position: relative;
}

.comment-reactions {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(226, 232, 240, 0.3);
}

[data-theme="dark"] .comment-reactions {
    border-top: 1px solid rgba(31, 42, 68, 0.5);
}

.reaction-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(248, 250, 252, 0.8);
    border: 2px solid transparent;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] .reaction-btn {
    background: rgba(17, 24, 39, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.reaction-btn:hover {
    transform: translateY(-2px) scale(1.05);
    border-color: var(--primary-color);
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary-color);
    box-shadow:
        0 8px 20px rgba(79, 70, 229, 0.15),
        0 2px 8px rgba(15, 23, 42, 0.1);
}

.reaction-btn[data-reaction="like"]:hover {
    border-color: #FF6B6B;
    background: rgba(255, 107, 107, 0.1);
    color: #FF6B6B;
    box-shadow:
        0 8px 20px rgba(255, 107, 107, 0.2),
        0 2px 8px rgba(255, 107, 107, 0.1);
}

.reaction-btn[data-reaction="thumbs-up"]:hover {
    border-color: #4ECDC4;
    background: rgba(78, 205, 196, 0.1);
    color: #4ECDC4;
    box-shadow:
        0 8px 20px rgba(78, 205, 196, 0.2),
        0 2px 8px rgba(78, 205, 196, 0.1);
}

.reaction-btn.active {
    background: var(--gradient-primary);
    color: white;
    border-color: var(--primary-color);
    transform: translateY(-2px) scale(1.05);
    box-shadow:
        0 8px 20px rgba(79, 70, 229, 0.3),
        0 2px 8px rgba(79, 70, 229, 0.2);
}

.reaction-btn.active i {
    animation: heartbeat 0.6s ease-in-out;
}

.reaction-btn[data-reaction="like"].active {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF8E8E 100%);
    border-color: #FF6B6B;
    box-shadow:
        0 8px 20px rgba(255, 107, 107, 0.4),
        0 2px 8px rgba(255, 107, 107, 0.3);
}

.reaction-btn[data-reaction="thumbs-up"].active {
    background: linear-gradient(135deg, #4ECDC4 0%, #6EDDD6 100%);
    border-color: #4ECDC4;
    box-shadow:
        0 8px 20px rgba(78, 205, 196, 0.4),
        0 2px 8px rgba(78, 205, 196, 0.3);
}

@keyframes heartbeat {

    0%,
    100% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(1.1);
    }

    75% {
        transform: scale(1.2);
    }
}

@keyframes reactionPulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 10px rgba(79, 70, 229, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(79, 70, 229, 0);
    }
}

.reaction-btn:active {
    animation: reactionPulse 0.6s ease-out;
}

.reaction-btn i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.reaction-btn span {
    font-size: 0.85rem;
    min-width: 20px;
    text-align: center;
}

/* Show More Button */
.show-more-btn {
    display: block;
    margin: 2rem auto 0;
    padding: 1rem 2rem;
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 2px solid var(--border-color);
    border-radius: 50px;
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-light);
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

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

.show-more-btn:hover {
    transform: translateY(-3px) scale(1.02);
    border-color: var(--primary-color);
    color: white;
    box-shadow:
        var(--shadow-medium),
        0 8px 25px rgba(79, 70, 229, 0.25);
}

.show-more-btn:hover::before {
    left: 0;
}

.show-more-btn:active {
    transform: translateY(-1px) scale(0.98);
}

.show-more-btn i {
    margin-left: 0.5rem;
    transition: transform 0.3s ease;
}

.show-more-btn:hover i {
    transform: translateY(2px);
}

[data-theme="dark"] .show-more-btn {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border-color: var(--border-color);
    box-shadow: var(--shadow-light);
}

/* Reply Button */
.reply-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(248, 250, 252, 0.8);
    border: 2px solid transparent;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] .reply-btn {
    background: rgba(17, 24, 39, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.reply-btn:hover {
    transform: translateY(-2px) scale(1.05);
    border-color: var(--accent-color);
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-color);
    box-shadow:
        0 8px 20px rgba(14, 165, 233, 0.15),
        0 2px 8px rgba(15, 23, 42, 0.1);
}

.reply-btn i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.reply-btn span {
    font-size: 0.85rem;
}

/* Show Replies Button في أزرار التفاعل */
.show-replies-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(248, 250, 252, 0.8);
    border: 2px solid transparent;
    border-radius: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

[data-theme="dark"] .show-replies-btn {
    background: rgba(17, 24, 39, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.show-replies-btn:hover {
    transform: translateY(-2px) scale(1.05);
    border-color: var(--accent-color);
    background: rgba(14, 165, 233, 0.1);
    color: var(--accent-color);
    box-shadow:
        0 8px 20px rgba(14, 165, 233, 0.15),
        0 2px 8px rgba(15, 23, 42, 0.1);
}

.show-replies-btn[data-replies-visible="true"] {
    background: rgba(14, 165, 233, 0.15);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.show-replies-btn i {
    font-size: 1rem;
    transition: transform 0.3s ease;
}

.show-replies-btn i.active {
    color: var(--accent-color);
}

/* Reply Form (مخفي - نستخدم النافذة المنبثقة بدلاً منه) */
.reply-form {
    display: none !important;
    margin: 1rem 0;
    padding: 1.5rem;
    background: rgba(248, 250, 252, 0.95);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    backdrop-filter: blur(10px);
    box-shadow: var(--shadow-medium);
    animation: slideDown 0.3s ease-out;
    position: relative;
    z-index: 10;
}

[data-theme="dark"] .reply-form {
    background: rgba(17, 24, 39, 0.9);
    border-color: var(--border-color);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reply-form-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border-color);
}

.reply-form-header h4 {
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
}

.close-reply-form {
    background: none;
    border: none;
    color: var(--text-light);
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.25rem;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-reply-form:hover {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    transform: scale(1.1);
}

.reply-form-content .form-group {
    margin-bottom: 1rem;
}

.reply-form-content input,
.reply-form-content textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.reply-form-content input:focus,
.reply-form-content textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.reply-form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 1rem;
}

.reply-form-actions .btn {
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
}

/* Replies Container */
.replies-container {
    margin-top: 1rem;
    padding-right: 2rem;
    border-right: 3px solid var(--border-color);
    position: relative;
}

.replies-container::before {
    content: '';
    position: absolute;
    right: -2px;
    top: 0;
    width: 3px;
    height: 100%;
    background: var(--gradient-primary);
    opacity: 0.3;
    border-radius: 2px;
}

.replies-header {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(79, 70, 229, 0.05);
    border: 1px solid rgba(79, 70, 229, 0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-theme="dark"] .replies-header {
    background: rgba(129, 140, 248, 0.05);
    border-color: rgba(129, 140, 248, 0.1);
}

.replies-count {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 0.5rem;
    border-radius: 8px;
}

.replies-count:hover {
    background: rgba(79, 70, 229, 0.1);
    transform: translateY(-1px);
}

.replies-count i {
    font-size: 1rem;
}

.replies-toggle-icon {
    margin-right: auto;
    transition: transform 0.3s ease;
}

.replies-count:hover .replies-toggle-icon {
    transform: scale(1.2);
}

.refresh-replies-btn {
    background: none;
    border: 1px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.4rem 0.6rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8rem;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.refresh-replies-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: scale(1.05);
}

.refresh-replies-btn i {
    font-size: 0.9rem;
}

.replies-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    transition: all 0.3s ease;
    opacity: 1;
    transform: translateY(0);
}

/* Reply Item - تنظيم محسّن */
.reply-item {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    backdrop-filter: blur(10px);
    transition: all 0.3s ease;
    position: relative;
    width: 100%;
    box-sizing: border-box;
}

/* محتوى الرد الرئيسي */
.reply-main-wrapper {
    display: flex;
    flex-direction: row;
    gap: 1rem;
    align-items: flex-start;
    width: 100%;
}

[data-theme="dark"] .reply-item {
    background: rgba(17, 24, 39, 0.6);
    border-color: var(--border-color);
}

.reply-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    border-color: var(--primary-color);
}

.reply-avatar {
    flex-shrink: 0;
}

.reply-avatar .avatar-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--avatar-color, var(--primary-color));
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.reply-avatar .avatar-initial {
    color: white;
    font-weight: 700;
    font-size: 1rem;
}

.reply-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    width: 100%;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    gap: 1rem;
}

.reply-author {
    color: var(--text-primary);
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.reply-time {
    color: var(--text-light);
    font-size: 0.8rem;
    white-space: nowrap;
}

.reply-text {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    margin: 0;
    word-wrap: break-word;
}

/* Reply Actions */
.reply-actions {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(226, 232, 240, 0.5);
}

[data-theme="dark"] .reply-actions {
    border-top-color: rgba(31, 42, 68, 0.5);
}

.nested-reply-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.nested-reply-btn:hover {
    background: rgba(14, 165, 233, 0.1);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-1px);
}

.nested-reply-btn i {
    font-size: 0.85rem;
}

/* Nested Replies Container - عرض كامل جذاب */
.nested-replies-container {
    margin-top: 1rem;
    margin-right: 0;
    margin-left: 0;
    padding: 0;
    position: relative;
    /* عرض كامل */
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    box-sizing: border-box;
}

/* إزالة عنوان قسم الردود - سيتم التحكم من زر التفاعل */

/* الرد - تصميم بسيط بعرض كامل */
.nested-reply {
    margin-bottom: 0;
    padding: 1rem;
    background: rgba(248, 250, 252, 0.6);
    border: 1px solid var(--border-color);
    border-right: 3px solid rgba(14, 165, 233, 0.4);
    border-radius: 12px;
    transition: all 0.3s ease;
    position: relative;
    /* عرض كامل */
    display: flex;
    flex-direction: column;
    gap: 0;
    width: 100%;
    box-sizing: border-box;
    backdrop-filter: blur(10px);
}

/* أيقونة رد صغيرة */
.nested-reply::before {
    content: '↳';
    position: absolute;
    top: 0.75rem;
    left: 0.75rem;
    font-size: 0.9rem;
    color: var(--accent-color);
    opacity: 0.3;
}

.nested-reply:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-medium);
    border-right-color: var(--accent-color);
}

.nested-reply:hover::before {
    opacity: 0.6;
}

[data-theme="dark"] .nested-reply {
    background: rgba(17, 24, 39, 0.6);
    border-color: var(--border-color);
    border-right-color: rgba(14, 165, 233, 0.5);
}

/* كل الردود بنفس الحجم - عرض كامل منظم */
.nested-reply .reply-avatar .avatar-circle {
    width: 40px;
    height: 40px;
}

.nested-reply .reply-avatar .avatar-initial {
    font-size: 1rem;
}

.nested-reply .reply-author {
    font-size: 1rem;
    font-weight: 600;
}

.nested-reply .reply-text {
    font-size: 0.9rem;
}

/* جميع مستويات الردود بنفس الطريقة */
.nested-reply .nested-replies-container {
    gap: 0.75rem;
    margin-top: 1rem;
}

/* تم إزالة الشريط الجانبي - نستخدم border-right */

/* Nested Reply Form - إصلاح التداخل (مخفي - نستخدم النافذة المنبثقة) */
.nested-reply-form {
    display: none !important;
    margin: 0.75rem 0;
    padding: 0.75rem;
    background: rgba(14, 165, 233, 0.08);
    border: 2px solid rgba(14, 165, 233, 0.25);
    border-radius: 8px;
    position: relative;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
    /* منع التداخل - مهم جداً */
    clear: both;
    display: block;
    width: 100%;
    box-sizing: border-box;
    max-width: 100%;
    overflow: hidden;
    /* فصل عن العناصر المجاورة */
    isolation: isolate;
}

[data-theme="dark"] .nested-reply-form {
    background: rgba(14, 165, 233, 0.12);
    border-color: rgba(14, 165, 233, 0.35);
}

/* تصغير النموذج للردود المتداخلة */
.nested-reply .nested-reply-form {
    padding: 0.6rem;
    margin: 0.5rem 0;
}

.nested-reply .nested-reply .nested-reply-form {
    padding: 0.5rem;
    margin: 0.4rem 0;
}

/* تحسين تخطيط النموذج */
.nested-reply-form .reply-form-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
}

.nested-reply-form .reply-form-header h4 {
    font-size: 0.95rem;
}

.nested-reply-form .form-group {
    margin-bottom: 0.75rem;
}

.nested-reply-form input,
.nested-reply-form textarea {
    font-size: 0.85rem;
    padding: 0.6rem;
}

.nested-reply-form .reply-form-actions {
    margin-top: 0.75rem;
    gap: 0.75rem;
}

.nested-reply-form .btn {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Replies Error Message */
.replies-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    border-radius: 10px;
    color: #dc2626;
    font-size: 0.9rem;
    margin: 1rem 0;
}

.replies-error i {
    font-size: 1rem;
}

.retry-replies-btn {
    background: #dc2626;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    transition: all 0.3s ease;
    margin-right: auto;
}

.retry-replies-btn:hover {
    background: #b91c1c;
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
    .comments-section {
        padding: 4rem 0;
    }

    .section-stats {
        gap: 1.5rem;
    }

    .stat-item {
        padding: 1rem;
        min-width: 100px;
    }

    .comment-form {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }

    .comments-header {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
        padding: 1.5rem;
    }

    .comments-header h3 {
        text-align: center;
        font-size: 1.5rem;
    }

    .comment-item {
        margin: 0 1rem;
        padding: 1.5rem;
    }

    .comment-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .comment-reactions {
        gap: 0.75rem;
    }

    .reaction-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }

    .show-more-btn {
        margin: 1.5rem auto 0;
        padding: 0.8rem 1.5rem;
        font-size: 0.9rem;
    }

    .reply-form {
        padding: 1rem;
        margin: 0.75rem 0;
    }

    .reply-form-actions {
        flex-direction: column;
        gap: 0.75rem;
    }

    .reply-form-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .replies-container {
        padding-right: 1rem;
        margin-top: 0.75rem;
    }

    .reply-item {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    .reply-avatar .avatar-circle {
        width: 35px;
        height: 35px;
    }

    .reply-avatar .avatar-initial {
        font-size: 0.9rem;
    }

    .nested-replies-container {
        margin: 0.75rem 0 0 0;
        padding: 0;
    }

    .nested-reply {
        padding: 0.85rem;
    }

    .nested-reply-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    .show-replies-btn {
        padding: 0.4rem 0.8rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .comments-section {
        padding: 3rem 0;
    }

    .title-icon {
        font-size: 2rem;
    }

    .section-stats {
        flex-direction: column;
        gap: 1rem;
        align-items: center;
    }

    .stat-item {
        width: 100%;
        max-width: 200px;
    }

    .comment-form {
        margin: 0 0.5rem;
        padding: 1.5rem 1rem;
    }

    .comment-submit {
        padding: 1rem 2rem;
        font-size: 1rem;
    }

    .comments-header {
        padding: 1rem;
        margin: 0 0.5rem;
    }

    .comment-item {
        margin: 0 0.5rem;
        flex-direction: column;
        gap: 1rem;
        padding: 1rem;
    }

    .comment-avatar {
        align-self: center;
    }

    .avatar-circle {
        width: 50px;
        height: 50px;
    }

    .avatar-initial {
        font-size: 1.2rem;
    }

    .comment-header {
        text-align: center;
    }

    .comment-author {
        font-size: 1.1rem;
    }

    .comment-reactions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .show-more-btn {
        margin: 1rem auto 0;
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }

    .reply-form {
        padding: 0.75rem;
        margin: 0.5rem 0;
    }

    .reply-form-header h4 {
        font-size: 1rem;
    }

    .reply-form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .reply-form-actions .btn {
        width: 100%;
        padding: 0.75rem 1rem;
        font-size: 0.85rem;
    }

    .replies-container {
        padding-right: 0.5rem;
        margin-top: 0.5rem;
    }

    .reply-item {
        flex-direction: column;
        align-items: center;
        text-align: center;
        padding: 0.75rem;
        gap: 0.5rem;
    }

    .reply-avatar .avatar-circle {
        width: 45px;
        height: 45px;
    }

    .reply-header {
        flex-direction: column;
        gap: 0.25rem;
        text-align: center;
    }

    .reply-author {
        font-size: 0.95rem;
    }

    .reply-text {
        font-size: 0.85rem;
        text-align: right;
    }

    .nested-replies-container {
        margin: 0.75rem 0 0 0;
        padding: 0;
    }

    .nested-reply {
        padding: 0.75rem;
        margin-bottom: 0;
    }

    .nested-reply::before {
        font-size: 0.8rem;
        top: 0.5rem;
        left: 0.5rem;
    }

    .nested-reply-btn {
        padding: 0.3rem 0.6rem;
        font-size: 0.75rem;
    }

    .show-replies-btn {
        padding: 0.35rem 0.7rem;
        font-size: 0.8rem;
    }

    .reply-actions {
        flex-wrap: wrap;
        gap: 0.4rem;
    }

    /* نموذج الرد المتداخل على الموبايل */
    .nested-reply-form {
        padding: 0.5rem;
        margin: 0.5rem 0;
    }

    .nested-reply-form .reply-form-header h4 {
        font-size: 0.85rem;
    }

    .nested-reply-form input,
    .nested-reply-form textarea {
        font-size: 0.8rem;
        padding: 0.5rem;
    }

    .nested-reply-form .reply-form-actions {
        flex-direction: column;
        gap: 0.5rem;
    }

    .nested-reply-form .btn {
        width: 100%;
        padding: 0.6rem;
        font-size: 0.8rem;
    }
}

/* ===== REPLY MODAL STYLES ===== */
.reply-modal {
    z-index: 9999;
}

.reply-modal-content {
    background: var(--bg-secondary);
    border-radius: 20px;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-heavy);
    animation: slideUpFade 0.4s ease;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.reply-modal-header {
    background: var(--gradient-primary);
    color: white;
    padding: 1.5rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 20px 20px 0 0;
}

.reply-modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.reply-modal-close {
    font-size: 1.8rem;
    cursor: pointer;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.2);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.reply-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

.reply-modal-body {
    padding: 2rem;
    overflow-y: auto;
    max-height: calc(90vh - 100px);
}

.reply-to-info {
    background: var(--bg-primary);
    border-left: 4px solid var(--primary-color);
    padding: 1rem 1.5rem;
    border-radius: 10px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reply-to-label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.reply-to-name {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1rem;
}

.reply-modal-form .form-group {
    margin-bottom: 1.5rem;
}

.reply-modal-form label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.95rem;
}

.reply-modal-form label i {
    color: var(--primary-color);
    font-size: 0.9rem;
}

.reply-modal-form input,
.reply-modal-form textarea {
    width: 100%;
    padding: 0.9rem 1.2rem;
    border: 2px solid var(--border-color);
    border-radius: 12px;
    font-size: 1rem;
    font-family: 'Cairo', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.reply-modal-form input:focus,
.reply-modal-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.reply-modal-form textarea {
    resize: vertical;
    min-height: 120px;
}

.reply-modal-form .char-counter {
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-light);
    margin-top: 0.5rem;
    font-weight: 500;
}

.reply-modal-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.reply-modal-actions .btn {
    flex: 1;
    padding: 0.9rem 1.5rem;
    font-size: 1rem;
    border-radius: 12px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.reply-modal-submit:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(79, 70, 229, 0.3);
}

.reply-modal-cancel {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
}

.reply-modal-cancel:hover {
    background: var(--bg-primary);
    border-color: var(--primary-color);
}

/* Responsive Reply Modal */
@media (max-width: 768px) {
    .reply-modal-content {
        width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .reply-modal-header {
        padding: 1rem 1.5rem;
        border-radius: 0;
    }

    .reply-modal-header h3 {
        font-size: 1.1rem;
    }

    .reply-modal-body {
        padding: 1.5rem;
    }

    .reply-modal-actions {
        flex-direction: column;
    }

    .reply-modal-actions .btn {
        width: 100%;
    }
}




/* ===== PHASE 2: ADVANCED ANIMATIONS ===== */

/* Hero Canvas Background */
#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
}

.hero-container {
    position: relative;
    z-index: 2;
    /* Content above canvas */
}

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg,
            var(--bg-tertiary) 25%,
            var(--border-color) 50%,
            var(--bg-tertiary) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite linear;
    border-radius: 8px;
    display: block;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
    width: 100%;
}

.skeleton-title {
    height: 2rem;
    margin-bottom: 1rem;
    width: 60%;
}

.skeleton-card {
    height: 250px;
    width: 100%;
    margin-bottom: 20px;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 5000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    overflow-y: auto;
}

.modal-content {
    background-color: var(--bg-secondary);
    margin: 5% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    width: 90%;
    max-width: 800px;
    border-radius: 20px;
    position: relative;
    box-shadow: var(--shadow-heavy);
    color: var(--text-primary);
    animation: slideIn 0.4s ease-out;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.close-modal {
    position: absolute;
    top: 20px;
    left: 20px;
    /* Arabic RTL */
    font-size: 28px;
    font-weight: bold;
    color: var(--text-secondary);
    cursor: pointer;
    transition: color 0.3s;
}

.close-modal:hover {
    color: var(--primary-color);
}



/* Like/Rating System */
.portfolio-actions {
    display: flex;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid var(--border-color);
}

.like-btn,
.rate-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s;
}

.like-btn:hover,
.like-btn.active {
    color: #ef4444;
}

.rate-btn:hover {
    color: #f59e0b;
}

.section-footer {
    text-align: center;
    margin-top: 30px;
}

/* ===== PREMIUM PRELOADER ===== */
.premium-preloader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--gradient-bg);
    z-index: 99999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.8s ease, visibility 0.8s ease, transform 1s cubic-bezier(0.19, 1, 0.22, 1);
    perspective: 1000px;
    overflow: hidden;
}

.preloader-bg-grid {
    position: absolute;
    width: 200%;
    height: 200%;
    top: -50%;
    left: -50%;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px);
    background-size: 50px 50px;
    transform: rotateX(60deg) translateY(0);
    animation: gridMove 10s linear infinite;
    z-index: 0;
    opacity: 0.4;
}

@keyframes gridMove {
    0% {
        transform: rotateX(60deg) translateY(0);
    }

    100% {
        transform: rotateX(60deg) translateY(50px);
    }
}

.premium-preloader::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 30%, rgba(0, 0, 0, 0.4) 100%);
    z-index: 0;
}

.premium-preloader.fade-out {
    opacity: 0;
    visibility: hidden;
    transform: scale(1.5) translateZ(200px);
    filter: blur(20px);
}

.preloader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
    z-index: 2;
}

.energy-core {
    position: relative;
    width: 150px;
    height: 150px;
    transform-style: preserve-3d;
    animation: coreFloat 4s ease-in-out infinite;
}

@keyframes coreFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-15px);
    }
}

.core-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 2px solid transparent;
    transform-style: preserve-3d;
}

.core-ring-1 {
    border-top: 3px solid var(--accent-color);
    border-right: 3px solid var(--primary-color);
    animation: spin3D_1 3s linear infinite;
    box-shadow: 0 0 20px var(--accent-color), inset 0 0 20px var(--primary-color);
}

.core-ring-2 {
    width: 80%;
    height: 80%;
    top: 10%;
    left: 10%;
    border-bottom: 3px solid var(--secondary-color);
    border-left: 3px solid var(--primary-color);
    animation: spin3D_2 2.5s linear infinite;
    box-shadow: 0 0 15px var(--secondary-color);
}

.core-ring-3 {
    width: 60%;
    height: 60%;
    top: 20%;
    left: 20%;
    border-top: 3px solid #ffffff;
    border-bottom: 3px solid var(--accent-color);
    animation: spin3D_3 2s linear infinite;
    box-shadow: 0 0 30px rgba(255, 255, 255, 0.6);
}

@keyframes spin3D_1 {
    0% {
        transform: rotateX(70deg) rotateY(0deg) rotateZ(0deg);
    }

    100% {
        transform: rotateX(70deg) rotateY(360deg) rotateZ(360deg);
    }
}

@keyframes spin3D_2 {
    0% {
        transform: rotateX(40deg) rotateY(40deg) rotateZ(0deg);
    }

    100% {
        transform: rotateX(40deg) rotateY(-360deg) rotateZ(360deg);
    }
}

@keyframes spin3D_3 {
    0% {
        transform: rotateX(80deg) rotateY(80deg) rotateZ(0deg);
    }

    100% {
        transform: rotateX(80deg) rotateY(80deg) rotateZ(-360deg);
    }
}

.core-logo {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    color: #ffffff;
    text-shadow: 0 0 15px var(--accent-color), 0 0 30px var(--primary-color);
    animation: pulseGlow 1.5s ease-in-out infinite alternate;
}

@keyframes pulseGlow {
    from {
        text-shadow: 0 0 10px var(--accent-color), 0 0 20px var(--primary-color);
        transform: translate(-50%, -50%) scale(0.9);
    }

    to {
        text-shadow: 0 0 20px var(--accent-color), 0 0 40px var(--primary-color), 0 0 60px #ffffff;
        transform: translate(-50%, -50%) scale(1.1);
    }
}

.loader-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
}

.epic-text {
    font-size: 3.5rem;
    font-weight: 900;
    color: transparent;
    background: linear-gradient(45deg, #ffffff, #e0e7ff);
    background-size: 200% auto;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.1);
    animation: shineText 3s linear infinite, scaleText 2.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    letter-spacing: 2px;
    text-shadow: 0 0 30px rgba(255, 255, 255, 0.3);
}

@keyframes shineText {
    to {
        background-position: 200% center;
    }
}

@keyframes scaleText {
    0% {
        transform: scale(0.8);
        opacity: 0;
        filter: blur(10px);
        letter-spacing: -5px;
    }

    100% {
        transform: scale(1);
        opacity: 1;
        filter: blur(0);
        letter-spacing: 2px;
    }
}

.loading-bar-container {
    width: 250px;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 5px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 255, 255, 0.2);
}

.loading-bar-progress {
    position: absolute;
    top: 0;
    left: 0;
    height: 100%;
    width: 0%;
    background: var(--gradient-primary);
    border-radius: 10px;
    box-shadow: 0 0 10px var(--accent-color), 0 0 20px var(--primary-color);
    animation: fillBar 2.5s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes fillBar {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}

.text-loading-modern {
    font-size: 1rem;
    font-family: monospace;
    color: #ffffff;
    opacity: 0.8;
    letter-spacing: 3px;
    text-transform: uppercase;
    animation: blinkText 1s infinite;
}

@keyframes blinkText {

    0%,
    100% {
        opacity: 0.8;
        text-shadow: 0 0 10px #ffffff;
    }

    50% {
        opacity: 0.3;
        text-shadow: none;
    }
}