/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #00633D;
    --secondary-color: #004C2F;
    --accent-color: #1AA874;
    --text-dark: #0f172a;
    --text-light: #475569;
    --bg-light: #f8fafc;
    --bg-white: #ffffff;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.03);
}

body {
    font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    line-height: 1.6;
    color: var(--text-dark);
    background: linear-gradient(135deg, #003824 0%, #00633D 100%);
    min-height: 100vh;
    overflow-x: hidden;
}

body[lang="ar"] {
    font-family: 'Noto Kufi Arabic', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background: var(--bg-white);
    margin-top: 20px;
    margin-bottom: 20px;
    border-radius: 20px;
    box-shadow: var(--shadow-xl);
    backdrop-filter: blur(10px);
    min-height: 600px; /* Reserve minimum space to prevent shifts */
}

/* Language Switcher */
.language-switcher {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1000;
}

.side-nav {
    position: fixed;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000;
    background: rgba(0, 99, 61, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(0, 99, 61, 0.3);
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.side-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    border-bottom: 1px solid rgba(255,255,255,0.12);
    transition: background 0.2s ease, transform 0.2s ease;
}

.side-nav .nav-link:last-child { border-bottom: none; }

.side-nav .nav-link:hover { background: rgba(0, 99, 61, 0.22); transform: translateY(-1px); }

.side-nav .nav-link.active { background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); }

.side-nav .nav-link i {
    width: 20px;
    text-align: center;
}

.side-nav .nav-actions {
    display: flex;
    flex-direction: column;
}

.side-nav .nav-action {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #ffffff;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    border-top: 1px solid rgba(255,255,255,0.12);
    text-align: left;
}

.side-nav .nav-action:hover { background: rgba(0, 99, 61, 0.22); }

@media (max-width: 768px) {
    .side-nav { display: none; }
}

.lang-btn {
    background: var(--bg-white);
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow-md);
}

.lang-btn:hover {
    background: var(--primary-color);
    color: var(--bg-white);
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

/* Profile Section */
.profile-section {
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 40px;
    border-radius: 15px;
    margin-bottom: 30px;
    position: relative;
    overflow: hidden;
}

.profile-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: radial-gradient(circle at center, rgba(255,255,255,0.06) 0%, transparent 75%);
    animation: float 8s ease-in-out infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(90deg); }
}

.profile-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    position: relative;
    z-index: 1;
    min-height: 200px; /* Reserve space to prevent shifts */
}

.profile-info h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    min-height: 60px; /* Reserve space for title */
    line-height: 1.2; /* Consistent line height */
}

.name-roman {
    font-size: 0.95rem;
    color: rgba(255,255,255,0.9);
    margin-top: -4px;
}

.profile-title {
    font-size: 1.2rem;
    font-weight: 300;
    margin-bottom: 20px;
    opacity: 0.9;
    min-height: 30px; /* Reserve space for subtitle */
    line-height: 1.3; /* Consistent line height */
}

.contact-info {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-height: 120px; /* Reserve space to prevent shifts */
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
}

.contact-item i {
    width: 20px;
    text-align: center;
}

.contact-item a {
    color: white;
    text-decoration: none;
    transition: opacity 0.3s ease;
}

.contact-item a:hover {
    opacity: 0.8;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    margin-left: 6px;
    background: rgba(255,255,255,0.12);
    border: 1px solid rgba(255,255,255,0.25);
    color: #ffffff;
}

.profile-image {
    width: 150px;
    height: 150px;
    border-radius: 50%;
    overflow: hidden;
    border: 4px solid rgba(255,255,255,0.3);
    box-shadow: var(--shadow-lg);
}

.profile-photo {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.image-placeholder {
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, rgba(255,255,255,0.2), rgba(255,255,255,0.1));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    color: rgba(255,255,255,0.8);
}

.about-section {
    position: relative;
    z-index: 1;
}

.about-section h2 {
    font-size: 1.5rem;
    margin-bottom: 15px;
    color: white;
}

