/* ============================================
   FULL MODERN DARK THEME – Open, Breathable & Professional
   Covers all pages: index, about, blog, auth, dashboard, file, portfolio, post
   ============================================ */

:root {
    /* Surfaces */
    --bg-deep: #0b0d12;
    --bg-surface: #12161e;
    --bg-elevated: #1a1f2b;
    --border-subtle: rgba(255, 255, 255, 0.07);
    --border-glow: rgba(99, 102, 241, 0.2);

    /* Text */
    --text-primary: #eef2fa;
    --text-secondary: #929db8;
    --text-muted: #6b7590;

    /* Accent */
    --accent-primary: #6366f1;
    --accent-soft: #818cf8;
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.25);

    /* Status */
    --danger: #ef4444;
    --success: #10b981;

    /* Spacing */
    --radius-sm: 10px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --transition-fast: 0.2s ease;
    --transition-smooth: 0.25s cubic-bezier(0.2, 0.9, 0.4, 1.1);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    font-size: 1rem;
}

html[dir="ltr"] body {
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
    text-align: left;
}

html[dir="ltr"] button,
html[dir="ltr"] input,
html[dir="ltr"] select,
html[dir="ltr"] option {
    font-family:
        "Inter",
        system-ui,
        -apple-system,
        "Segoe UI",
        sans-serif;
}

html[dir="rtl"] button,
html[dir="rtl"] input,
html[dir="rtl"] select,
html[dir="rtl"] option {
    font-family: "Vazirmatn", "Inter", sans-serif;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}
::-webkit-scrollbar-track {
    background: var(--bg-surface);
}
::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: var(--accent-hover);
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}
h1 {
    font-size: clamp(2.2rem, 5vw, 3.6rem);
    margin-bottom: 1rem;
}
h2 {
    font-size: clamp(1.6rem, 4vw, 2.3rem);
    margin-bottom: 2rem;
    position: relative;
}
h2::after {
    content: "";
    position: absolute;
    bottom: -10px;
    left: 0;
    width: 48px;
    height: 3px;
    background: var(--accent-primary);
    border-radius: 3px;
}
html[dir="rtl"] h2::after {
    left: unset;
    right: 0;
}

a {
    color: var(--accent-primary);
    text-decoration: none;
    transition: var(--transition-fast);
}
a:hover {
    color: var(--accent-soft);
}

.container {
    max-width: 1140px;
    margin: 0 auto;
    padding: 0 2rem;
    width: 100%;
}
/* Make project and blog sections horizontally scrollable on homepage only */
.index-page .project-grid,
.index-page .blog-grid {
    display: flex;
    flex-wrap: nowrap;          /* prevent wrapping */
    overflow-x: auto;           /* enable horizontal scroll */
    gap: 2rem;
    padding-bottom: 1rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}
.index-page .project-grid .card,
.index-page .blog-grid .card {
    flex: 0 0 300px; /* fixed width, adjust as needed */
    scroll-snap-align: start;
}
/* For touch devices – smooth scrolling */
.index-page .project-grid,
.index-page .blog-grid {
    -webkit-overflow-scrolling: touch;
}
/* Glassmorphism card – open and subtle */
.glass-card {
    background: rgba(26, 31, 43, 0.55);
    backdrop-filter: blur(8px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 2rem;
    transition:
        transform var(--transition-smooth),
        box-shadow var(--transition-smooth);
}
.glass-card:hover {
    transform: translateY(-4px);
    box-shadow:
        0 12px 24px rgba(0, 0, 0, 0.3),
        0 0 0 1px var(--border-glow);
    border-color: var(--border-glow);
}

/* Header – clean and sticky */
.main-header {
    background: rgba(10, 13, 18, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 1000;
    padding: 0.8rem 0;
}
.nav-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}
.logo {
    font-size: 1.6rem;
    font-weight: 700;
    background: linear-gradient(
        135deg,
        var(--text-primary),
        var(--accent-soft)
    );
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.logo i {
    background: none;
    color: var(--accent-soft);
    -webkit-background-clip: unset;
    background-clip: unset;
}
nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
    align-items: center;
    flex-wrap: wrap;
}
nav a {
    color: var(--text-secondary);
    font-weight: 500;
    position: relative;
    padding: 0.3rem 0;
}
nav a:hover {
    color: var(--accent-soft);
}
nav a::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent-primary);
    transition: width var(--transition-fast);
}
nav a:hover::after {
    width: 100%;
}

