:root {
    --bg-color: #030712;
    --card-bg: #111827;
    --card-hover-bg: #1f2937;
    --border-color: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #9ca3af;
    --accent-color: #60a5fa;
    --accent-hover: #3b82f6;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --info-color: #a855f7;
    --font-main: 'Inter', 'Tajawal', sans-serif;
    --font-code: 'Fira Code', monospace;
    --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
    --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --shadow-xl: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 12px;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 5px;
    border: 2px solid var(--bg-color);
}

::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}

/* For Firefox */
* {
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) var(--bg-color);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(at 0% 0%, hsla(217, 100%, 50%, 0.05) 0px, transparent 50%),
        radial-gradient(at 100% 0%, hsla(273, 100%, 50%, 0.05) 0px, transparent 50%);
    color: var(--text-primary);
    font-family: var(--font-main);
    line-height: 1.6;
    min-height: 100vh;
}

/* Ensure Tajawal is used for Arabic text globally */
[lang="ar"] body,
[lang="ar"] button,
[lang="ar"] input,
[lang="ar"] select,
[lang="ar"] textarea {
    font-family: 'Tajawal', 'Inter', sans-serif;
}

.hidden {
    display: none !important;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 3rem 2rem;
}

/* Header Styles */
.profile-header {
    text-align: center;
    padding: 6rem 0 4rem;
    animation: fadeIn 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}

.profile-image-container {
    width: 140px;
    height: 140px;
    margin: 0 auto 2rem;
    border-radius: 50%;
    padding: 3px;
    background: linear-gradient(135deg, var(--accent-color), #818cf8);
    position: relative;
}

.profile-image-container::after {
    content: '';
    position: absolute;
    inset: -10px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--accent-color) 0%, transparent 70%);
    opacity: 0.15;
    z-index: -1;
}

.profile-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 4px solid var(--bg-color);
}

.profile-name {
    font-size: 3.5rem;
    font-weight: 800;
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
    background: linear-gradient(to right, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.profile-bio {
    color: var(--text-secondary);
    font-size: 1.25rem;
    margin-bottom: 2.5rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    font-weight: 400;
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 1.25rem;
    flex-wrap: wrap;
}

.social-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.95rem;
    padding: 0.75rem 1.5rem;
    border-radius: 12px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    border: 1px solid var(--border-color);
    background: var(--card-bg);
    font-family: var(--font-main);
}

.social-link.lang-toggle {
    font-family: 'Tajawal', 'Inter', sans-serif;
    cursor: pointer;
}

.social-link.lang-toggle #lang-label {
    font-family: 'Tajawal', sans-serif;
}

.social-link:hover {
    transform: translateY(-4px);
    border-color: var(--accent-color);
    box-shadow: 0 10px 20px -10px rgba(0, 0, 0, 0.5);
    background: var(--card-hover-bg);
}

/* GitHub Button */
.social-link.github {
    background: #24292e;
    color: #fff;
}