.about-text {
    font-size: 1rem;
    line-height: 1.8;
    opacity: 0.9;
    text-align: justify;
    min-height: 80px; /* Reserve space to prevent text layout shifts */
}

.about-list {
    margin-top: 12px;
    padding-left: 18px;
    display: grid;
    gap: 6px;
}

.about-list li {
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-light);
}

/* Main Content */
.main-content {
    display: grid;
    gap: 40px;
}

.section-title {
    font-size: 1.8rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 25px;
    position: relative;
    padding-bottom: 10px;
}

.section-title::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 50px;
    height: 3px;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
    border-radius: 2px;
}

/* Timeline */
.timeline {
    position: relative;
    padding-right: 30px;
}

.timeline::before {
    content: '';
    position: absolute;
    right: 15px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary-color), var(--accent-color));
}

.timeline-item {
    position: relative;
    margin-bottom: 30px;
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.timeline-content {
    display: grid;
    gap: 8px;
}

.timeline-item:hover {
    transform: translateX(-2px);
    box-shadow: var(--shadow-md);
}

.timeline-marker {
    position: absolute;
    right: -37px;
    top: 20px;
    width: 30px;
    height: 30px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.8rem;
    box-shadow: var(--shadow-md);
}

.job-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
    line-height: 1.5;
    margin-right: 5%;
}

.company {
    color: var(--text-light);
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Certificates */
.certificates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
}

.certificate-item {
    display: flex;
    align-items: center;
    gap: 15px;
    background: var(--bg-light);
    padding: 20px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.certificate-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.certificate-icon {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.certificate-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 5px;
}

.certificate-issuer {
    color: var(--text-light);
    font-size: 0.9rem;
}

/* Skills */
.skills-container {
    display: grid;
    gap: 25px;
}

.skill-category {
    background: var(--bg-light);
    padding: 25px;
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
}

.category-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--primary-color);
    margin-bottom: 15px;
}

.skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.skill-tag {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    padding: 10px 16px;
    border-radius: 22px;
    font-size: 0.92rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.skill-tag:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: var(--shadow-md);
}

.skill-tag::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
}

.skills-section {
    background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.04));
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 16px;
    padding: 18px;
}

.skill-category {
    --skill-start: var(--primary-color);
    --skill-end: var(--accent-color);
}


.skill-tag {
    background: linear-gradient(135deg, var(--skill-start), var(--skill-end));
    will-change: transform;
    position: relative;
}

.skill-tag::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 22px;
    background: linear-gradient(180deg, rgba(255,255,255,0.18), rgba(255,255,255,0));
    opacity: 0;
    transition: opacity 0.2s ease;
}

.skill-tag:hover::after { opacity: 1; }
.skill-tag:focus { outline: none; transform: translateY(-2px) scale(1.03); box-shadow: var(--shadow-md); }

.category-title::after {
    content: '';
    display: block;
    width: 64px;
    height: 3px;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--skill-start), var(--skill-end));
    margin-top: 8px;
}

@media (min-width: 992px) {
    .skills-container { grid-template-columns: repeat(2, minmax(280px, 1fr)); }
}

.skill-category {
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 14px;
    padding: 22px;
    box-shadow: var(--shadow-sm);
}

.category-title {
    font-weight: 700;
    color: var(--text-dark);
    margin-bottom: 14px;
}

/* Portfolio */
/* Portfolio */
.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.portfolio-item {
    position: relative;
    background: var(--bg-light);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    padding: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 180px;
    border: 1px solid var(--border-color);
}

.portfolio-item:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-md);
    background: var(--bg-white);
    border-color: var(--primary-color);
}

.portfolio-icon {
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    color: white;
    font-size: 2rem;
    font-weight: 700;
    box-shadow: var(--shadow-sm);
    transition: transform 0.3s ease;
}

.portfolio-item:hover .portfolio-icon {
    transform: scale(1.1) rotate(10deg);
}

.portfolio-link {
    color: var(--text-dark);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: color 0.3s ease;
    word-break: break-all;
    direction: ltr; /* Ensure URLs are always LTR */
}

