/*
================================================
Portfolio Stylesheet
Author: Nour Hatem
Version: 14.0 - Timeline Polish
================================================
*/

/* --- CSS Variables for Theming --- */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-hero: #f0f9ff;
    --bg-nav: rgba(255, 255, 255, 0.6);
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --border-color: rgba(59, 130, 246, 0.15);
    --shadow-color: rgba(59, 130, 246, 0.05);
    --card-shadow: rgba(59, 130, 246, 0.08);
    --accent-gradient: linear-gradient(45deg, #3b82f6, #818cf8, #a78bfa);
    --accent-gradient-darker: linear-gradient(45deg, #2563eb, #6d28d9);
    --accent-color: #3b82f6;
    --form-bg: #fdfdff;
    --form-border: #e5e7eb;
    --footer-bg: #f5f5f5;
    --footer-text: #475569;
    --preloader-bg: #ffffff;
    --spinner-color: #3b82f6;
    --toast-success-bg: linear-gradient(135deg, #22c55e, #16a34a);
    --toast-error-bg: linear-gradient(135deg, #ef4444, #dc2626);
}

.dark-mode {
    --bg-primary: #000000;
    --bg-secondary: #0a0a0a;
    --bg-hero: #000000;
    --bg-nav: rgba(0, 0, 0, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #b0b0b0;
    --border-color: rgba(96, 165, 250, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --card-shadow: rgba(0, 0, 0, 0.6);
    --accent-gradient: linear-gradient(45deg, #60a5fa, #818cf8, #c4b5fd);
    --accent-gradient-darker: linear-gradient(45deg, #3b82f6, #7c3aed);
    --accent-color: #60a5fa;
    --form-bg: #0a0a0a;
    --form-border: #1a1a1a;
    --footer-bg: #000000;
    --footer-text: #b0b0b0;
    --preloader-bg: #000000;
    --spinner-color: #60a5fa;
}

/* --- Base Styles & Preloader --- */
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
    font-family: 'Inter', sans-serif;
    line-height: 1.6;
    background: var(--bg-primary);
    color: var(--text-primary);
    overflow-x: hidden;
    transition: background 0.3s ease, color 0.3s ease;
    width: 100%;
    max-width: 100vw;
}
.preloader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: var(--preloader-bg); z-index: 9999; display: flex; justify-content: center; align-items: center; transition: opacity 0.3s ease, visibility 0.3s ease; }
.preloader.hidden { opacity: 0; visibility: hidden; }
.spinner { width: 50px; height: 50px; border: 5px solid var(--accent-color-translucent, rgba(59, 130, 246, 0.2)); border-left-color: var(--spinner-color); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* --- Navigation --- */
.navbar { position: fixed; top: 0; width: 100%; background: var(--bg-nav); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 1000; transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); border-bottom: 1px solid transparent; }
.navbar.scrolled { border-bottom: 1px solid var(--border-color); box-shadow: 0 4px 30px var(--shadow-color); transform: translateY(0); }
.nav-container { display: flex; justify-content: space-between; align-items: center; height: 70px; }
.logo-text { font-size: 24px; font-weight: 700; background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; text-decoration: none; background-size: 200% auto; animation: gradient-text 4s linear infinite; }
.nav-menu { display: flex; list-style: none; gap: 30px; }
.nav-link { text-decoration: none; color: var(--text-secondary); font-weight: 500; transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); position: relative; padding: 5px 0; outline: none; }
.nav-link:hover, .nav-link.active { color: var(--accent-color); transform: translateY(-2px); }
.nav-link:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 4px; border-radius: 4px; }
.nav-link::after { content: ''; position: absolute; width: 0; height: 2px; bottom: -5px; left: 50%; transform: translateX(-50%); background: var(--accent-gradient); transition: width 0.3s ease; background-size: 200% auto; animation: gradient-text 5s linear infinite; }
.nav-link:hover::after, .nav-link.active::after { width: 100%; }
.nav-right { display: flex; align-items: center; gap: 20px; }
.hamburger { display: none; flex-direction: column; cursor: pointer; background: transparent; border: none; padding: 5px; }
.bar { width: 25px; height: 3px; background: var(--text-secondary); margin: 3px 0; transition: 0.3s; border-radius: 3px; }

/* --- Theme Switch (Static Button) --- */
.theme-switch-wrapper { display: flex; align-items: center; }
.theme-switch { 
    position: relative; 
    display: inline-block; 
    width: 50px; 
    height: 50px; 
    border: none;
    background: transparent;
    cursor: pointer;
    padding: 0;
}
.theme-switch input { 
    position: absolute;
    opacity: 0; 
    width: 0; 
    height: 0; 
}
.theme-toggle-btn {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-size: 1.3rem;
    position: relative;
}
.theme-toggle-btn:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    transform: scale(1.1) rotate(15deg);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.theme-toggle-btn .sun-icon,
.theme-toggle-btn .moon-icon {
    transition: all 0.3s ease;
    position: absolute;
}
/* In dark mode: show sun icon (to switch to light) */
.dark-mode .theme-toggle-btn .sun-icon {
    display: block;
    opacity: 1;
}
.dark-mode .theme-toggle-btn .moon-icon {
    display: none;
    opacity: 0;
}
/* In light mode: show moon icon (to switch to dark) */
body:not(.dark-mode) .theme-toggle-btn .sun-icon {
    display: none;
    opacity: 0;
}
body:not(.dark-mode) .theme-toggle-btn .moon-icon {
    display: block;
    opacity: 1;
}

/* --- Hero Section --- */
.hero { min-height: 100vh; display: flex; align-items: center; background: var(--bg-hero); position: relative; overflow: hidden; }
.hero-container { max-width: 1200px; margin: 0 auto; padding: 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 60px; align-items: center; z-index: 2; }
.hero-title { font-size: 3.5rem; font-weight: 700; margin-bottom: 20px; line-height: 1.2; animation: slideInDown 0.8s ease-out; }
.gradient-text { background: var(--accent-gradient); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; background-size: 200% auto; animation: gradient-text 5s linear infinite; }
.hero-subtitle { font-size: 1.5rem; color: var(--text-secondary); margin-bottom: 20px; font-weight: 500; }
.hero-description { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 30px; line-height: 1.6; max-width: 500px; }
.hero-contact .contact-item { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; color: var(--text-secondary); }
.hero-contact .contact-item i { color: var(--accent-color); width: 20px; }
.social-links { display: flex; gap: 15px; margin-top: 30px; margin-bottom: 20px; }
.social-link { display: flex; align-items: center; justify-content: center; width: 45px; height: 45px; background: var(--accent-gradient); color: white; border-radius: 50%; text-decoration: none; transition: all 0.3s ease; font-size: 18px; position: relative; overflow: hidden; background-size: 200% auto; animation: gradient-text 5s linear infinite; }
.social-link:hover { transform: translateY(-5px) scale(1.1); box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3); }
.cv-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 30px;
    background: var(--accent-gradient);
    color: white;
    text-decoration: none;
    border-radius: 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.3);
}
.cv-download-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(59, 130, 246, 0.4);
}
.cv-download-btn i {
    font-size: 1.1rem;
}
.hero-image { display: flex; justify-content: center; align-items: center; }
.profile-container { position: relative; width: 350px; height: 350px; border-radius: 50%; overflow: hidden; box-shadow: 0 20px 40px var(--card-shadow); transition: all 0.3s ease; border: 5px solid var(--bg-primary); }
.profile-container:hover { transform: scale(1.05) rotate(2deg); box-shadow: 0 30px 60px rgba(59, 130, 246, 0.25); }
.profile-image { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.profile-overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(29, 78, 216, 0.1) 100%); border-radius: 50%; }
.scroll-indicator { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); animation: bounce 2s infinite; text-decoration: none; }
.scroll-arrow { width: 24px; height: 24px; border: 2px solid var(--accent-color); border-top: none; border-left: none; transform: rotate(45deg); }
@keyframes bounce { 0%, 20%, 50%, 80%, 100% { transform: translateY(0); } 40% { transform: translateY(-10px); } 60% { transform: translateY(-5px); } }
@keyframes gradient-text { 0% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } 100% { background-position: 0% 50%; } }
.decorative-shape { position: absolute; border-radius: 50%; background: var(--accent-gradient); background-size: 200% auto; animation: gradient-text 6s linear infinite, float 12s ease-in-out infinite; z-index: 0; opacity: 0.1; will-change: transform; }
.shape-1 { width: 400px; height: 400px; top: 10%; left: 5%; }
.shape-2 { width: 300px; height: 300px; bottom: 15%; right: 10%; animation-delay: 3s; }
@keyframes float { 0% { transform: translateY(0px); } 50% { transform: translateY(-30px); } 100% { transform: translateY(0px); } }