.login-btn {
    width: 100%;
}

/* Hero */
.hero {
    text-align: center;
    padding: 6rem 1rem 7rem;
    background: linear-gradient(135deg, #0b0f19 0%, #1e293b 100%);
    position: relative;
    overflow: hidden;
}
.hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(
            circle at 20% 30%,
            rgba(99, 102, 241, 0.15),
            transparent 50%
        ),
        radial-gradient(
            circle at 80% 70%,
            rgba(139, 92, 246, 0.12),
            transparent 50%
        ),
        radial-gradient(
            circle at 40% 80%,
            rgba(6, 182, 212, 0.08),
            transparent 50%
        );
    z-index: 0;
    animation: meshMove 15s ease infinite;
}
@keyframes rotateGlow {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}
.hero .container {
    position: relative;
    z-index: 1;
}
.highlight {
    background: linear-gradient(
        135deg,
        var(--accent-soft),
        var(--accent-primary)
    );
    background-clip: text;
    -webkit-background-clip: text;
    color: transparent;
}
.subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-top: 0.75rem;
    margin-bottom: 2.5rem;
}
.id-lookup {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.id-lookup input {
    padding: 1rem 1.8rem;
    border-radius: 60px;
    border: 1px solid var(--border-subtle);
    background: rgba(18, 22, 30, 0.8);
    backdrop-filter: blur(4px);
    color: white;
    width: 280px;
    font-size: 1rem;
    transition: var(--transition-fast);
}
.id-lookup input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.id-lookup button {
    padding: 1rem 2.2rem;
    border-radius: 60px;
    background: var(--accent-primary);
    border: none;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
}
.id-lookup button:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}

/* Generic section spacing */
.section {
    padding: 6rem 0;
    border-bottom: 1px solid var(--border-subtle);
}
.section:last-child {
    border-bottom: none;
}

/* About preview (home) */
.about-preview {
    max-width: 720px;
    margin: 0 auto;
    text-align: center;
}
.about-preview p {
    color: var(--text-secondary);
    margin-bottom: 1.8rem;
    font-size: 1.05rem;
}

/* Tech badges – softer */
.tech-stack-grid,
.tech-stack {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1rem;
    margin-top: 2rem;
}
.tech-badge {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.2);
    padding: 0.6rem 1.5rem;
    border-radius: 40px;
    font-size: 0.95rem;
    font-weight: 500;
    transition: var(--transition-fast);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text-primary);
}
.tech-badge i {
    color: var(--accent-primary);
}
.tech-badge:hover {
    background: rgba(99, 102, 241, 0.15);
    border-color: var(--accent-primary);
    transform: translateY(-1px);
}

/* Grids – cards, posts, projects, blog */
.posts-grid,
.projects-grid,
.project-grid,
.blog-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2.5rem;
    margin-top: 1rem;
    place-items: center;
}

/* Card (used in homepage & others) */
.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition:
        transform var(--transition-smooth),
        box-shadow var(--transition-smooth);
}
.card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    border-color: var(--border-glow);
}
.card img {
    width: 100%;
    height: 150px;
    object-fit: fill;
    display: block;
    border-radius: var(--radius-sm);
}
.card h3 {
    margin: 1.2rem 1.2rem 0.5rem;
    font-size: 1.2rem;
}
.card p {
    color: var(--text-secondary);
    margin: 0 1.2rem 1.2rem;
    font-size: 0.95rem;
}
.card-footer {
    padding: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    border-top: 1px solid var(--border-subtle);
    padding: 1rem 0 0;
}

