/* =======================================================
   FONTS & ROOT VARIABLES
======================================================= */
@import url('https://fonts.googleapis.com/css2?family=Fira+Code:wght@400;500;600;700&family=Vazirmatn:wght@300;400;500;600;700;800;900&display=swap');

:root {
    --matrix-green: #00ff41;
    --matrix-green-glow: #00ff66;
    --matrix-green-soft: #00cc33;
    --matrix-green-dim: rgba(0, 255, 65, 0.15);
    --matrix-dark: #050805;
    --card-bg: rgba(0, 20, 5, 0.55);
    --card-bg-hover: rgba(0, 30, 8, 0.75);
    --border-color: rgba(0, 255, 65, 0.3);
    --border-bright: rgba(0, 255, 65, 0.6);
    --text-color: #f0fff4;
    --text-muted: #a3d9b1;
    --shadow-glow: 0 0 10px rgba(0, 255, 65, 0.5);
    --shadow-strong: 0 0 25px rgba(0, 255, 65, 0.7);
    --radius: 14px;
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --container-width: 1240px;
}

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

html {
    scroll-behavior: smooth;
}

body {
    background: #030603;
    color: var(--text-color);
    font-family: "Vazirmatn", "Fira Code", monospace, sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.8;
    text-shadow: 0 0 2px rgba(0, 255, 65, 0.2);
}

/* =======================================================
   MATRIX BACKGROUND CANVAS
======================================================= */
#matrixCanvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.38;
    pointer-events: none;
}

/* =======================================================
   LOADER
======================================================= */
#loader {
    position: fixed;
    inset: 0;
    background: #020402;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.6s ease, visibility 0.6s ease;
}

#loader.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loader-container {
    text-align: center;
    padding: 20px;
}

.loader-title {
    color: var(--matrix-green);
    font-size: 1.35rem;
    font-weight: 700;
    font-family: "Fira Code", monospace;
    margin-bottom: 25px;
    text-shadow: var(--shadow-strong);
    letter-spacing: 2px;
}

.loader-spinner {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 4px solid rgba(0, 255, 65, 0.15);
    border-top-color: var(--matrix-green);
    border-right-color: var(--matrix-green-soft);
    margin: 0 auto;
    animation: spin 0.9s linear infinite;
    box-shadow: var(--shadow-glow);
}

.loader-dots {
    margin-top: 22px;
    font-family: "Fira Code", monospace;
    color: #e0ffe5;
    font-size: 1.1rem;
}

.loader-message {
    margin-top: 15px;
    color: var(--matrix-green-soft);
    font-family: "Fira Code", monospace;
    font-size: 0.95rem;
}

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

/* =======================================================
   LANGUAGE SWITCHER
======================================================= */
.language-switcher {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    gap: 8px;
    z-index: 10000;
}

.lang-btn {
    background: rgba(0, 15, 5, 0.85);
    color: var(--matrix-green);
    border: 1px solid var(--matrix-green);
    min-width: 46px;
    min-height: 44px;
    padding: 6px 14px;
    border-radius: 8px;
    cursor: pointer;
    font-family: "Fira Code", monospace;
    font-weight: 700;
    font-size: 0.95rem;
    transition: var(--transition);
    backdrop-filter: blur(8px);
}

.lang-btn:hover,
.lang-btn.active {
    background: var(--matrix-green);
    color: #000;
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.85);
}

/* =======================================================
   MAIN CONTAINER
======================================================= */
#mainContent {
    max-width: var(--container-width);
    margin: 0 auto;
    padding: 30px 20px 80px;
}

/* =======================================================
   HERO SECTION
======================================================= */
.hero {
    text-align: center;
    padding: 60px 20px 40px;
}

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

.profile-wrapper {
    display: flex;
    justify-content: center;
    margin-bottom: 25px;
    position: relative;
}

.profile-image {
    width: 175px;
    height: 175px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--matrix-green);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.5), 0 0 50px rgba(0, 255, 65, 0.2);
    transition: var(--transition);
    background: #000;
}

.profile-image:hover {
    transform: scale(1.06);
    box-shadow: 0 0 30px rgba(0, 255, 65, 0.8), 0 0 70px rgba(0, 255, 65, 0.4);
}

/* Glitch Title */
.glitch {
    position: relative;
    font-size: clamp(2.2rem, 5.5vw, 3.8rem);
    font-weight: 900;
    color: var(--matrix-green);
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.7), 0 0 25px rgba(0, 255, 65, 0.4);
    letter-spacing: -0.5px;
    margin-bottom: 12px;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
}

.glitch::before {
    left: 2px;
    color: #33ff66;
    animation: glitchTop 2.5s infinite linear;
}

.glitch::after {
    left: -2px;
    color: #00ffaa;
    animation: glitchBottom 2s infinite linear;
}