/* --- General Section Styles --- */
section { padding: 90px 0; transition: background 0.3s ease; border-bottom: 1px solid var(--border-color); position: relative; }
section:last-of-type { border-bottom: none; }
.section-title { text-align: center; font-size: 2.5rem; font-weight: 700; margin-bottom: 60px; color: var(--text-primary); position: relative; transition: all 0.3s ease; }
.section-title:hover { transform: scale(1.02); }
.section-title::after { content: ''; position: absolute; bottom: -15px; left: 50%; transform: translateX(-50%); width: 70px; height: 4px; background: var(--accent-gradient); border-radius: 2px; background-size: 200% auto; animation: gradient-text 5s linear infinite; transition: width 0.3s ease; }
.section-title:hover::after { width: 100px; }
.section-subtitle { text-align: center; font-size: 1.1rem; color: var(--text-secondary); max-width: 600px; margin: -40px auto 60px auto; }
.section-title-sub { font-size: 1.8rem; font-weight: 600; margin-bottom: 30px; color: var(--text-primary); text-align: center; }

/* --- About Section --- */
.about { background: var(--bg-secondary); }
.about-content { display: grid; grid-template-columns: 2fr 1fr; gap: 60px; align-items: start; }
.about-text p { font-size: 1.1rem; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.8; }
.platform-links {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 25px;
    padding-top: 25px;
    border-top: 2px solid var(--border-color);
}
.platform-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: relative;
    overflow: hidden;
}
.platform-link::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}
.platform-link:hover::before {
    width: 300px;
    height: 300px;
}
.platform-link:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    transform: translateY(-5px) scale(1.05);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}
.platform-link i {
    font-size: 1.1rem;
}
.platform-link span {
    font-size: 0.9rem;
}
.education-card { background: var(--bg-primary); padding: 30px; border-radius: 15px; box-shadow: 0 10px 30px var(--card-shadow); transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); border: 1px solid var(--border-color); position: relative; overflow: hidden; }
.education-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.05), transparent);
    transition: left 0.5s;
}
.education-card:hover::before {
    left: 100%;
}
.education-card:hover { transform: translateY(-10px) scale(1.03); box-shadow: 0 25px 50px rgba(59, 130, 246, 0.2); border-color: var(--accent-color); }
.education-card h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); }
.education-item h4 { font-size: 1.1rem; font-weight: 600; margin-bottom: 10px; color: var(--accent-color); }
.education-item p { color: var(--text-secondary); margin-bottom: 5px; }