.social-link.creators {
    background-image: linear-gradient(90deg, #CA3E3A, #B42980 40%, #7B20A2 70%, #5E14A5);
    color: #ffffff !important;
    border: none;
    box-shadow: #FFFFFF4D 0px 1px 1px 0px inset, #00000040 0px -2px 2px 0px inset;
    opacity: 0.95;
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s;
}

.social-link.creators:hover {
    opacity: 1;
    transform: translateY(-2px);
    box-shadow: #FFFFFF4D 0px 1px 1px 0px inset, #00000040 0px -4px 4px 0px inset;
}

.social-link.alternativeto {
    background-color: #1e293b;
    border-color: #334155;
}

.social-link.alternativeto:hover {
    background-color: #0f172a;
    border-color: #38bdf8;
}

.social-icon-img {
    width: 20px;
    height: 20px;
    object-fit: contain;
}

.creators .social-icon-img {
    width: 24px;
    height: 24px;
}

/* Controls Bar (Search & Filter) */
.filter-badges {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 2.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.filter-badge {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    padding: 0.6rem 1.25rem;
    border-radius: 14px;
    cursor: pointer;
    font-size: 0.95rem;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 500;
    font-family: var(--font-main);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
}

.filter-badge svg,
.filter-badge i {
    width: 16px;
    height: 16px;
    transition: transform 0.3s;
}

.filter-badge:hover svg,
.filter-badge:hover i {
    transform: scale(1.1);
}

/* Category Badges */
.card-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.category-badge i,
.cat-svg {
    width: 14px;
    height: 14px;
}

.category-badge {
    background: var(--card-bg);
    padding: 0.35rem 0.85rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    border: 1px solid transparent;
}

.category-badge.windows {
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    border-color: rgba(59, 130, 246, 0.2);
}

.category-badge.extensions {
    background: rgba(168, 85, 247, 0.1);
    color: #a855f7;
    border-color: rgba(168, 85, 247, 0.2);
}

.category-badge.web {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
    border-color: rgba(16, 185, 129, 0.2);
}

.category-badge.other {
    background: rgba(107, 114, 128, 0.1);
    color: #9ca3af;
    border-color: rgba(107, 114, 128, 0.2);
}

.version-badge {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
    padding: 0.35rem 0.85rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(245, 158, 11, 0.2);
    display: inline-flex;
    align-items: center;
}

.filter-badge:hover {
    border-color: var(--accent-color);
    color: var(--text-primary);
    transform: translateY(-2px);
}

.filter-badge.active {
    background: var(--accent-color);
    color: #fff;
    border-color: var(--accent-color);
    font-weight: 600;
    box-shadow: 0 4px 12px rgba(96, 165, 250, 0.3);
}

/* Controls Bar Enhancement */
.controls-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 3.5rem;
    gap: 1.5rem;
    background: rgba(17, 24, 39, 0.4);
    padding: 1rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    backdrop-filter: blur(16px);
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.3);
}

.search-container {
    position: relative;
    flex: 1;
    max-width: 600px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-input {
    width: 100%;
    background: rgba(3, 7, 18, 0.5);
    border: 1px solid var(--border-color);
    padding: 0.85rem 1.25rem 0.85rem 3.25rem;
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 1rem;
    transition: all 0.3s;
    font-family: inherit;
}

[dir="rtl"] .search-input {
    padding: 0.85rem 3.25rem 0.85rem 1.25rem;
}

.search-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: rgba(3, 7, 18, 0.7);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.15);
}

.search-icon {
    position: absolute;
    left: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-secondary);
    font-size: 1.1rem;
    pointer-events: none;
    transition: color 0.3s;
}

.search-container:focus-within .search-icon {
    color: var(--accent-color);
}

[dir="rtl"] .search-icon {
    left: auto;
    right: 1.25rem;
}

.sort-select {
    padding: 0.85rem 2.5rem 0.85rem 1.25rem;
    background: rgba(17, 24, 39, 0.8);
    border: 1px solid var(--border-color);
    border-radius: 14px;
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%239ca3af%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 1.25rem center;
    background-size: 0.75rem auto;
    font-size: 1rem;
    font-family: var(--font-main);
    min-width: 200px;
    transition: all 0.3s;
    backdrop-filter: blur(10px);
}

.sort-select option {
    background-color: var(--card-bg);
    color: var(--text-primary);
    padding: 10px;
}

[dir="rtl"] .sort-select {
    padding: 0.85rem 1.25rem 0.85rem 2.5rem;
    background-position: left 1.25rem center;
}

.sort-select:hover {
    border-color: var(--text-secondary);
}

.sort-select:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 4px rgba(96, 165, 250, 0.1);
}

/* Responsive Controls */
@media (max-width: 768px) {
    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding: 1.25rem;
    }

    .search-container {
        max-width: none;
        flex: none;
    }

    .sort-select {
        width: 100%;
    }
}

/* Main Content */
.section-title {
    font-size: 1.75rem;
    font-weight: 800;
    margin-bottom: 2.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

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

.section-title::before {
    content: '';
    width: 4px;
    height: 1.5rem;
    background: var(--accent-color);
    border-radius: 2px;
    flex-shrink: 0;
}

.projects-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding-bottom: 6rem;
    transition: all 0.3s ease;
}

/* Horizontal Card Design */
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    padding: 1.75rem;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    min-height: auto;
}

.project-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent-color);
    box-shadow: 0 20px 50px -12px rgba(0, 0, 0, 0.5), 0 0 20px -5px rgba(96, 165, 250, 0.3);
    background: var(--card-hover-bg);
}

.card-main-content {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    width: 100%;
}

.card-header-horizontal {
    display: flex;
    gap: 1.75rem;
    align-items: flex-start;
}

