/* ===========================================
   Jawad Khaled Portfolio - Stylesheet  
   =========================================== */

:root {
    /* Dark theme (default) */
    --bg: #0a0a0f;
    --bg-alt: #111118;
    --surface: #1a1a24;
    --border: #2a2a3a;
    --text: #e4e4ef;
    --text-muted: #8888a0;
    --primary: #6366f1;
    --primary-light: #818cf8;
    --primary-dark: #4f46e5;
    --accent: #06b6d4;
    --nav-bg: rgba(10, 10, 15, 0.8);
    --font: 'Inter', 'Noto Sans Arabic', -apple-system, BlinkMacSystemFont, sans-serif;
    --radius: 12px;
    --radius-sm: 8px;
    --transition: 0.3s ease;
}

/* Light theme */
[data-theme="light"] {
    --bg: #f8f9fc;
    --bg-alt: #eef0f5;
    --surface: #ffffff;
    --border: #d8dce6;
    --text: #1a1a2e;
    --text-muted: #555570;
    --nav-bg: rgba(248, 249, 252, 0.85);
}

/* RTL adjustments */
[dir="rtl"] {
    direction: rtl;
}

[dir="rtl"] .section-title::after {
    left: auto;
    right: 0;
}

[dir="rtl"] .project-badge {
    right: auto;
    left: 16px;
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: 80px;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    transition: background var(--transition), color var(--transition);
}

a {
    text-decoration: none;
    color: inherit;
}

img {
    max-width: 100%;
    display: block;
}

.container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
}

/* ============ Nav ============ */
.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--nav-bg);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition), background var(--transition);
}

.nav.scrolled {
    border-bottom-color: var(--border);
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    height: 64px;
}

.nav-logo {
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    color: var(--text);
    flex-shrink: 0;
}

.nav-logo .dot {
    color: var(--primary);
}

.nav-links {
    display: flex;
    gap: 28px;
    list-style: none;
    margin-left: 40px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    padding-left: 20px;
}

.nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0 10px;
    height: 28px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 14px;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 0.72rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    letter-spacing: 0.3px;
}

.nav-btn:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.4);
    color: var(--text);
}

.nav-btn-icon {
    width: 13px;
    height: 13px;
    flex-shrink: 0;
}

[data-theme="light"] .nav-btn {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="light"] .nav-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--primary-dark);
}

/* Theme icon emoji in button */
#themeIcon {
    font-size: 13px;
    line-height: 1;
}

.nav-links a {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    transition: color var(--transition);
    position: relative;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--text);
}

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--primary);
    transition: width var(--transition);
    border-radius: 2px;
}

.nav-links a:hover::after {
    width: 100%;
}

.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    order: 4;
}

.nav-toggle span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text);
    border-radius: 2px;
    transition: var(--transition);
}

/* ============ Hero ============ */
.hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.hero-gradient {
    position: absolute;
    top: -30%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
    pointer-events: none;
}

[data-theme="light"] .hero-gradient {
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
}

.hero-grid {
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.02) 1px, transparent 1px);
    background-size: 60px 60px;
    -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 70%);
}

[data-theme="light"] .hero-grid {
    background-image:
        linear-gradient(rgba(0,0,0,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0,0,0,0.04) 1px, transparent 1px);
}

.hero-content {
    position: relative;
    z-index: 1;
    padding-top: 100px;
}

.hero-greeting {
    font-size: 1rem;
    font-weight: 500;
    color: var(--primary-light);
    margin-bottom: 8px;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.hero-name {
    font-size: clamp(2.5rem, 6vw, 4.5rem);
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1.1;
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--text) 0%, var(--text-muted) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero-title {
    font-size: clamp(1.2rem, 3vw, 1.6rem);
    font-weight: 400;
    color: var(--text-muted);
    margin-bottom: 20px;
}

.hero-title .amp {
    color: var(--primary);
    font-weight: 600;
}

.hero-desc {
    font-size: 1.05rem;
    color: var(--text-muted);
    max-width: 540px;
    margin-bottom: 32px;
    line-height: 1.8;
}

.hero-cta {
    display: flex;
    gap: 16px;
    margin-bottom: 60px;
}

.hero-stats {
    display: flex;
    gap: 48px;
}

.hero-visuals {
    margin-top: 40px;
    display: grid;
    grid-template-columns: 1.2fr 0.9fr 1fr;
    gap: 12px;
}

.hero-visual-card {
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--surface);
    min-height: 170px;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.24);
}