/* --- Experience Section (REFINED) --- */
.experience { background: var(--bg-primary); }
.timeline { position: relative; max-width: 900px; margin: 0 auto; }
.timeline::before { content: ''; position: absolute; left: 15px; top: 0; bottom: 0; width: 3px; background: var(--border-color); }
.timeline-progress { position: absolute; left: 15px; top: 0; width: 3px; background: linear-gradient(to bottom, var(--accent-color), var(--accent-gradient-darker)); height: 0; transition: height 0.3s ease-out; }
.timeline-item { margin-bottom: 40px; position: relative; padding-left: 50px; }
.timeline-content { background: var(--bg-primary); padding: 30px; border-radius: 20px; box-shadow: 0 10px 30px var(--card-shadow); transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); position: relative; border: 1px solid var(--border-color); }
.timeline-content::before { content: ''; position: absolute; top: 28px; left: -43px; width: 25px; height: 25px; background: var(--bg-secondary); border-radius: 50%; border: 4px solid var(--border-color); transition: all 0.3s ease; }
.timeline-item.in-view .timeline-content::before { background: var(--accent-color); border-color: var(--accent-color); transform: scale(1.1); }
.timeline-content:hover { transform: translateY(-12px) scale(1.03); box-shadow: 0 25px 50px rgba(59, 130, 246, 0.25); border-color: var(--accent-color); }
.timeline-header { margin-bottom: 15px; }
.timeline-header h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); display: flex; align-items: center; gap: 10px; }
.company { display: block; font-weight: 600; color: var(--accent-color); margin-bottom: 5px; font-size: 1.1rem; }
.period { display: inline-block; font-size: 0.9rem; color: var(--text-secondary); background: var(--bg-secondary); padding: 4px 12px; border-radius: 20px; font-weight: 500; }
.timeline-body-content {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 30px;
    align-items: start;
    margin-top: 15px;
}
.timeline-text-content {
    flex: 1;
}
.timeline-details { list-style: none; margin: 15px 0; }
.timeline-details li { margin-bottom: 10px; color: var(--text-secondary); position: relative; padding-left: 20px; }
.timeline-details li::before { content: '▸'; position: absolute; left: 0; color: var(--accent-color); font-weight: bold; }
.tech-stack { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.tech-tag { 
    background: var(--accent-gradient); 
    color: white; 
    padding: 8px 16px; 
    border-radius: 25px; 
    font-size: 0.85rem; 
    font-weight: 600; 
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); 
    background-size: 200% auto; 
    animation: gradient-text 5s linear infinite;
    display: inline-block;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
    position: relative;
    overflow: hidden;
}
.tech-tag::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}
.tech-tag:hover::before {
    width: 200px;
    height: 200px;
}
.tech-tag:hover { 
    transform: translateY(-3px) scale(1.1) rotate(2deg); 
    box-shadow: 0 6px 15px rgba(59, 130, 246, 0.4);
}
.tech-tag:active {
    transform: translateY(-1px) scale(1.05);
}
.certificate-image {
    width: 220px;
    height: 160px;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 5px 15px var(--card-shadow);
    transition: all 0.3s ease;
    flex-shrink: 0;
}
.certificate-image:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.3);
}
.certificate-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* --- Projects Section --- */
.projects { background: var(--bg-secondary); position: relative; overflow: hidden; }
.project-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 15px 35px rgba(0,0,0,0.1);
    transition: all 0.4s ease;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
}
.dark-mode .project-card {
    background: rgba(30, 41, 59, 0.5);
    border: 1px solid rgba(96, 165, 250, 0.2);
}
.project-card:hover {
    transform: translateY(-12px) perspective(1000px) rotateX(2deg) rotateY(-2deg);
    box-shadow: 0 25px 45px rgba(0,0,0,0.2);
}
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(255,255,255,0.2), transparent 40%);
    opacity: 0;
    transition: opacity 0.5s;
    pointer-events: none;
}
.project-card:hover::before {
    opacity: 1;
}
.projects-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.project-preview-card {
    background: var(--bg-primary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 20px var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    cursor: pointer;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
}
.project-preview-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.5s;
}
.project-preview-card:hover::before {
    left: 100%;
}
.project-preview-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.25);
    border-color: var(--accent-color);
}
.project-preview-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-secondary);
}
.project-preview-content {
    padding: 20px;
}
.project-preview-title-row {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.project-preview-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.project-preview-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 12px;
}
.project-preview-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--accent-color);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.3s ease;
    padding: 4px 8px;
    border-radius: 6px;
}
.project-preview-link:hover {
    background: var(--accent-gradient);
    color: white;
    transform: translateY(-2px);
}
.project-preview-link i {
    font-size: 0.9rem;
}
.project-preview-type {
    display: inline-block;
    background: var(--accent-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    margin-bottom: 12px;
}
.project-preview-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.project-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}
.project-preview-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}
.project-preview-btn:hover::before {
    width: 300px;
    height: 300px;
}
.project-preview-btn:hover {
    transform: translateY(-4px) scale(1.02);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}
.project-preview-btn:active {
    transform: translateY(-1px) scale(1);
}
.project-preview-btn i {
    font-size: 0.9rem;
}