/* Post card / Project card (same style but separate class for flexibility) */
.post-card,
.project-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition:
        transform var(--transition-smooth),
        box-shadow var(--transition-smooth);
    padding: 1.5rem;
    max-width: 350px;
}
.post-card:hover,
.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.4);
    border-color: var(--border-glow);
}
.post-card img,
.project-card img {
    width: 100%;
    height: 150px;
    object-fit: fill;
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}
.post-card h3,
.project-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
}
.post-meta {
    color: var(--text-secondary);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}
.post-card p,
.project-card p {
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
}
.no-image {
    height: 150px;
    background: var(--bg-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    margin-bottom: 1rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.7rem 1.6rem;
    background: var(--accent-primary);
    color: white;
    border: none;
    border-radius: 40px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition-smooth);
    text-decoration: none;
    font-size: 0.9rem;
}
.btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(99, 102, 241, 0.3);
    color: white;
}
.btn-outline {
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
}
.btn-outline:hover {
    background: var(--accent-primary);
    color: white;
}
.btn-small {
    padding: 0.5rem 1.1rem;
    font-size: 0.85rem;
    cursor: pointer;
}
.btn-danger {
    background: var(--danger);
}
.btn-danger:hover {
    background: #dc2626;
}

/* Contact pills */
.contact-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    background: transparent;
    border: none;
    backdrop-filter: none;
}
.contact-item {
    background: var(--bg-elevated);
    padding: 1.1rem 2.2rem;
    border-radius: 60px;
    display: inline-flex;
    align-items: center;
    gap: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border-subtle);
    transition: var(--transition-smooth);
    color: var(--text-primary);
}
.contact-item:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(99, 102, 241, 0.15);
}

/* ========== Dashboard ========== */
.dashboard {
    padding: 2rem 2rem;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}
.stat-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 1rem;
    text-align: center;
    transition: var(--transition-fast);
}
.stat-card:hover {
    border-color: var(--accent-primary);
    transform: translateY(-2px);
}
.stat-card i {
    font-size: 1rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
}
.stat-card span {
    font-size: 1rem;
    font-weight: 700;
    margin: 0.5rem 0;
}
.dash-section {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 2.5rem;
    margin-bottom: 2.5rem;
    border: 1px solid var(--border-subtle);
}
.dash-section h2 {
    margin-top: 0;
    margin-bottom: 2rem;
}
.form-card {
    background: var(--bg-elevated);
    padding: 2rem;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
}
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.form-group.full-width {
    grid-column: 1 / -1;
}
.form-group label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
}
input,
textarea,
select {
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition-fast);
}
input:focus,
textarea:focus,
select:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
}
.data-table {
    overflow-x: auto;
    margin-top: 2rem;
}
.data-table table {
    width: 100%;
    border-collapse: collapse;
}
.data-table th,
.data-table td {
    padding: 1rem 1.2rem;
    text-align: left;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.95rem;
    flex-wrap: nowrap;
}
.data-table th {
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 0.8rem;
}
html[dir="rtl"] .data-table th,
html[dir="rtl"] .data-table td {
    text-align: right;
}
.table-thumb {
    width: 40px;
    height: 40px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--border-subtle);
}
.data-table td {
    vertical-align: middle;
    text-wrap: nowrap;
}
.id-badge {
    background: var(--accent-primary);
    padding: 0.3rem 0.9rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    transition: var(--transition-fast);
    color: white;
}
.id-badge:hover {
    background: var(--accent-hover);
    box-shadow: 0 4px 10px rgba(99, 102, 241, 0.3);
}
/* Meta and extra info on single pages */
.meta {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 1rem;
}
.description,
.excerpt {
    background: var(--bg-deep);
    padding: 1rem;
    border-radius: var(--radius-sm);
    margin: 1rem 0;
    border-left: 3px solid var(--accent-primary);
    border-right: none;
}
html[dir="rtl"] .description,
html[dir="rtl"] .excerpt {
    border-right: 3px solid var(--accent-primary);
    border-left: none;
}
.protected-badge {
    background: rgba(239, 68, 68, 0.15);
    padding: 0.2rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: #f87171;
}
.actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.pagination {
    display: flex;
    justify-content: center;
    gap: 0.6rem;
    margin-top: 2.5rem;
    flex-wrap: wrap;
    margin-bottom: 40px;
}
.pagination a {
    padding: 0.6rem 1rem;
    background: var(--bg-elevated);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: var(--transition-fast);
}
.pagination a:hover,
.pagination a.active {
    background: var(--accent-primary);
    color: white;
}