[data-theme="light"] .hero-visual-card {
    box-shadow: 0 12px 24px rgba(20, 26, 70, 0.08);
}

.hero-visual-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.stat {
    text-align: center;
}

.stat-num {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    color: var(--text);
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* ============ Buttons ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 28px;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border: none;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(99, 102, 241, 0.3);
}

.btn-outline {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-outline:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.btn-sm {
    padding: 8px 20px;
    font-size: 0.8rem;
}

.btn.disabled {
    opacity: 0.5;
    cursor: default;
    pointer-events: none;
}

/* ============ Sections ============ */
.section {
    padding: 100px 0;
}

.section-alt {
    background: var(--bg-alt);
    transition: background var(--transition);
}

.section-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: 48px;
    letter-spacing: -1px;
    position: relative;
    display: inline-block;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: -8px;
    left: 0;
    width: 48px;
    height: 3px;
    background: var(--primary);
    border-radius: 3px;
}

/* ============ About ============ */
.about-text p {
    color: var(--text-muted);
    margin-bottom: 16px;
    font-size: 1.05rem;
}

.about-highlights {
    margin-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.highlight {
    display: flex;
    gap: 16px;
    align-items: flex-start;
}

.highlight-icon {
    color: var(--primary);
    font-size: 0.8rem;
    margin-top: 4px;
    flex-shrink: 0;
}

.highlight strong {
    display: block;
    color: var(--text);
    margin-bottom: 2px;
}

.highlight p {
    font-size: 0.9rem !important;
    margin-bottom: 0 !important;
}

/* ============ Skills ============ */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 24px;
}

.skill-category {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    transition: border-color var(--transition), background var(--transition);
}

.skill-category:hover {
    border-color: var(--primary);
}

.skill-category h3 {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--primary-light);
    margin-bottom: 16px;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    padding: 4px 12px;
    background: rgba(99, 102, 241, 0.1);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* ============ Projects ============ */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 24px;
}

.project-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    transition: all var(--transition);
    position: relative;
    display: flex;
    flex-direction: column;
    cursor: pointer;
}

.project-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .project-card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.1);
}

.project-card.featured {
    border-color: var(--primary);
    grid-column: 1 / -1;
    background: linear-gradient(135deg, var(--surface) 0%, rgba(99, 102, 241, 0.05) 100%);
}

.project-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--primary);
    color: white;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.project-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.project-icon {
    font-size: 1.5rem;
}

.project-header h3 {
    font-size: 1.2rem;
    font-weight: 700;
}

.project-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.7;
    flex: 1;
    margin-bottom: 20px;
}

.project-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.project-tech span {
    padding: 3px 10px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.15);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent);
    font-weight: 500;
}

.project-links {
    display: flex;
    gap: 12px;
}

/* ============ Contact ============ */
.contact-content {
    max-width: 600px;
}

.contact-desc {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 32px;
}

.contact-methods {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: all var(--transition);
    font-size: 0.95rem;
    color: var(--text-muted);
}

.contact-card:hover {
    border-color: var(--primary);
    color: var(--text);
}

.contact-icon {
    font-size: 1.2rem;
    color: var(--primary-light);
    display: flex;
    align-items: center;
}

.contact-icon svg {
    width: 20px;
    height: 20px;
}

/* ============ Footer ============ */
.footer {
    padding: 32px 0;
    border-top: 1px solid var(--border);
    text-align: center;
    transition: border-color var(--transition);
}