/* Modal Styles */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    overflow-y: auto;
    overflow-x: hidden;
    opacity: 0;
    transition: opacity 0.3s ease, backdrop-filter 0.3s ease;
    -webkit-overflow-scrolling: touch;
}
.modal-overlay.active {
    display: flex;
    opacity: 1;
    animation: modalOverlayFadeIn 0.3s ease forwards;
}
@keyframes modalOverlayFadeIn {
    from {
        opacity: 0;
        backdrop-filter: blur(0px);
    }
    to {
        opacity: 1;
        backdrop-filter: blur(10px);
    }
}
.modal-content {
    background: var(--bg-primary);
    border-radius: 24px;
    max-width: 900px;
    width: 100%;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    animation: modalFadeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: center;
    margin: 20px auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
}
.modal-content::-webkit-scrollbar {
    width: 8px;
}
.modal-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}
.modal-content::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 10px;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}
.modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}
.modal-content::before {
    content: '';
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradient-text 3s linear infinite;
    z-index: 1;
    display: block;
}
@keyframes modalFadeIn {
    0% {
        opacity: 0;
        transform: scale(0.7) translateY(50px) rotateX(10deg);
        filter: blur(10px);
    }
    50% {
        transform: scale(1.02) translateY(-5px) rotateX(-2deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
        filter: blur(0px);
    }
}
@keyframes modalFadeOut {
    0% {
        opacity: 1;
        transform: scale(1) translateY(0) rotateX(0deg);
        filter: blur(0px);
    }
    100% {
        opacity: 0;
        transform: scale(0.8) translateY(30px) rotateX(5deg);
        filter: blur(5px);
    }
}
.modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 1.6rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    line-height: 1;
    font-weight: 300;
}
.modal-close:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    color: white;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
}
.modal-close:active {
    transform: rotate(90deg) scale(0.95);
}
.modal-close::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.4s, height 0.4s;
}
.modal-close:hover::before {
    width: 60px;
    height: 60px;
}
.modal-body {
    padding: 50px 40px 40px;
    animation: modalContentFadeIn 0.6s ease 0.2s both;
}
@keyframes modalContentFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.modal-header {
    margin-bottom: 30px;
    animation: modalHeaderSlideIn 0.5s ease 0.3s both;
}
@keyframes modalHeaderSlideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.modal-title-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.modal-title {
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    transition: transform 0.3s ease;
}
.modal-title:hover {
    transform: scale(1.02);
}
.modal-header .modal-links {
    margin-bottom: 20px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    align-items: center;
}
.modal-type {
    display: inline-block;
    background: var(--accent-gradient);
    color: white;
    padding: 8px 18px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 20px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    transition: all 0.3s ease;
}
.modal-type:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.4);
}
.modal-description {
    color: var(--text-secondary);
    line-height: 1.9;
    margin-bottom: 25px;
    font-size: 1.05rem;
    animation: modalContentFadeIn 0.6s ease 0.4s both;
}
.modal-details {
    list-style: none;
    margin-bottom: 25px;
    animation: modalContentFadeIn 0.6s ease 0.5s both;
}
.modal-details li {
    color: var(--text-secondary);
    margin-bottom: 14px;
    padding-left: 28px;
    position: relative;
    line-height: 1.7;
    transition: all 0.3s ease;
    animation: modalListItemFadeIn 0.5s ease both;
}
.modal-details li:nth-child(1) { animation-delay: 0.6s; }
.modal-details li:nth-child(2) { animation-delay: 0.7s; }
.modal-details li:nth-child(3) { animation-delay: 0.8s; }
.modal-details li:nth-child(4) { animation-delay: 0.9s; }
.modal-details li:nth-child(5) { animation-delay: 1.0s; }
.modal-details li:nth-child(6) { animation-delay: 1.1s; }
.modal-details li:nth-child(n+7) { animation-delay: 1.2s; }
@keyframes modalListItemFadeIn {
    from {
        opacity: 0;
        transform: translateX(-15px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}
.modal-details li:hover {
    color: var(--text-primary);
    transform: translateX(5px);
}
.modal-details li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent-color);
    font-weight: bold;
    font-size: 1.2rem;
    transition: all 0.3s ease;
}
.modal-details li:hover::before {
    transform: translateX(3px) scale(1.2);
    color: var(--accent-gradient);
}
.modal-links {
    margin-bottom: 25px;
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    animation: modalContentFadeIn 0.6s ease 0.6s both;
}
.modal-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 25px;
    animation: modalContentFadeIn 0.6s ease 0.7s both;
}
.modal-media {
    margin-top: 25px;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    border: 2px solid var(--border-color);
    transition: all 0.4s ease;
    animation: modalContentFadeIn 0.6s ease 0.8s both;
    position: relative;
}
.modal-media::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.1), transparent);
    transition: left 0.6s;
}
.modal-media:hover::before {
    left: 100%;
}
.modal-media:hover {
    transform: scale(1.02);
    box-shadow: 0 15px 40px rgba(59, 130, 246, 0.3);
    border-color: var(--accent-color);
}
.modal-media img {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.4s ease;
}
.modal-media:hover img {
    transform: scale(1.05);
}

/* Image Modal Styles */
.image-modal-content {
    background: var(--bg-primary);
    border-radius: 24px;
    max-width: 90vw;
    max-height: calc(100vh - 40px);
    width: auto;
    position: relative;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
    border: 1px solid var(--border-color);
    animation: modalFadeIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    overflow-y: auto;
    overflow-x: hidden;
    margin: 20px auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--accent-color) var(--bg-secondary);
}
.image-modal-content::-webkit-scrollbar {
    width: 8px;
}
.image-modal-content::-webkit-scrollbar-track {
    background: var(--bg-secondary);
    border-radius: 10px;
}
.image-modal-content::-webkit-scrollbar-thumb {
    background: var(--accent-gradient);
    border-radius: 10px;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}
.image-modal-content::-webkit-scrollbar-thumb:hover {
    background: var(--accent-color);
}
.image-modal-content::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: var(--accent-gradient);
    background-size: 200% auto;
    animation: gradient-text 3s linear infinite;
    z-index: 1;
}
.image-modal-header {
    padding: 25px 35px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-secondary);
    animation: modalHeaderSlideIn 0.5s ease 0.3s both;
}
.image-modal-header h3 {
    font-size: 1.4rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}
.image-modal-content .modal-close {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px);
}
.image-modal-content .modal-close:hover {
    background: var(--accent-gradient);
    border-color: transparent;
    transform: rotate(90deg) scale(1.1);
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}
.image-modal-image-container {
    padding: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: calc(90vh - 120px);
    overflow: auto;
    animation: modalContentFadeIn 0.6s ease 0.4s both;
    background: var(--bg-secondary);
}
.image-modal-image-container img {
    max-width: 100%;
    max-height: calc(90vh - 120px);
    width: auto;
    height: auto;
    display: block;
    object-fit: contain;
    border-radius: 15px;
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
    transition: all 0.4s ease;
    border: 2px solid var(--border-color);
}
.image-modal-image-container img:hover {
    transform: scale(1.02);
    box-shadow: 0 20px 50px rgba(59, 130, 246, 0.3);
    border-color: var(--accent-color);
}
.project-header { background: transparent; border-bottom: 1px solid var(--border-color); color: var(--text-primary); padding: 25px; display: flex; align-items: center; gap: 20px; }
.dark-mode .project-header { color: white; }
.showcase-icon { width: 60px; height: 60px; background: var(--accent-gradient); color: white; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; transition: all 0.3s ease; background-size: 200% auto; animation: gradient-text 5s linear infinite; }
.project-card:hover .showcase-icon { transform: scale(1.1) rotate(-5deg); }
.showcase-title h3 { font-size: 1.3rem; font-weight: 600; margin-bottom: 5px; }
.project-type { background: var(--accent-color); color: white; padding: 4px 12px; border-radius: 15px; font-size: 0.8rem; font-weight: 500; }
.project-content { padding: 30px; flex-grow: 1; display: flex; flex-direction: column; }
.project-description { color: var(--text-secondary); margin-bottom: 20px; line-height: 1.6; flex-grow: 1; }
.project-links { margin-bottom: 20px; }
.project-link { 
    display: inline-flex; 
    align-items: center; 
    gap: 8px; 
    color: var(--accent-color); 
    text-decoration: none; 
    font-weight: 600; 
    margin-right: 15px; 
    padding: 10px 18px;
    background: var(--bg-secondary);
    border: 2px solid var(--border-color);
    border-radius: 25px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    position: relative;
    overflow: visible;
}
.project-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-gradient);
    border-radius: 25px;
    opacity: 0;
    transition: opacity 0.4s ease;
    z-index: 0;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}