.url-input {
    text-align: left;
    direction: ltr;
}

/* ========== Auth ========== */
.auth-container {
    max-width: 450px;
    margin: 5rem auto;
    padding: 3rem 2.5rem;
    width: 90%;
}
.auth-container h2 {
    text-align: center;
    margin-bottom: 2rem;
}
.auth-container input {
    width: 100%;
    margin-bottom: 1.2rem;
}
.error {
    color: var(--danger);
    background: rgba(239, 68, 68, 0.1);
    padding: 0.8rem 1rem;
    border-radius: var(--radius-sm);
    text-align: center;
    margin-bottom: 1.5rem;
}

/* ========== Filters bar (blog/portfolio) ========== */
.filters-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 3rem;
    background: var(--bg-surface);
    padding: 1.2rem 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
}
.search-form {
    display: flex;
    align-items: center;
    flex: 1 1 250px;
    gap: 0.5rem;
}
.search-form input {
    flex: 1;
    background: var(--bg-deep);
    border: 1px solid var(--border-subtle);
    border-radius: 40px;
    padding: 0.7rem 1.2rem;
    color: white;
}
.search-form button {
    background: var(--accent-primary);
    border: none;
    padding: 0.7rem 1.2rem;
    border-radius: 40px;
    color: white;
    cursor: pointer;
    transition: var(--transition-fast);
}
.search-form button:hover {
    background: var(--accent-hover);
}

/* ========== About page ========== */
.about-page {
    margin-top: 50px;
    padding-top: 4rem;
    padding-bottom: 4rem;
    margin-bottom: 50px;
}
.about-card {
    text-align: center;
    max-width: 800px;
    margin: 0 auto;
    padding: 3rem;
}
.about-header {
    margin-bottom: 3rem;
}
.avatar {
    width: 130px;
    height: 170px;
    border-radius: 20px;
    object-fit: cover;
    border: 3px solid var(--accent-primary);
    margin-bottom: 1.5rem;
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.3);
}
.tagline {
    font-size: 1.2rem;
    color: var(--accent-soft);
    margin-top: 0.5rem;
}
.about-content h2 {
    margin-top: 3rem;
    margin-bottom: 1.5rem;
    text-align: left;
}
html[dir="rtl"] .about-content h2 {
    text-align: right;
}
.about-content h2::after {
    width: 40px;
}
.about-content p {
    color: var(--text-secondary);
    line-height: 1.9;
    margin-bottom: 1.8rem;
    text-align: left;
}
html[dir="rtl"] .about-content p {
    text-align: right;
}
.about-content .tech-stack {
    justify-content: flex-start;
    margin-bottom: 2rem;
}

/* ========== Single pages (file, post, portfolio) ========== */
.post-single,
.file-view,
.portfolio-single {
    max-width: 860px;
    margin: 4rem auto;
    padding: 0 2rem;
}
.main-image {
    width: 100%;
    border-radius: var(--radius-md);
    margin-bottom: 2rem;
    max-height: 300px;
    object-fit: contain;
}
.meta {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0.5rem 0 2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--border-subtle);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 1.5rem;
}
/* Read More / Read Less toggle for portfolio single page */
.portfolio-single .content {
    transition: max-height 0.35s ease-out;
    overflow: hidden;
}

.portfolio-single .content.collapsed {
    max-height: 200px;   /* matches JS COLLAPSED_MAX_HEIGHT */
}

.portfolio-single .content.expanded {
    max-height: none;
}