.footer p {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .nav-toggle {
        display: flex;
        margin-left: 8px;
    }

    .nav-links {
        position: fixed;
        top: 64px;
        left: 0;
        right: 0;
        background: var(--bg);
        border-bottom: 1px solid var(--border);
        flex-direction: column;
        gap: 0;
        padding: 16px 24px;
        margin-left: 0;
        transform: translateY(-100%);
        opacity: 0;
        pointer-events: none;
        transition: all var(--transition);
    }

    .nav-links.open {
        transform: translateY(0);
        opacity: 1;
        pointer-events: auto;
    }

    .nav-links a {
        display: block;
        padding: 12px 0;
    }

    .nav-controls {
        margin-left: auto;
        padding-left: 0;
    }

    .nav-btn span:not(.nav-btn-icon) {
        display: none;
    }

    .nav-btn {
        width: 28px;
        height: 28px;
        padding: 0;
        justify-content: center;
    }

    .hero-cta {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-stats {
        gap: 32px;
    }

    .hero-visuals {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .hero-visual-card {
        min-height: 150px;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }

    .project-card.featured {
        grid-column: 1;
    }

    .skills-grid {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 480px) {
    .skills-grid {
        grid-template-columns: 1fr;
    }

    .hero-stats {
        gap: 24px;
    }

    .stat-num {
        font-size: 1.5rem;
    }
}

/* ============ Animations ============ */
.fade-in {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ============ Project Detail Page ============ */
.detail-page {
    min-height: 100vh;
    padding-top: 100px;
    padding-bottom: 60px;
}

.detail-back {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--primary-light);
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 32px;
    transition: color var(--transition);
}

.detail-back:hover {
    color: var(--primary);
}

.detail-back svg {
    width: 20px;
    height: 20px;
}

[dir="rtl"] .detail-back svg {
    transform: rotate(180deg);
}

.detail-header {
    margin-bottom: 40px;
}

.detail-header h1 {
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 16px;
}

.detail-header .project-icon {
    font-size: 2.5rem;
    margin-bottom: 12px;
}

.detail-desc {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.9;
    max-width: 780px;
    white-space: pre-line;
    margin-bottom: 32px;
}

.detail-tech {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
}

.detail-tech span {
    padding: 6px 16px;
    background: rgba(6, 182, 212, 0.1);
    border: 1px solid rgba(6, 182, 212, 0.2);
    border-radius: 6px;
    font-size: 0.85rem;
    color: var(--accent);
    font-weight: 500;
}

.detail-actions {
    display: flex;
    gap: 12px;
    margin-bottom: 48px;
}

/* Gallery */
.gallery-section h2 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 24px;
    color: var(--text);
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.gallery-item {
    border-radius: var(--radius);
    overflow: hidden;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all var(--transition);
    aspect-ratio: 16/10;
    background: var(--surface);
}

.gallery-item:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.gallery-empty {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* Lightbox */
.lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0,0,0,0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.lightbox.active {
    opacity: 1;
    pointer-events: auto;
}

.lightbox img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============ Admin Page ============ */
.admin-page {
    min-height: 100vh;
    padding-top: 100px;
    padding-bottom: 60px;
}

.admin-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 32px;
    margin-bottom: 24px;
}

.admin-card h2 {
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group select,
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"] {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--font);
    font-size: 0.9rem;
    transition: border-color var(--transition);
}

.form-group select:focus,
.form-group input:focus {
    outline: none;
    border-color: var(--primary);
}

.admin-images-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 12px;
    margin-top: 20px;
}

.admin-img-item {
    position: relative;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
    aspect-ratio: 16/10;
    background: var(--bg);
}

.admin-img-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.admin-img-delete {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 28px;
    height: 28px;
    background: rgba(239, 68, 68, 0.9);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 0.9rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity var(--transition);
}

.admin-img-item:hover .admin-img-delete {
    opacity: 1;
}

.status-msg {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
}

.status-msg.success {
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #22c55e;
}

.status-msg.error {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #ef4444;
}