.project-link:hover::before {
    opacity: 1;
}
.project-link i,
.project-link {
    position: relative;
    z-index: 1;
    transition: all 0.3s ease;
}
.project-link:hover { 
    text-decoration: none;
    color: white !important;
    border-color: transparent;
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 8px 20px rgba(59, 130, 246, 0.4);
}
.project-link:hover i {
    transform: translateX(3px) rotate(5deg);
    color: rgb(255, 255, 255) !important;
}
.project-link:hover {
    color: rgb(255, 255, 255);
}
.project-link:active {
    transform: translateY(-1px) scale(1.02);
}
.presentation-container, .video-container { margin-top: 20px; border-radius: 15px; overflow: hidden; box-shadow: 0 8px 16px var(--card-shadow); transition: all 0.3s ease; }
.presentation-container:hover, .video-container:hover { transform: scale(1.02); box-shadow: 0 12px 24px rgba(0, 0, 0, 0.15); }
.video-container video { width: 100%; height: auto; display: block; }

/* --- Skills Section (Redesigned) --- */
.skills { background: var(--bg-primary); }
.skills-grid {
    display: flex;
    flex-direction: row;
    gap: 25px;
    max-width: 1400px;
    margin: 0 auto;
    flex-wrap: wrap;
    justify-content: center;
}
.skills-grid .skill-category {
    flex: 1;
    min-width: 250px;
    max-width: 300px;
}
.skill-category {
    background: var(--bg-secondary);
    padding: 30px;
    border-radius: 20px;
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}
.skill-category:hover {
    transform: translateY(-8px);
    box-shadow: 0 20px 40px var(--card-shadow);
}
.skill-category-title {
    font-size: 1.3rem;
    font-weight: 600;
    margin-bottom: 25px;
    color: var(--text-primary);
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid var(--border-color);
}
.skill-items-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    align-items: center;
}
.skill-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 15px;
    background: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    cursor: pointer;
    width: 100%;
    min-height: 120px;
    box-sizing: border-box;
    outline: none;
    position: relative;
    overflow: hidden;
}
.skill-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}
.skill-item:hover::before {
    width: 200px;
    height: 200px;
}
.skill-item:focus-visible {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
}
.skill-item:hover {
    transform: translateY(-8px) scale(1.05) rotate(2deg);
    background: var(--accent-gradient);
    border-color: transparent;
    box-shadow: 0 12px 30px rgba(59, 130, 246, 0.4);
}
.skill-item:active {
    transform: translateY(-3px) scale(1.02);
}
.skill-item:hover .skill-name {
    color: var(--text-primary);
}

.dark-mode .skill-item:hover .skill-name {
    color: white;
}
.skill-item:hover .skill-icon {
    color: white;
}
.skill-item:hover .skill-logo {
    filter: brightness(0) invert(1);
}
.skill-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    margin-bottom: 5px;
}
.skill-icon {
    font-size: 2rem;
    color: var(--accent-color);
    transition: all 0.3s ease;
}
.skill-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    transition: all 0.3s ease;
}
.skill-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-align: center;
    line-height: 1.3;
    transition: all 0.3s ease;
    word-wrap: break-word;
    width: 100%;
}
@media (max-width: 1200px) {
    .skills-grid {
        flex-wrap: wrap;
    }
    .skills-grid .skill-category {
        flex: 1 1 calc(50% - 12.5px);
        min-width: 250px;
    }
}
@media (max-width: 768px) {
    .skills-grid {
        flex-direction: column;
    }
    .skills-grid .skill-category {
        flex: 1 1 100%;
        max-width: 100%;
    }
    .skill-items-grid {
        gap: 15px;
    }
    .skill-item {
        min-height: 100px;
        padding: 12px;
    }
    .skill-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    .skill-icon {
        font-size: 1.5rem;
    }
    .skill-name {
        font-size: 0.75rem;
    }
    .platform-links {
        flex-direction: column;
    }
    .platform-link {
        width: 100%;
        justify-content: center;
    }
}

/* --- Certificates Section --- */
.certificates { background: var(--bg-primary); }
.certificates-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; }
.certificate-preview-card {
    background: var(--bg-primary);
    border-radius: 15px;
    overflow: hidden;
    box-shadow: 0 8px 20px var(--card-shadow);
    transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    cursor: pointer;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: relative;
}
.certificate-preview-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}
.certificate-preview-card:hover::after {
    opacity: 0.05;
}
.certificate-preview-card:hover {
    transform: translateY(-12px) scale(1.02);
    box-shadow: 0 20px 40px rgba(59, 130, 246, 0.25);
    border-color: var(--accent-color);
}
.certificate-preview-content {
    position: relative;
    z-index: 1;
}
.certificate-preview-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--bg-secondary);
}
.certificate-preview-content {
    padding: 20px;
}
.certificate-preview-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}
.certificate-preview-issuer {
    display: block;
    color: var(--accent-color);
    font-size: 0.85rem;
    font-weight: 500;
    margin-bottom: 12px;
}
.certificate-preview-description {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 15px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.certificate-preview-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
}
.certificate-preview-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(59, 130, 246, 0.3);
}

/* --- Contact Section --- */
.contact { background: var(--bg-secondary); }
.contact-content { display: grid; grid-template-columns: 1fr 1.2fr; gap: 60px; align-items: start; }
.contact-info {
    background: var(--bg-primary);
    padding: 40px;
    border-radius: 20px;
    box-shadow: 0 10px 30px var(--card-shadow);
    border: 1px solid var(--border-color);
}
.contact-info .contact-item {
    display: flex;
    align-items: flex-start;
    gap: 20px;
    margin-bottom: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}