@keyframes glitchTop {
    0%, 100% { clip-path: inset(0 0 95% 0); }
    20% { clip-path: inset(15% 0 55% 0); }
    40% { clip-path: inset(40% 0 30% 0); }
    60% { clip-path: inset(70% 0 10% 0); }
    80% { clip-path: inset(25% 0 50% 0); }
}

@keyframes glitchBottom {
    0%, 100% { clip-path: inset(80% 0 5% 0); }
    20% { clip-path: inset(50% 0 25% 0); }
    40% { clip-path: inset(10% 0 65% 0); }
    60% { clip-path: inset(60% 0 20% 0); }
    80% { clip-path: inset(30% 0 45% 0); }
}

.hero-subtitle {
    color: #b7ffc6;
    font-size: 1.15rem;
    font-weight: 500;
    line-height: 1.9;
    max-width: 900px;
    margin: 15px auto 25px;
}

/* Quick Info Badges in Hero */
.hero-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 20px;
}

.hero-badge-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 255, 65, 0.08);
    border: 1px solid rgba(0, 255, 65, 0.25);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.92rem;
    color: #e5ffe9;
    transition: var(--transition);
}

.hero-badge-item:hover {
    background: rgba(0, 255, 65, 0.18);
    border-color: var(--matrix-green);
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(0, 255, 65, 0.3);
}

.hero-badge-item i {
    color: var(--matrix-green);
}

/* =======================================================
   CARDS & SECTIONS
======================================================= */
.card {
    background: var(--card-bg);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    margin-bottom: 28px;
    padding: 30px;
    transition: var(--transition);
    box-shadow: 0 0 15px rgba(0, 255, 65, 0.06);
    overflow: hidden;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.22);
    border-color: var(--border-bright);
}

.section-title {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    font-size: 1.38rem;
    font-weight: 700;
    color: var(--matrix-green);
    border-bottom: 1px solid rgba(0, 255, 65, 0.18);
    padding-bottom: 12px;
}

.section-title i {
    color: var(--matrix-green);
    font-size: 1.3rem;
    filter: drop-shadow(0 0 6px var(--matrix-green));
}

.section-content p {
    margin-bottom: 14px;
    color: #e8ffee;
    font-size: 1.02rem;
    line-height: 2;
}

.matrix-signature {
    margin-top: 25px;
    padding-top: 14px;
    border-top: 1px dashed rgba(0, 255, 65, 0.25);
    color: #6cff8f;
    font-family: "Fira Code", monospace;
    font-size: 0.95rem;
}

/* =======================================================
   METRICS & STATS DASHBOARD
======================================================= */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 18px;
}

.dashboard-card {
    background: rgba(0, 20, 0, 0.35);
    border: 1px solid rgba(0, 255, 65, 0.22);
    border-radius: 12px;
    padding: 22px 16px;
    text-align: center;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 0 20px rgba(0, 255, 65, 0.25);
    border-color: var(--matrix-green);
    background: rgba(0, 30, 8, 0.55);
}

.dashboard-card i {
    font-size: 2.2rem;
    color: var(--matrix-green);
    margin-bottom: 12px;
    filter: drop-shadow(0 0 8px rgba(0, 255, 65, 0.4));
}

.dashboard-value {
    font-family: "Fira Code", monospace;
    font-size: 1.55rem;
    font-weight: 700;
    color: var(--matrix-green);
    margin-bottom: 6px;
    text-shadow: 0 0 10px rgba(0, 255, 65, 0.5);
}

.dashboard-card h3 {
    color: #ffffff;
    font-size: 1.02rem;
    font-weight: 600;
    margin-bottom: 6px;
}

.dashboard-card span {
    color: var(--text-muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

/* =======================================================
   TECHNICAL STACK (SKILLS CATEGORIES)
======================================================= */
.skills-categories {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.skill-category-box {
    background: rgba(0, 15, 3, 0.45);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 12px;
    padding: 22px;
    transition: var(--transition);
}

.skill-category-box:hover {
    border-color: rgba(0, 255, 65, 0.45);
    background: rgba(0, 22, 5, 0.65);
}

.skill-cat-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}

.skill-cat-header i {
    font-size: 1.4rem;
    color: var(--matrix-green);
}

.skill-cat-header h3 {
    font-size: 1.18rem;
    font-weight: 700;
    color: var(--matrix-green);
}

.skill-items-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

.skill-item-card {
    background: rgba(0, 25, 6, 0.35);
    border: 1px solid rgba(0, 255, 65, 0.15);
    border-radius: 10px;
    padding: 16px;
    transition: var(--transition);
}

.skill-item-card:hover {
    border-color: var(--matrix-green);
    transform: translateY(-3px);
    box-shadow: 0 0 14px rgba(0, 255, 65, 0.2);
}

.skill-item-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: #e5ffe8;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.skill-item-title i {
    color: var(--matrix-green);
    font-size: 0.95rem;
}

.skill-item-desc {
    color: #bce9c7;
    font-size: 0.92rem;
    line-height: 1.85;
}

/* Tags Inside Skills */
.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 10px;
}