.portfolio-link:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* Footer */
.footer {
    background: var(--text-dark);
    color: white;
    padding: 30px;
    border-radius: 15px;
    margin-top: 40px;
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.footer-text {
    font-size: 0.9rem;
    opacity: 0.8;
}

.social-links {
    display: flex;
    gap: 15px;
}

.social-link {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    text-decoration: none;
    transition: all 0.3s ease;
}

.social-link:hover {
    background: var(--primary-color);
    transform: translateY(-2px);
}

/* Responsive Design */
.cta-metrics {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
}

.cta-buttons {
    display: flex;
    gap: 12px;
}

.cta-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 18px;
    border-radius: 30px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: var(--shadow-md);
    background: rgba(255,255,255,0.15);
    color: white;
    border: 1px solid rgba(255,255,255,0.3);
    transition: all 0.3s ease;
}

.cta-btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

.cta-btn.primary {
    background: linear-gradient(135deg, #ffffff33, #ffffff22);
}

.cta-btn.secondary {
    background: linear-gradient(135deg, #00000022, #00000011);
}

.profile-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    min-height: 100px; /* Reserve space to prevent shifts */
}

.metric-card {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 12px;
    padding: 14px 18px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    min-height: 80px; /* Reserve space to prevent shifts */
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.metric-label {
    font-size: 0.85rem;
    opacity: 0.9;
}

.value-section {
    background: var(--bg-white);
}

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

.value-card {
    position: relative;
    overflow: hidden;
    background: var(--bg-light);
    border-radius: 12px;
    box-shadow: var(--shadow-sm);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
    aspect-ratio: 4 / 3;
}

.value-card:hover {
    transform: translateY(-4px) scale(1.01);
    box-shadow: var(--shadow-md);
}

.value-icon {
    position: absolute;
    top: 12px;
    left: 12px;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary-color), var(--accent-color));
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    z-index: 2;
}

.value-content {
    position: absolute;
    left: 12px;
    right: 12px;
    bottom: 12px;
    z-index: 2;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(6px);
}

.value-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 8px;
}

.value-text {
    font-size: 0.95rem;
    color: #f1f5f9;
    line-height: 1.7;
}

.value-cover {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    transition: transform 0.6s ease;
}

.value-card:hover .value-cover { transform: scale(1.06); }

.value-card::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0,0,0,0.0) 55%, rgba(0,0,0,0.5) 100%);
    z-index: 1;
}


.stack-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
}

.stack-item {
    background: var(--bg-light);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--shadow-sm);
    transition: all 0.3s ease;
}

.stack-item:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.stack-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary-color), var(--accent-color));
    color: white;
    font-size: 1.2rem;
    margin-bottom: 10px;
}

.stack-name {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.stack-desc {
    font-size: 0.88rem;
    color: var(--text-light);
    margin-top: 8px;
    line-height: 1.6;
}

.level-bar {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 8px;
    overflow: hidden;
}

.level-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), var(--accent-color));
}