.portfolio-single .read-more-btn {
    display: none;       /* hidden by default, shown via JS when needed */
    margin: 2rem auto;
}
.content {
    line-height: 1.9;
    margin: 2rem 0;
    font-size: 1.05rem;
}
.content h2::after {
    display: none;
}
/* Responsive table scroll */
.table-wrapper {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* smooth scroll on iOS */
}

.table-wrapper table {
    min-width: 500px;   /* triggers scroll earlier on small screens */
    width: 100%;        /* optional: makes table fill wrapper */
    border-collapse: collapse;
}

/* Optional: style for better readability */
.table-wrapper td,
.table-wrapper th {
    white-space: nowrap;  /* prevent cells from breaking, forces scroll */
    padding: 0.5rem 1rem;
}
/* Share button (generic) */
.share-btn {
    cursor: pointer;
}

/* ========== Footer ========== */
.main-footer {
    margin-top: auto;
    background: var(--bg-surface);
    border-top: 1px solid var(--border-subtle);
    padding: 2.5rem 0;
}
.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.5rem;
}
.footer-contact {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
}
.footer-contact a {
    color: var(--text-secondary);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}
.footer-contact a:hover {
    color: var(--accent-primary);
}
.footer-copy p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== Toast ========== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    background: var(--bg-elevated);
    backdrop-filter: blur(10px);
    border-right: 4px solid var(--accent-primary);
    padding: 0.9rem 1.8rem;
    border-radius: 12px;
    color: var(--text-primary);
    font-weight: 500;
    z-index: 9999;
    animation: slideInRight 0.3s ease;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
}
.toast.success {
    border-right-color: var(--success);
}
.toast.error {
    border-right-color: var(--danger);
}
html[dir="ltr"] .toast {
    right: unset;
    left: 2rem;
    border-right: none;
    border-left: 4px solid var(--accent-primary);
    animation: slideInLeft 0.3s ease;
}
html[dir="ltr"] .toast.success {
    border-right-color: none;
    border-left-color: var(--success);
}
html[dir="ltr"] .toast.error {
    border-right-color: none;
    border-left-color: var(--danger);
}
@keyframes slideInRight {
    from {
        opacity: 0;
        transform: translateX(60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
@keyframes slideInLeft {
    from {
        opacity: 0;
        transform: translateX(-60px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.portfolio-open-btn,
.portfolio-open-btn-mainpage,
html[dir="ltr"] .portfolio-details-btn,
html[dir="ltr"] .portfolio-details-btn-mainpage {
    border-radius: 40px 0px 0px 40px;
}
.portfolio-details-btn,
.portfolio-details-btn-mainpage,
html[dir="ltr"] .portfolio-open-btn,
html[dir="ltr"] .portfolio-open-btn-mainpage {
    border-radius: 0px 40px 40px 0px;
}
.portfolio-open-btn,
.portfolio-open-btn-mainpage {
    width: 50%;
    min-width: 110px;
    min-height: 40px;
}
.portfolio-details-btn,
.portfolio-details-btn-mainpage {
    width: 50%;
    text-wrap: nowrap;
    min-width: 110px;
    min-height: 40px;
}

.portfolioSingle-btns {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: row;
    gap: 15px;
}

.portfolioSingle-visit-btn,
.portfolioSingle-share-btn {
    width: 50%;
    min-height: 50px;
    min-width: 170px;
}

/* Dashboard Tabs */
.dashboard-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--border-subtle);
    padding-bottom: 0.5rem;
    flex-wrap: wrap;
}
.tab-btn {
    background: transparent;
    border: none;
    padding: 0.6rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition-fast);
    border-radius: 40px;
}
.tab-btn i {
    margin-right: 0.5rem;
}
.tab-btn.active {
    background: var(--accent-primary);
    color: white;
}
.tab-content {
    display: none;
}
.tab-content.active {
    display: block;
}
.manage-btn {
    margin-left: auto;
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-subtle);
    width: 100%;
    max-width: 500px;
    margin: auto;
}
.manage-btn:hover {
    background: var(--accent-primary);
    color: white;
}

.manage-btn-pa {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    max-width: 1000px;
    margin: auto;
}

/* Modal Styles */
.modal {
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    overflow: auto;
}
.modal-content {
    background-color: var(--bg-surface);
    margin: 5% auto;
    padding: 2rem;
    border-radius: var(--radius-md);
    width: 90%;
    max-width: 700px;
    border: 1px solid var(--border-glow);
}
.close {
    float: left;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-secondary);
    position: relative;
    z-index: 2;
}
html[dir="ltr"] .close {
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    color: var(--text-secondary);
}
.close:hover {
    color: var(--danger);
}
.modal-content .form-grid {
    max-height: 60vh;
    overflow-y: auto;
    padding-right: 0.5rem;
}

#editFields .form-group {
    margin-bottom: 20px;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
    header::before {
        animation: none;
    }
    .index-page .project-grid .card,
    .index-page .blog-grid .card {
        flex: 0 0 260px;
    }
    .portfolioSingle-btns {
        flex-direction: column;
    }
    .projects-grid,
    .posts-grid {
        grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    }
    .dash-section {
        padding: 1rem;
    }
    .form-grid {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
    .container {
        padding: 0 1rem;
    }
    .hero {
        padding: 4rem 1rem 3rem;
    }
    .id-lookup {
        flex-direction: column;
        align-items: stretch;
    }
    .id-lookup input {
        width: 100%;
    }
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    .glass-card,
    .about-card {
        padding: 2rem;
    }
    .post-single,
    .file-view,
    .portfolio-single {
        margin: 2rem auto;
    }
    .filters-bar {
        align-items: stretch;
        justify-content: center;
    }
    .search-form {
        width: 100%;
        flex-direction: column;
        align-items: stretch;
    }
}

/* Subtle card fade-in */
.card,
.post-card,
.project-card {
    animation: fadeInSoft 0.5s ease forwards;
}
@keyframes fadeInSoft {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========== Hamburger menu (mobile) ========== */
.hamburger {
    display: none; /* hidden on desktop */
    flex-direction: column;
    justify-content: space-around;
    width: 2rem;
    height: 2rem;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1100;
}

.hamburger-line {
    width: 100%;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: all 0.3s ease;
    transform-origin: center;
}

/* Animate to X when open */
.hamburger.open .hamburger-line:nth-child(1) {
    transform: translateY(8px) rotate(50deg);
}
.hamburger.open .hamburger-line:nth-child(2) {
    opacity: 0;
}
.hamburger.open .hamburger-line:nth-child(3) {
    transform: translateY(-12px) rotate(-50deg);
}

/* Mobile navigation container */
.nav-menu {
    display: flex;
    align-items: center;
}

/* Mobile styles */
@media (max-width: 960px) {
    .hamburger {
        display: flex; /* show hamburger */
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: auto;
        right: 0;
        background: rgba(10, 13, 18, 0.95);
        backdrop-filter: blur(12px);
        border-bottom: 1px solid var(--border-subtle);
        max-height: 0;
        overflow: hidden;
        transition:
            max-height 0.4s ease,
            padding 0.4s ease;
        flex-direction: column;
        align-items: stretch;
    }

    .nav-menu.open {
        max-height: 470px; /* enough to show all items */
        padding: 1rem 0;
    }

    .nav-menu nav ul {
        flex-direction: column;
        gap: 0;
        width: 100%;
    }

    .nav-menu nav a {
        display: block;
        padding: 0.8rem 2rem;
        border-bottom: 1px solid var(--border-subtle);
    }

    /* Adjust the RTL layout */
    html[dir="rtl"] .nav-menu {
        left: 0;
        right: auto;
    }
}

/* Required field */
.required {
    color: var(--danger);
    margin-left: 0.25rem;
}

/* Recent items row */
.recent-items-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
.recent-box {
    background: var(--bg-surface);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
}
.recent-box h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}
.recent-box ul {
    list-style: none;
    padding: 0;
    margin: 0 0 1rem 0;
}
.recent-box li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border-subtle);
}
.recent-box li .date {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Backup grid */
.backup-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
}
.backup-card {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border-subtle);
}
.backup-card h3 {
    margin-top: 0;
    margin-bottom: 1rem;
}
.backup-card .btn {
    width: 100%;
    margin-top: 0.5rem;
}
.backup-card .btn-danger {
    background: var(--danger);
}