.contact-info .contact-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}
.contact-info .contact-item i {
    font-size: 1.8rem;
    color: var(--accent-color);
    width: 40px;
    text-align: center;
    flex-shrink: 0;
}
.contact-info .contact-item h4 {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 5px;
    color: var(--text-primary);
}
.contact-info .contact-item p {
    color: var(--text-secondary);
    line-height: 1.6;
}
.social-links-contact {
    margin-top: 30px;
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
}
.social-links-contact .social-link {
    width: 50px;
    height: 50px;
    font-size: 1.2rem;
}
.contact-form { background: var(--bg-primary); padding: 40px; border-radius: 20px; box-shadow: 0 10px 30px var(--card-shadow); border: 1px solid var(--border-color); }
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}
.form-row { margin-bottom: 20px; }
.form-row input, .form-row textarea { width: 100%; padding: 15px; border: 2px solid var(--form-border); border-radius: 12px; font-size: 1rem; transition: all 0.3s ease; font-family: inherit; background: var(--form-bg); color: var(--text-primary); box-sizing: border-box; }
.form-row input::placeholder, .form-row textarea::placeholder { color: var(--text-secondary); }
.form-row input:focus, .form-row textarea:focus { outline: none; border-color: var(--accent-color); box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); background: var(--bg-primary); }
.form-row textarea { resize: vertical; min-height: 120px; }
.form-actions { margin-top: 10px; }
.form-actions button, .submit-btn { width: 100%; padding: 15px; background: var(--accent-gradient); color: white; border: none; border-radius: 12px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s ease; position: relative; overflow: hidden; background-size: 200% auto; animation: gradient-text 5s linear infinite; outline: none; }
.form-actions button:hover, .submit-btn:hover { transform: translateY(-3px); box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3); }
.form-actions button:focus-visible, .submit-btn:focus-visible { outline: 2px solid var(--accent-color); outline-offset: 2px; }
.form-actions button:disabled, .submit-btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

/* --- Footer --- */
.footer {
    background: var(--footer-bg);
    color: var(--footer-text);
    padding: 60px 0 20px 0;
}
.footer-container {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 40px;
}
.footer-logo {
    font-size: 28px;
    font-weight: 700;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    background-size: 200% auto;
    animation: gradient-text 5s linear infinite;
    margin-bottom: 15px;
    display: inline-block;
}
.footer-about p {
    max-width: 300px;
    line-height: 1.7;
    color: var(--text-secondary);
}
.footer-links h3, .footer-social h3 {
    font-size: 1.2rem;
    color: var(--text-primary);
    margin-bottom: 20px;
}
body:not(.dark-mode) .footer-links h3,
body:not(.dark-mode) .footer-social h3 {
    color: var(--text-primary);
}
.footer-links ul {
    list-style: none;
}
.footer-links ul li a {
    color: var(--text-secondary);
    text-decoration: none;
    margin-bottom: 10px;
    display: inline-block;
    transition: all 0.3s ease;
}
.footer-links ul li a:hover {
    color: var(--accent-color);
    transform: translateX(5px);
}
.footer-bottom {
    text-align: center;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
}

/* --- Shine Effect --- */
.social-link::before, .submit-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.4), transparent);
    transition: left 0.6s ease;
}
.social-link:hover::before, .submit-btn:hover::before {
    left: 100%;
}

/* --- Toast Notification --- */
#toast {
    visibility: hidden;
    min-width: 280px;
    max-width: 90%;
    background: var(--toast-success-bg);
    color: #ffffff;
    text-align: center;
    border-radius: 16px;
    padding: 18px 24px;
    position: fixed;
    z-index: 1001;
    right: 30px;
    bottom: 30px;
    font-size: 17px;
    font-weight: 500;
    line-height: 1.6;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateY(100px) scale(0.8);
    word-wrap: break-word;
    border: 2px solid rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}
#toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(255, 255, 255, 0.5);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}
#toast.show::before {
    animation: toastProgress 4s linear forwards;
}
@keyframes toastProgress {
    to {
        transform: scaleX(1);
    }
}
#toast.show {
    visibility: visible;
    opacity: 1;
    transform: translateY(0) scale(1);
    animation: toastBounceIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes toastBounceIn {
    0% {
        opacity: 0;
        transform: translateY(100px) scale(0.5) rotate(-5deg);
    }
    50% {
        transform: translateY(-10px) scale(1.05) rotate(2deg);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1) rotate(0deg);
    }
}
#toast.success {
    background: var(--toast-success-bg);
    color: #ffffff;
    box-shadow: 0 15px 40px rgba(34, 197, 94, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
#toast.success::before {
    background: rgba(255, 255, 255, 0.6);
}
#toast.error {
    background: var(--toast-error-bg);
    color: #ffffff;
    box-shadow: 0 15px 40px rgba(239, 68, 68, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}
#toast.error::before {
    background: rgba(255, 255, 255, 0.6);
}
/* Dark mode toast adjustments */
.dark-mode #toast {
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
}
.dark-mode #toast.success {
    box-shadow: 0 15px 40px rgba(34, 197, 94, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
}
.dark-mode #toast.error {
    box-shadow: 0 15px 40px rgba(239, 68, 68, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.25);
}

/* --- Utility & Responsive --- */
.scroll-to-top { position: fixed; bottom: 30px; right: 30px; width: 50px; height: 50px; background: var(--accent-gradient); color: white; border: none; border-radius: 50%; cursor: pointer; opacity: 0; visibility: hidden; transition: all 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); z-index: 1000; font-size: 18px; display: flex; align-items: center; justify-content: center; background-size: 200% auto; animation: gradient-text 4s linear infinite; }
.scroll-to-top.visible { opacity: 1; visibility: visible; animation: fadeInScale 0.5s ease-out, gradient-text 4s linear infinite; }
.scroll-to-top:hover { transform: scale(1.2) rotate(360deg); box-shadow: 0 10px 25px rgba(59, 130, 246, 0.5); }
.scroll-to-top:active { transform: scale(1.05) rotate(180deg); }