.tech-tag {
    background: rgba(0, 255, 65, 0.08);
    border: 1px solid rgba(0, 255, 65, 0.25);
    color: #aeffba;
    padding: 2px 10px;
    border-radius: 6px;
    font-family: "Fira Code", monospace;
    font-size: 0.78rem;
    font-weight: 500;
}

/* =======================================================
   PROJECTS SECTION (EXPANDED GRID)
======================================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

.project-card {
    background: rgba(0, 18, 4, 0.45);
    border: 1px solid rgba(0, 255, 65, 0.22);
    border-radius: 14px;
    padding: 24px;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--matrix-green);
    opacity: 0.6;
    transition: var(--transition);
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--matrix-green);
    background: rgba(0, 26, 7, 0.7);
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.22);
}

.project-card:hover::before {
    opacity: 1;
    box-shadow: 0 0 10px var(--matrix-green);
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 12px;
}

.project-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--matrix-green);
    display: flex;
    align-items: center;
    gap: 10px;
}

.project-title i {
    font-size: 1.15rem;
}

.project-status-badge {
    background: rgba(0, 255, 65, 0.12);
    border: 1px solid var(--matrix-green);
    color: var(--matrix-green);
    font-size: 0.75rem;
    font-family: "Fira Code", monospace;
    padding: 3px 8px;
    border-radius: 12px;
    white-space: nowrap;
}

.project-desc {
    color: #daf5de;
    font-size: 0.94rem;
    line-height: 1.85;
    margin-bottom: 16px;
}

.project-techs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: auto;
    padding-top: 14px;
    border-top: 1px dashed rgba(0, 255, 65, 0.15);
}

/* =======================================================
   EDUCATION & PERSONAL INTERESTS
======================================================= */
.two-col-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 22px;
}

.info-item-block {
    background: rgba(0, 20, 5, 0.35);
    border: 1px solid rgba(0, 255, 65, 0.2);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
}

.info-item-block h4 {
    color: var(--matrix-green);
    font-size: 1.05rem;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.info-item-block p {
    color: #cffcd7;
    font-size: 0.94rem;
    line-height: 1.8;
}

.interests-tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 12px;
}

.interest-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 255, 65, 0.07);
    border: 1px solid rgba(0, 255, 65, 0.25);
    color: #d1ffdb;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 0.92rem;
    transition: var(--transition);
}

.interest-pill:hover {
    background: rgba(0, 255, 65, 0.18);
    border-color: var(--matrix-green);
    transform: translateY(-2px);
    box-shadow: 0 0 10px rgba(0, 255, 65, 0.3);
}

.interest-pill i {
    color: var(--matrix-green);
}

/* =======================================================
   INTERACTIVE LINUX TERMINAL CONSOLE
======================================================= */
.terminal {
    background: #040804;
    border: 1.5px solid var(--matrix-green);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.18);
}

.terminal-header {
    background: rgba(0, 255, 65, 0.1);
    border-bottom: 1px solid rgba(0, 255, 65, 0.25);
    padding: 10px 16px;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.terminal-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.dot-red { background: #ff5f56; }
.dot-yellow { background: #ffbd2e; }
.dot-green { background: #27c93f; }

.terminal-screen {
    height: 300px;
    overflow-y: auto;
    padding: 18px 20px;
    font-family: "Fira Code", monospace;
    font-size: 0.92rem;
    line-height: 1.85;
    cursor: text;
    direction: ltr;
    text-align: left;
}

.terminal-screen::-webkit-scrollbar {
    width: 8px;
}

.terminal-screen::-webkit-scrollbar-thumb {
    background: rgba(0, 255, 65, 0.35);
    border-radius: 4px;
}

.terminal-history {
    white-space: pre-wrap;
    word-break: break-word;
    color: #afffbd;
    margin-bottom: 6px;
}

.terminal-prompt-row {
    display: flex;
    align-items: center;
    gap: 8px;
    direction: ltr;
}

.terminal-prompt-user {
    color: var(--matrix-green);
    font-weight: 700;
    white-space: nowrap;
    user-select: none;
    font-family: "Fira Code", monospace;
}

.terminal-input-field {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: #ffffff;
    font-family: "Fira Code", monospace;
    font-size: 0.92rem;
    caret-color: var(--matrix-green);
    padding: 0;
    margin: 0;
    direction: ltr;
    text-align: left;
}

/* =======================================================
   CONTACT FORM
======================================================= */
#contactForm {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}

#contactForm input,
#contactForm textarea {
    width: 100%;
    background: rgba(0, 10, 3, 0.75);
    color: #ffffff;
    border: 1px solid var(--matrix-green);
    border-radius: 8px;
    padding: 14px 16px;
    font-family: inherit;
    font-size: 0.98rem;
    outline: none;
    transition: var(--transition);
}

#contactForm input:focus,
#contactForm textarea:focus {
    box-shadow: 0 0 18px rgba(0, 255, 65, 0.4);
    border-color: #33ff66;
    background: rgba(0, 20, 5, 0.9);
}

#contactForm textarea {
    resize: vertical;
    min-height: 160px;
}

#contactForm button {
    background: rgba(0, 255, 65, 0.05);
    color: var(--matrix-green);
    border: 1.5px solid var(--matrix-green);
    padding: 15px;
    min-height: 52px;
    cursor: pointer;
    border-radius: 8px;
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 700;
    transition: var(--transition);
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
}