.card-icon-wrapper {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.3s ease;
}

.project-card:hover .card-icon-wrapper {
    transform: scale(1.05) rotate(-5deg);
    border-color: rgba(96, 165, 250, 0.3);
}

.card-icon-img {
    width: 48px;
    height: 48px;
    object-fit: contain;
}

.card-icon {
    font-size: 2.75rem;
    color: var(--accent-color);
}

.card-info-content {
    flex: 1;
    min-width: 0;
}

.card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.card-title {
    font-size: 1.75rem;
    font-weight: 700;
    margin: 0;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1.2;
}

.card-description {
    color: var(--text-secondary);
    font-size: 1.05rem;
    line-height: 1.6;
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer-horizontal {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
    padding-top: 1.25rem;
    margin-top: 0.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.card-tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    flex: 1;
}

.tech-tag {
    font-size: 0.8rem;
    padding: 0.45rem 1rem;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.08);
    font-weight: 500;
    transition: all 0.3s;
}

.tech-tag:hover {
    background: rgba(96, 165, 250, 0.1);
    color: var(--accent-color);
    border-color: rgba(96, 165, 250, 0.2);
    transform: translateY(-2px);
}

.card-actions {
    display: flex;
    gap: 0.85rem;
    flex-shrink: 0;
}

@media (max-width: 900px) {
    .card-header-horizontal {
        flex-direction: column;
        gap: 1.25rem;
    }

    .card-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }

    .card-footer-horizontal {
        flex-direction: column;
        align-items: stretch;
        gap: 1.5rem;
    }

    .card-actions {
        width: 100%;
    }

    .action-btn {
        flex: 1;
    }
}

/* Media Gallery Strip */
.media-gallery-strip {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    overflow-x: auto;
    padding-bottom: 4px;
}

.media-thumb {
    width: 80px;
    height: 48px;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: all 0.2s;
}

.media-thumb:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
}

.media-thumb img,
.media-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-thumb-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
}

/* Card Actions */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
}

.action-btn {
    flex: 1 1 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    white-space: nowrap;
    font-family: inherit;
}

/* Pagination Styles */
.pagination-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.25rem;
    margin-top: 3rem;
    padding: 1rem 1.5rem;
    padding-bottom: 4rem;
}

.pagination-btn {
    padding: 0.75rem 1.5rem;
    background: rgba(17, 24, 39, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: inherit;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--accent-color);
    background: rgba(31, 41, 55, 0.8);
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

.pagination-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background: rgba(17, 24, 39, 0.3);
}

.pagination-input-wrapper {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 1rem;
    background: rgba(17, 24, 39, 0.4);
    padding: 0.5rem 1.25rem;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(8px);
}

.pagination-input {
    width: 50px;
    height: 38px;
    background: rgba(3, 7, 18, 0.6);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--accent-color);
    text-align: center;
    font-size: 1.1rem;
    font-weight: 700;
    font-family: 'Tajawal', sans-serif;
    outline: none;
    transition: all 0.3s;
}

.pagination-input:focus {
    border-color: var(--accent-color);
    background: rgba(3, 7, 18, 0.8);
    box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.1);
}