/* Edit pages */
.edit-container {
    max-width: 900px;
    margin: 2rem auto;
}
.current-image {
    margin-bottom: 0.5rem;
}
.current-image img {
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
}
.button-group {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    flex-wrap: wrap;
    justify-content: center;
    max-width: 500px;
    margin: 30px auto;
}
.password-protected {
    text-align: center;
    padding: 2rem;
}
.password-protected i {
    font-size: 3rem;
    color: var(--accent-primary);
    margin-bottom: 1rem;
}
.password-protected form {
    max-width: 300px;
    margin: 1rem auto;
    display: flex;
    gap: 0.5rem;
}
.password-protected input {
    flex: 1;
}

/* Responsive */
@media (max-width: 768px) {
    .recent-items-row, .backup-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
    .button-group {
        flex-direction: column;
    }
    .password-protected form {
        flex-direction: column;
    }
}

#redirects-table-container {
    overflow: auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 30px;
    margin-top: 30px;
    margin-bottom: 30px;
}

.redirects-buttons {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
}

/* GPU acceleration & smoother animations */
.glass-card, .card, .post-card, .project-card, .btn, .tech-badge {
    will-change: transform, box-shadow;
    backface-visibility: hidden;
    transform: translate3d(0,0,0);
}
/* About page skills */
.skill-bar {
    margin: 1rem 0;
}
.skill-bar span {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 500;
}
.progress {
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
    overflow: hidden;
    height: 10px;
}
.progress-fill {
    background: linear-gradient(90deg, var(--accent-primary), var(--accent-soft));
    width: 0%;
    height: 100%;
    border-radius: 20px;
    transition: width 1s ease-out;
}
.stats-row {
    display: flex;
    justify-content: space-around;
    gap: 1.5rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}