#contactForm button:hover {
    background: var(--matrix-green);
    color: #000000;
    box-shadow: 0 0 25px rgba(0, 255, 65, 0.55);
}

#formStatus {
    text-align: center;
    margin: 15px 0;
    font-size: 1rem;
    font-family: "Fira Code", monospace;
}

/* =======================================================
   CONTACT LINKS
======================================================= */
.contact-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.contact-link {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    color: var(--matrix-green);
    background: rgba(0, 20, 5, 0.4);
    border: 1px solid rgba(0, 255, 65, 0.3);
    border-radius: 10px;
    padding: 12px 22px;
    transition: var(--transition);
    font-weight: 600;
}

.contact-link i {
    font-size: 1.25rem;
}

.contact-link:hover {
    transform: translateY(-4px);
    box-shadow: 0 0 18px rgba(0, 255, 65, 0.4);
    border-color: var(--matrix-green);
    background: rgba(0, 255, 65, 0.1);
    color: #ffffff;
}

/* =======================================================
   FOOTER
======================================================= */
.footer {
    margin-top: 60px;
    padding: 25px 20px;
    border-top: 1px solid rgba(0, 255, 65, 0.18);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 14px;
    color: #8cbaa0;
    font-size: 0.95rem;
}

.footer-left {
    font-family: "Fira Code", monospace;
}

.footer-right {
    color: var(--matrix-green);
    font-family: "Fira Code", monospace;
}

#footer-ip {
    color: #ffffff;
    font-weight: 700;
}

/* =======================================================
   RESPONSIVE DESIGN (TABLET & MOBILE)
======================================================= */
@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .projects-grid {
        grid-template-columns: 1fr;
    }
    .skill-items-grid {
        grid-template-columns: 1fr;
    }
    .two-col-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    #mainContent {
        padding: 20px 14px 60px;
    }
    .hero {
        padding: 40px 10px 25px;
    }
    .hero-subtitle {
        font-size: 1.02rem;
    }
    .profile-image {
        width: 140px;
        height: 140px;
    }
    .card {
        padding: 20px 16px;
    }
    .section-title {
        font-size: 1.18rem;
    }
    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .form-row {
        grid-template-columns: 1fr;
    }
    .contact-links {
        flex-direction: column;
    }
    .contact-link {
        width: 100%;
        justify-content: center;
    }
    .footer {
        flex-direction: column;
        text-align: center;
    }
    .language-switcher {
        top: 12px;
        left: 12px;
    }
    .lang-btn {
        min-width: 42px;
        min-height: 42px;
        padding: 6px 12px;
        font-size: 0.85rem;
    }
}

@media (max-width: 480px) {
    .glitch {
        font-size: 1.9rem;
    }
    .dashboard-value {
        font-size: 1.35rem;
    }
    .hero-badge-item {
        font-size: 0.82rem;
        padding: 6px 12px;
    }
}

/* =======================================================
   ENGLISH (LTR) & PERSIAN (RTL) MODES
======================================================= */
html[dir="ltr"] body {
    direction: ltr;
    text-align: left;
    font-family: "Fira Code", monospace, sans-serif;
}

html[dir="ltr"] .section-title {
    justify-content: flex-start;
}

html[dir="ltr"] .project-card::before {
    left: 0;
    right: auto;
}

html[dir="ltr"] .terminal-output,
html[dir="ltr"] .matrix-signature {
    text-align: left;
}

html[dir="ltr"] input,
html[dir="ltr"] textarea {
    direction: ltr;
    text-align: left;
}

html[dir="rtl"] body {
    direction: rtl;
    text-align: right;
    font-family: "Vazirmatn", "Fira Code", sans-serif;
}

html[dir="rtl"] .section-title {
    justify-content: flex-start;
}

html[dir="rtl"] .project-card::before {
    right: 0;
    left: auto;
}

html[dir="rtl"] input,
html[dir="rtl"] textarea {
    direction: rtl;
    text-align: right;
}