.pagination-input::-webkit-inner-spin-button,
.pagination-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.pagination-input[type=number] {
    -moz-appearance: textfield;
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    width: 45px;
    height: 45px;
    background: var(--accent-color);
    color: white;
    border: none;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateY(20px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    background: #4791e6;
    transform: translateY(-5px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

/* Adjust position for RTL */
[dir="rtl"] .back-to-top {
    right: auto;
    left: 2rem;
}

@media (max-width: 768px) {
    .controls-bar {
        flex-direction: column;
        height: auto;
        padding: 1.25rem;
        gap: 1rem;
    }

    .search-container {
        width: 100%;
        max-width: none;
        flex: none;
    }

    .search-container:focus-within {
        max-width: none;
    }

    .search-input {
        opacity: 1;
        cursor: text;
        padding: 0.85rem 1.25rem 0.85rem 3rem;
        background: rgba(255, 255, 255, 0.03);
    }

    .search-icon {
        color: var(--accent-color);
    }

    [dir="rtl"] .search-input {
        padding: 0.85rem 3rem 0.85rem 1.25rem;
    }

    .sort-select {
        width: 100%;
    }

    .back-to-top {
        bottom: 1.5rem;
        right: 1.5rem;
        width: 40px;
        height: 40px;
    }

    [dir="rtl"] .back-to-top {
        left: 1.5rem;
        right: auto;
    }
}

.action-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--text-secondary);
    color: white;
    transform: translateY(-2px);
    text-decoration: none;
}

/* Fix for buttons inside markdown body */
.markdown-body .action-btn,
.markdown-body .action-btn:hover {
    text-decoration: none;
}

.action-btn.primary {
    background: rgba(56, 139, 253, 0.1);
    border-color: rgba(56, 139, 253, 0.3);
    color: var(--accent-color);
}

.action-btn.primary:hover {
    background: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
}

.action-btn.download {
    background: rgba(46, 160, 67, 0.1);
    border-color: rgba(46, 160, 67, 0.3);
    color: #3fb950;
}

.action-btn.download:hover {
    background: #2ea043;
    border-color: #2ea043;
    color: white;
}

/* Lightbox Styles - Redesigned */
.lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 1.5rem;
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox-window {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 28px;
    box-shadow: var(--shadow-xl);
    display: flex;
    flex-direction: column;
    max-width: 1000px;
    max-height: 90vh;
    width: 100%;
    overflow: hidden;
    position: relative;
    animation: modalSlideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

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

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

.lightbox-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.02);
}

.details-header-info {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lightbox-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[dir="rtl"] .lightbox-header,
[dir="rtl"] .lightbox-header-actions,
[dir="rtl"] .details-header-info {
    flex-direction: row-reverse;
}

.details-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem;
    background-color: var(--card-bg);
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.details-modal-body::-webkit-scrollbar {
    width: 6px;
}

.details-modal-body::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 10px;
}

.lightbox-title {
    font-weight: 700;
    font-size: 1.5rem;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.lightbox-action-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-action-btn:hover {
    background: var(--card-hover-bg);
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-2px);
}

.lightbox-action-btn.hidden {
    display: none;
}

.lightbox-close-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-close-btn:hover {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    transform: rotate(90deg) scale(1.1);
}