.stat-item {
    text-align: center;
    background: rgba(99,102,241,0.1);
    padding: 1rem 1.5rem;
    border-radius: 30px;
    min-width: 120px;
}
.stat-number {
    font-size: 2.5rem;
    font-weight: 800;
    display: block;
    color: var(--accent-primary);
}
.stat-label {
    font-size: 0.9rem;
    color: var(--text-secondary);
}
/* Header smooth hide/show */
.main-header {
    transition: transform 0.35s cubic-bezier(0.2, 0.9, 0.4, 1.1) !important;
}

.portfolioCards {
    width: 100%;
    min-height: 410px;
    display: flex;
    justify-content: space-between;
    flex-direction: column;
    padding: 1rem;
}

@media (max-width: 490px) {
    .manage-btn-pa {
        flex-direction: column;
    }
    .hero {
        background: black;
    }
    .section {
        padding: 4rem 0;
    }
}

/* ========== MOBILE PERFORMANCE FIXES ========== */
@media (max-width: 768px) {
    /* Disable backdrop-filter on glass cards – it’s very heavy on mobile GPU */
    .glass-card {
        backdrop-filter: none !important;
        background: rgba(18, 22, 30, 0.95) !important;
    }
    /* Remove will-change from animated elements */
    .glass-card, .card, .post-card, .project-card, .btn, .tech-badge {
        will-change: auto !important;
        transform: none !important;
    }
    /* Disable hover transform animations */
    .glass-card:hover,
    .card:hover,
    .post-card:hover,
    .project-card:hover {
        transform: none !important;
        box-shadow: none !important;
    }
    /* Simplify hero background gradient (keep it flat) */
    .hero {
        background: #0b0f19 !important;
    }
    .hero::before {
        animation: none !important;
        opacity: 0.5 !important;
    }
    /* Reduce motion for cards */
    .card, .post-card, .project-card {
        animation: none !important;
        opacity: 1 !important;
        transform: none !important;
    }
    /* Disable sticky header hide/show on mobile (keep header always visible) */
    .main-header {
        transform: translateY(0) !important;
        transition: none !important;
    }
}