@media (max-width: 992px) {
    .timeline { margin-left: 0; }
    .timeline::before, .timeline-progress { left: 15px; }
    .timeline-item { padding-left: 50px; }
    .timeline-content::before { left: -43px; }
    .contact-content { grid-template-columns: 1fr; }
    .certificates-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    /* Navigation - Dark solid background on mobile */
    .navbar {
        background: var(--bg-primary) !important;
        backdrop-filter: none !important;
        -webkit-backdrop-filter: none !important;
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 2px 20px var(--shadow-color);
    }
    .navbar.scrolled {
        background: var(--bg-primary) !important;
    }
    .nav-container {
        padding: 0 15px;
    }
    .nav-menu { 
        position: fixed; 
        left: -100%; 
        top: 70px; 
        flex-direction: column; 
        background: var(--bg-primary); 
        width: 100%; 
        text-align: center; 
        transition: 0.3s; 
        box-shadow: 0 10px 27px var(--card-shadow); 
        padding: 20px 0; 
        height: calc(100vh - 70px);
        border-top: 1px solid var(--border-color);
    }
    .nav-menu.active { left: 0; }
    .nav-menu li {
        margin: 10px 0;
    }
    .nav-link {
        padding: 10px 20px;
        display: block;
    }
    .hamburger { display: flex; }
    .hamburger.active .bar:nth-child(2) { opacity: 0; }
    .hamburger.active .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
    .hamburger.active .bar:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
    
    /* Container padding */
    .container { padding: 0 15px; }
    
    /* Hero Section - Mobile Layout: Name → Image → Title */
    .hero { min-height: auto; padding: 100px 0 60px; }
    .hero-container { 
        display: flex;
        flex-direction: column;
        text-align: center; 
        gap: 0; 
        padding-top: 0; 
        padding: 0 15px;
        align-items: center;
    }
    .hero-content {
        display: contents;
    }
    .hero-text {
        display: contents;
    }
    .hero-name-wrapper {
        order: 1;
        margin-bottom: 20px;
        width: 100%;
        text-align: center;
    }
    .hero-image {
        order: 2;
        width: 100%;
        display: flex;
        justify-content: center;
        margin: 20px 0;
    }
    .hero-content-wrapper {
        order: 3;
        width: 100%;
        margin-top: 20px;
        text-align: center;
    }
    .hero-title { 
        font-size: 2.5rem; 
        line-height: 1.2; 
        word-wrap: break-word;
        margin-bottom: 0;
    }
    .hero-subtitle { 
        font-size: 1.2rem; 
        line-height: 1.4;
        margin-top: 0;
        margin-bottom: 20px;
    }
    .hero-description { 
        margin-left: auto; 
        margin-right: auto; 
        font-size: 1rem; 
        line-height: 1.6; 
        max-width: 100%; 
        padding: 0 10px; 
    }
    .hero-contact { justify-content: center; align-items: center; flex-wrap: wrap; }
    .hero-contact .contact-item { justify-content: center; font-size: 0.9rem; }
    .social-links { justify-content: center; flex-wrap: wrap; }
    .profile-container { width: 250px; height: 250px; margin: 0 auto; }
    .cv-download-btn { width: 100%; max-width: 300px; justify-content: center; margin: 0 auto; }
    .decorative-shape { display: none; }
    
    /* About Section */
    .about-content { grid-template-columns: 1fr; gap: 30px; }
    .about-text p { font-size: 1rem; line-height: 1.7; word-wrap: break-word; }
    .education-card { padding: 20px; margin: 0; }
    .education-card h3 { font-size: 1.2rem; }
    .education-item h4 { font-size: 1rem; word-wrap: break-word; }
    .education-item p { font-size: 0.9rem; }
    
    /* Experience Section */
    .timeline { padding: 0; }
    .timeline-item { padding-left: 40px; margin-bottom: 30px; }
    .timeline-content { padding: 20px; margin: 0; overflow: hidden; }
    .timeline-content::before { left: -33px; width: 20px; height: 20px; }
    .timeline-header h3 { font-size: 1.2rem; line-height: 1.3; word-wrap: break-word; }
    .company { font-size: 1rem; display: block; word-wrap: break-word; }
    .period { font-size: 0.85rem; padding: 3px 10px; display: inline-block; margin-top: 5px; }
    .timeline-details { margin: 10px 0; padding: 0; }
    .timeline-details li { font-size: 0.9rem; margin-bottom: 8px; line-height: 1.5; word-wrap: break-word; padding-left: 20px; }
    .tech-stack { gap: 6px; margin-top: 10px; flex-wrap: wrap; }
    .tech-tag { font-size: 0.75rem; padding: 5px 12px; white-space: nowrap; }
    .timeline-body-content {
        grid-template-columns: 1fr !important;
        gap: 20px;
        margin-top: 15px;
    }
    .timeline-text-content {
        order: 1;
        width: 100%;
        overflow: hidden;
    }
    .certificate-image {
        order: 2;
        width: 100% !important;
        max-width: 100% !important;
        height: auto;
        min-height: 200px;
        margin: 20px auto 0;
    }
    .certificate-image img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    /* Projects Section */
    .projects-grid { grid-template-columns: 1fr; gap: 20px; }
    .project-preview-card { margin-bottom: 0; overflow: hidden; }
    .project-preview-image { height: 180px; object-fit: cover; }
    .project-preview-content { padding: 15px; }
    .project-preview-title-row { flex-wrap: wrap; gap: 8px; }
    .project-preview-title { font-size: 1.1rem; line-height: 1.3; word-wrap: break-word; }
    .project-preview-type { font-size: 0.7rem; padding: 3px 10px; }
    .project-preview-links { flex-wrap: wrap; gap: 8px; }
    .project-preview-link { font-size: 0.8rem; padding: 3px 8px; }
    .project-preview-description { font-size: 0.85rem; line-height: 1.5; word-wrap: break-word; }
    .project-preview-btn { font-size: 0.9rem; padding: 8px; }
    
    /* Skills Section */
    .skills-grid {
        flex-direction: column;
        gap: 20px;
        padding: 0;
    }
    .skills-grid .skill-category {
        flex: 1 1 100%;
        max-width: 100%;
        margin: 0;
    }
    .skill-category-title {
        font-size: 1.2rem;
        word-wrap: break-word;
    }
    .skill-items-grid {
        gap: 12px;
        justify-content: center;
    }
    .skill-item {
        min-height: 100px;
        padding: 12px;
        width: calc(50% - 6px);
        max-width: 150px;
        box-sizing: border-box;
    }
    .skill-icon-wrapper {
        width: 40px;
        height: 40px;
    }
    .skill-icon {
        font-size: 1.5rem;
    }
    .skill-name {
        font-size: 0.75rem;
        word-wrap: break-word;
        text-align: center;
    }
    .platform-links {
        flex-direction: column;
        gap: 10px;
    }
    .platform-link {
        width: 100%;
        justify-content: center;
        padding: 12px 20px;
    }
    
    /* Certificates Section */
    .certificates-grid { grid-template-columns: 1fr; gap: 20px; }
    .certificate-preview-card { overflow: hidden; }
    .certificate-preview-image { height: 180px; }
    .certificate-preview-content { padding: 15px; }
    .certificate-preview-title { font-size: 1.1rem; line-height: 1.3; word-wrap: break-word; }
    .certificate-preview-issuer { font-size: 0.8rem; }
    .certificate-preview-description { font-size: 0.85rem; line-height: 1.5; word-wrap: break-word; }
    
    /* Contact Section */
    .contact-content { grid-template-columns: 1fr; gap: 30px; }
    .contact-info { padding: 25px; margin: 0; }
    .contact-info .contact-item { margin-bottom: 20px; padding-bottom: 20px; flex-wrap: wrap; }
    .contact-info .contact-item i { font-size: 1.5rem; flex-shrink: 0; }
    .contact-info .contact-item h4 { font-size: 1rem; word-wrap: break-word; }
    .contact-info .contact-item p { font-size: 0.9rem; word-wrap: break-word; line-height: 1.5; }
    .contact-form { padding: 25px; margin: 0; }
    .form-row { margin-bottom: 15px; }
    .form-row input, .form-row textarea { padding: 12px; font-size: 0.95rem; width: 100%; box-sizing: border-box; }
    .form-actions { margin-top: 10px; }
    .form-actions button, .submit-btn { padding: 12px; font-size: 0.95rem; width: 100%; }
    
    /* Footer */
    .footer-container { grid-template-columns: 1fr; text-align: center; gap: 30px; }
    .footer-about p { max-width: 100%; }
    .footer-links, .footer-social { text-align: center; }
    
    /* General */
    .section-title { font-size: 2.2rem; margin-bottom: 40px; line-height: 1.2; word-wrap: break-word; padding: 0 10px; }
    .section-subtitle { font-size: 1rem; margin-bottom: 40px; line-height: 1.5; word-wrap: break-word; padding: 0 10px; }
    section { padding: 60px 0; overflow-x: hidden; }
    
    /* Modal */
    .modal-body { padding: 25px; }
    .modal-title { font-size: 1.5rem; }
    .modal-description { font-size: 0.9rem; }
    .modal-close { width: 35px; height: 35px; font-size: 1.2rem; top: 15px; right: 15px; }
    .image-modal-header { padding: 15px 20px; }
    .image-modal-header h3 { font-size: 1.1rem; }
    .image-modal-image-container { padding: 15px; }
    
    /* Toast */
    #toast {
        right: 15px;
        bottom: 15px;
        left: 15px;
        min-width: auto;
        max-width: calc(100% - 30px);
        font-size: 15px;
        font-weight: 500;
        padding: 14px 16px;
        line-height: 1.4;
    }
    
    /* Scroll to top */
    .scroll-to-top {
        width: 45px;
        height: 45px;
        bottom: 20px;
        right: 20px;
        font-size: 16px;
    }
}