/* Global Transitions */
* {
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.project-card,
.action-btn,
.filter-badge,
.search-input,
.sort-select,
.lightbox-nav-btn,
.footer-icon {
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.lightbox-action-btn {
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 40px;
    height: 40px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* Markdown Content Styles */
.markdown-body {
    color: var(--text-primary);
    line-height: 1.8;
    font-size: 1.1rem;
}

[dir="rtl"] .markdown-body {
    text-align: right;
    direction: rtl;
    unicode-bidi: embed;
}

[dir="rtl"] .markdown-body p,
[dir="rtl"] .markdown-body li,
[dir="rtl"] .markdown-body a,
[dir="rtl"] .markdown-body code,
[dir="rtl"] .markdown-body h1,
[dir="rtl"] .markdown-body h2,
[dir="rtl"] .markdown-body h3,
[dir="rtl"] .markdown-body h4,
[dir="rtl"] .markdown-body h5,
[dir="rtl"] .markdown-body h6 {
    text-align: right;
    direction: rtl;
    unicode-bidi: embed;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: #fff;
    letter-spacing: -0.02em;
}

[dir="rtl"] .markdown-body h1,
[dir="rtl"] .markdown-body h2,
[dir="rtl"] .markdown-body h3 {
    letter-spacing: 0;
}

.markdown-body h1 {
    font-size: 2.25rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.4rem;
}

.markdown-body h2 {
    font-size: 1.75rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.3rem;
}

.markdown-body h3 {
    font-size: 1.4rem;
}

.markdown-body p {
    margin-bottom: 1.25rem;
}

[dir="rtl"] .markdown-body p {
    text-align: right;
}

.markdown-body a {
    color: var(--accent-color);
    text-decoration: none;
    font-weight: 500;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.markdown-body a:hover {
    border-bottom-color: var(--accent-color);
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 1.5rem;
    margin-bottom: 1.25rem;
}

[dir="rtl"] .markdown-body ul,
[dir="rtl"] .markdown-body ol {
    padding-left: 0;
    padding-right: 1.5rem;
}

.markdown-body li {
    margin-bottom: 0.4rem;
}

.markdown-body code {
    background-color: rgba(255, 255, 255, 0.05);
    padding: 0.2rem 0.4rem;
    border-radius: 8px;
    font-family: var(--font-code);
    font-size: 0.9em;
    color: var(--accent-color);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.markdown-body pre {
    background-color: #030712;
    border-radius: 16px;
    padding: 1.25rem;
    overflow: auto;
    margin: 1.25rem 0;
    border: 1px solid var(--border-color);
}

[dir="rtl"] .markdown-body pre {
    direction: ltr;
    text-align: left;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
    font-size: 0.95rem;
    color: var(--text-primary);
    border: none;
}

.markdown-body blockquote {
    margin: 1.5rem 0;
    padding: 0.75rem 1.25rem;
    color: var(--text-secondary);
    border-left: 4px solid var(--accent-color);
    background: rgba(96, 165, 250, 0.05);
    border-radius: 0 12px 12px 0;
}

[dir="rtl"] .markdown-body blockquote {
    border-left: none;
    border-right: 4px solid var(--accent-color);
    border-radius: 12px 0 0 12px;
}

.markdown-body img {
    max-width: 100%;
    border-radius: 20px;
    margin: 1.5rem 0;
    box-shadow: var(--shadow-lg);
}

.lightbox-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
    overflow: hidden;
    position: relative;
    min-height: 300px;
}

/* Details Modal Info Bar */
.details-info-bar {
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 20px;
    border: 1px solid var(--border-color);
}

.info-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.info-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.6;
}

[dir="rtl"] .info-label {
    letter-spacing: 0;
}

.details-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.details-tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.tech-tag {
    background: rgba(96, 165, 250, 0.1);
    color: var(--accent-color);
    padding: 0.5rem 1rem;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(96, 165, 250, 0.2);
    transition: all 0.3s ease;
}

.tech-tag:hover {
    background: rgba(96, 165, 250, 0.2);
    transform: translateY(-2px);
}


.details-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1.75rem;
    border-radius: 14px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 0.95rem;
    background: var(--bg-color);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-color);
    color: var(--accent-color);
}

.action-btn.primary {
    background: var(--accent-color);
    color: white;
    border: none;
}

.action-btn.primary:hover {
    background: var(--accent-hover);
    box-shadow: 0 10px 20px -10px rgba(96, 165, 250, 0.5);
    color: white;
}

.action-btn.download {
    background: var(--success-color);
    color: white;
    border: none;
}

.action-btn.download:hover {
    background: #059669;
    box-shadow: 0 10px 20px -10px rgba(16, 185, 129, 0.5);
    color: white;
}

.details-separator {
    margin: 2rem 0;
    border: 0;
    border-top: 1px solid var(--border-color);
    opacity: 0.5;
}

/* Project Gallery */
.project-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.25rem;
    margin: 2rem 0 3rem;
}