@media (max-width: 768px) {
    .container {
        margin: 10px;
        padding: 15px;
        border-radius: 15px;
    }
    
    .profile-header {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }

    .cta-metrics {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-metrics {
        grid-template-columns: repeat(2, 1fr);
        min-height: 160px; /* Reserve space for 2x2 grid on mobile */
    }
    
    .profile-info h1 {
        font-size: 2rem;
    }
    
    .contact-info {
        align-items: center;
    }
    
    .timeline {
        padding-right: 20px;
    }
    
    .timeline-marker {
        right: -27px;
    }
    
    .certificates-grid {
        grid-template-columns: 1fr;
    }
    
    .portfolio-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .footer-content {
        flex-direction: column;
        text-align: center;
    }
    
    .language-switcher {
        top: 10px;
        left: 10px;
    }
    
    .lang-btn {
        padding: 8px 15px;
        font-size: 0.9rem;
    }
}

@media (max-width: 480px) {
    .profile-section {
        padding: 25px;
    }
    
    .profile-info h1 {
        font-size: 1.5rem;
    }
    
    .profile-title {
        font-size: 1rem;
    }
    
    .section-title {
        font-size: 1.5rem;
    }
    
    .skill-tags {
        justify-content: center;
    }
    
    .timeline-item {
        padding: 15px;
    }
    
    .certificate-item {
        flex-direction: column;
        text-align: center;
    }
}

/* Language-specific styles */
body[lang="en"] {
    direction: ltr;
    text-align: left;
}

body[lang="en"] .timeline {
    padding-right: 0;
    padding-left: 30px;
}

body[lang="en"] .timeline::before {
    right: auto;
    left: 15px;
}

body[lang="en"] .timeline-marker {
    right: auto;
    left: -37px;
}

body[lang="en"] .timeline-item:hover {
    transform: translateX(2px);
}

body[lang="en"] .section-title::after {
    right: auto;
    left: 0;
}

body[lang="en"] .timeline-item {
    text-align: left;
}

/* Smooth transitions for language switching */
* {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

/* Two-column layout for experience timeline on desktop */
@media (min-width: 992px) {
    .timeline {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 20px;
        padding: 0;
    }
    .timeline::before { display: none; }
    .timeline-item { margin-bottom: 0; }
    .timeline-marker {
        position: absolute;
        right: 12px;
        top: 12px;
    }
    body[lang="en"] .timeline { padding: 0; }
}

/* Loading animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.container > * {
    animation: fadeInUp 0.6s ease-out;
    animation-fill-mode: both; /* Prevent layout shifts during animation */
}

.profile-section {
    animation-delay: 0.1s;
}

.experience-section {
    animation-delay: 0.2s;
}

.education-section {
    animation-delay: 0.3s;
}

.skills-section {
    animation-delay: 0.4s;
}

.brands-section {
    margin-bottom: 40px;
}

.brands-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.brand-item {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.brand-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-lg);
}

.brand-logo {
    width: 60px;
    height: 60px;
    background: linear-gradient(45deg, var(--primary-color), var(--accent-color));
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 15px;
    font-weight: bold;
    font-size: 1.2rem;
    color: white;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
}

.brand-name {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-color);
    line-height: 1.4;
}

.portfolio-section {
    animation-delay: 0.5s;
}

.footer {
    animation-delay: 0.6s;
}
.mobile-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    height: auto; /* Allow dynamic height */
    min-height: 70px; /* Minimum height for layout stability */
    background: rgba(0, 99, 61, 0.95);
    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255,255,255,0.1);
    display: none; /* Hidden by default, shown in media query */
    padding: 8px;
    gap: 6px;
    justify-content: space-between;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
}

.mobile-nav .nav-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 600;
    border-radius: 10px;
    flex: 1 1 110px;
}

.mobile-nav .nav-link:hover { background: rgba(0, 99, 61, 0.22); }
.mobile-nav .nav-link.active { background: linear-gradient(135deg, var(--primary-color), var(--accent-color)); }
.mobile-nav .nav-link i { width: 18px; text-align: center; }

.mobile-nav .nav-action {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 12px;
    color: #ffffff;
    background: transparent;
    border: none;
    cursor: pointer;
    font-weight: 600;
    border-radius: 10px;
    flex: 1 1 110px;
}

.mobile-nav .nav-action:hover { background: rgba(0, 99, 61, 0.22); border-radius: 10px; }

@media (max-width: 768px) {
    .side-nav { display: none; }
    .mobile-nav { display: flex; }
    .container {
        padding-bottom: 100px; /* Increased space for dynamic height mobile navigation */
    }
}

@media (max-width: 480px) {
    .mobile-nav .nav-link span,
    .mobile-nav .nav-action span { display: none; }
    .mobile-nav .nav-link i,
    .mobile-nav .nav-action i { width: 22px; font-size: 18px; }
    .mobile-nav .nav-link,
    .mobile-nav .nav-action {
        flex: 1 1 60px; /* Smaller flex basis for icon-only mode */
        justify-content: center;
        padding: 8px 6px;
    }
}