@media (max-width: 480px) {
    /* Container */
    .container { padding: 0 12px; }
    
    /* Hero Section */
    .hero { padding: 90px 0 50px; }
    .hero-container { padding: 0 12px; gap: 25px; }
    .hero-title { font-size: 2rem; line-height: 1.2; }
    .hero-subtitle { font-size: 1.1rem; line-height: 1.3; }
    .hero-description { font-size: 0.95rem; padding: 0 5px; }
    .hero-image { margin: 15px 0; }
    .profile-container { width: 200px; height: 200px; }
    .cv-download-btn { padding: 10px 20px; font-size: 0.9rem; max-width: 100%; }
    
    /* Navigation */
    .nav-container { padding: 0 12px; }
    .logo-text { font-size: 20px; }
    .theme-toggle-btn { width: 45px; height: 45px; font-size: 1.1rem; }
    .hamburger { padding: 3px; }
    
    /* Sections */
    .section-title { font-size: 1.8rem; margin-bottom: 30px; padding: 0 5px; }
    .section-subtitle { font-size: 0.95rem; margin-bottom: 30px; padding: 0 5px; }
    section { padding: 50px 0; }
    
    /* About */
    .about-text p { font-size: 0.95rem; }
    .education-card { padding: 15px; }
    
    /* Experience */
    .timeline-item { padding-left: 30px; }
    .timeline-content { padding: 15px; }
    .timeline-content::before { left: -25px; width: 18px; height: 18px; }
    .timeline-header h3 { font-size: 1.1rem; }
    .timeline-details li { font-size: 0.85rem; }
    .certificate-image { min-height: 180px; }
    
    /* Projects */
    .projects-grid { grid-template-columns: 1fr; gap: 15px; }
    .project-preview-image { height: 160px; }
    .project-preview-content { padding: 12px; }
    .project-preview-title { font-size: 1rem; }
    .project-preview-description { font-size: 0.8rem; }
    
    /* Skills */
    .skill-category { padding: 20px 15px; }
    .skill-category-title { font-size: 1.1rem; }
    .skill-item { min-height: 90px; padding: 10px; width: calc(50% - 6px); }
    .skill-icon-wrapper { width: 35px; height: 35px; }
    .skill-icon { font-size: 1.3rem; }
    .skill-name { font-size: 0.7rem; }
    
    /* Certificates */
    .certificate-preview-image { height: 160px; }
    .certificate-preview-content { padding: 12px; }
    
    /* Contact */
    .contact-info { padding: 20px 15px; }
    .contact-form { padding: 20px 15px; }
    .form-row input, .form-row textarea { padding: 10px; font-size: 0.9rem; }
    
    /* Footer */
    .footer { padding: 40px 0 15px 0; }
    .footer-container { gap: 25px; margin-bottom: 30px; padding: 0 15px; }
    .footer-logo { font-size: 24px; }
    
    /* Modal */
    .modal-body { padding: 20px 15px; }
    .modal-title { font-size: 1.3rem; }
    .modal-close { width: 30px; height: 30px; font-size: 1rem; }
    
    /* Toast */
    #toast {
        right: 10px;
        left: 10px;
        bottom: 10px;
        max-width: calc(100% - 20px);
        font-size: 14px;
        font-weight: 500;
        padding: 12px 14px;
        line-height: 1.4;
    }
}