.gallery-item {
    position: relative;
    border-radius: 20px;
    overflow: hidden;
    aspect-ratio: 16/10;
    cursor: pointer;
    background: var(--bg-color);
    border: 1px solid var(--border-color);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.gallery-item img,
.gallery-item video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover {
    transform: translateY(-5px);
    border-color: var(--accent-color);
    box-shadow: var(--shadow-lg);
}

.gallery-item:hover img,
.gallery-item:hover video {
    transform: scale(1.05);
}

.play-overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 54px;
    height: 54px;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(8px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.25rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.gallery-item:hover .play-overlay {
    background: var(--accent-color);
    transform: translate(-50%, -50%) scale(1.1);
    border-color: transparent;
}

.lightbox-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2.5rem;
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    background: rgba(3, 7, 18, 0.8);
    backdrop-filter: blur(10px);
}

.lightbox-nav-btn {
    background: var(--card-hover-bg);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    width: 54px;
    height: 54px;
    border-radius: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-size: 1.1rem;
}

.lightbox-nav-btn:hover:not(:disabled) {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
    color: white;
    transform: translateY(-3px);
    box-shadow: 0 8px 15px -5px rgba(96, 165, 250, 0.4);
}

.lightbox-nav-btn:active:not(:disabled) {
    transform: translateY(-1px);
}

.lightbox-nav-btn:disabled {
    opacity: 0.15;
    cursor: not-allowed;
    filter: grayscale(1);
}

.lightbox-counter {
    font-family: var(--font-code);
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 700;
    background: rgba(255, 255, 255, 0.05);
    padding: 0.5rem 1.25rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

/* Media Styles inside body */
.lightbox-img,
.lightbox-body video {
    max-width: 100%;
    max-height: 80vh;
    width: auto;
    height: auto;
    display: block;
    border-radius: 12px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
}

.lightbox-body iframe {
    width: 90vw;
    height: 50.625vw;
    /* 16:9 Aspect Ratio */
    max-width: 1100px;
    max-height: 618px;
    border: none;
    border-radius: 20px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.5);
}

/* Mobile Adjustments for Modal */
@media (max-width: 640px) {
    .details-info-bar {
        padding: 1.5rem;
        flex-direction: column;
        align-items: flex-start;
    }

    .details-actions {
        width: 100%;
    }

    .action-btn {
        width: 100%;
        justify-content: center;
    }

    .lightbox-window {
        border-radius: 0;
        max-height: 100vh;
        height: 100%;
    }

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

/* Footer */
.footer {
    text-align: center;
    padding: 6rem 0 3rem;
    color: var(--text-secondary);
    font-size: 1rem;
    border-top: 1px solid var(--border-color);
    margin-top: 4rem;
}

.footer-social {
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    gap: 1.5rem;
}

.footer-icon {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    text-decoration: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.footer-icon:hover {
    border-color: var(--accent-color);
    color: var(--accent-color);
    transform: translateY(-5px);
    box-shadow: 0 10px 20px -10px rgba(96, 165, 250, 0.3);
}

/* RTL & Arabic Support */
[lang='ar'] {
    --font-main: 'Tajawal', sans-serif;
}

[dir='rtl'] .search-input {
    padding: 0.85rem 3rem 0.85rem 1rem;
}

[dir='rtl'] .search-icon {
    left: auto;
    right: 1.25rem;
}

[dir='rtl'] .sort-select {
    background-position: left 1.25rem top 50%;
    padding: 0.85rem 1.25rem 0.85rem 2.5rem;
}

[dir='rtl'] .details-modal-body {
    direction: rtl;
    text-align: right;
}

[dir='rtl'] .markdown-body blockquote {
    border-left: none;
    border-right: 4px solid var(--accent-color);
    border-radius: 12px 0 0 12px;
}

[dir='rtl'] .action-btn i {
    margin-left: 0;
    margin-right: 0.75rem;
    transform: rotate(180deg);
}

[dir='rtl'] .action-btn i.fa-download,
[dir='rtl'] .action-btn i.fab {
    transform: none;
}

[dir='rtl'] .version-badge {
    margin-right: 0;
    margin-left: auto;
}

[dir='rtl'] .lightbox-close-btn {
    left: 2rem;
    right: auto;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

/* Media Queries */
@media (max-width: 768px) {
    .container {
        padding: 1.5rem;
    }

    .profile-name {
        font-size: 2.5rem;
    }

    .social-links {
        flex-direction: column;
        width: 100%;
        gap: 1rem;
    }

    .social-link {
        width: 100%;
        justify-content: center;
    }

    .controls-bar {
        flex-direction: column;
        align-items: stretch;
        padding: 1.5rem;
    }

    .sort-select {
        min-width: 0;
    }

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

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

/* Admin Panel Styles */
.admin-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
}

.admin-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.project-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.project-list-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 1.5rem;
    padding: 1.5rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    align-items: center;
    transition: all 0.2s;
}

.project-list-item:hover {
    border-color: var(--accent-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.item-drag-handle {
    color: var(--text-secondary);
    cursor: grab;
    padding: 0.5rem;
}

.item-drag-handle:hover {
    color: var(--text-primary);
}

.item-content {
    min-width: 0;
    /* Fix grid overflow */
}

.item-title {
    font-weight: 600;
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    color: var(--text-primary);
}

.item-meta {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    gap: 1rem;
    align-items: center;
}

.item-actions {
    display: flex;
    gap: 0.5rem;
}

.item-btn {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.item-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: var(--text-primary);
}

.item-btn.edit {
    color: var(--accent-color);
    border-color: rgba(88, 166, 255, 0.3);
    background: rgba(88, 166, 255, 0.1);
}

.item-btn.edit:hover {
    background: var(--accent-color);
    color: white;
}

.item-btn.delete {
    color: #f85149;
    border-color: rgba(248, 81, 73, 0.3);
    background: rgba(248, 81, 73, 0.1);
}

.item-btn.delete:hover {
    background: #f85149;
    color: white;
}