/* ===== CSS Custom Properties for Theme Colors ===== */
:root {
    --primary-color: #004080;
    --primary-hover: #002d5a;
    --secondary-color: #0066cc;
    --text-color: #2c3e50;
    --bg-gradient-start: #eaf1fb;
    --bg-gradient-end: #f8f9fc;
    --card-bg: #ffffff;
    --shadow-light: rgba(0, 0, 0, 0.06);
    --shadow-medium: rgba(0, 0, 0, 0.1);
    --shadow-heavy: rgba(0, 0, 0, 0.15);
    --border-radius: 12px;
    --transition-speed: 0.3s;
}

/* ===== Global Base Styles ===== */
html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    margin: 0 auto;
    background: linear-gradient(to bottom right, var(--bg-gradient-start), var(--bg-gradient-end));
    color: var(--text-color);
    padding: 40px 20px;
    max-width: 1000px;
    line-height: 1.7;
    transition: background var(--transition-speed) ease, color var(--transition-speed) ease;
}

* {
    box-sizing: border-box;
}

/* ===== Typography ===== */
h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #2d3a58;
    font-weight: 700;
}

h2 {
    font-size: 1.6rem;
    margin-top: 0;
    margin-bottom: 1.5rem;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

h2 i {
    color: var(--primary-color);
    font-size: 1.4rem;
}

h3 {
    font-size: 1.3rem;
    color: var(--primary-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

h4 {
    font-size: 1.1rem;
    color: var(--text-color);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
}

/* ===== Header ===== */
header {
    text-align: center;
    margin-bottom: 40px;
}

.contact-links {
    font-size: 1rem;
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.contact-links i {
    color: var(--primary-color);
}

/* ===== Navigation ===== */
nav {
    margin-bottom: 40px;
    text-align: center;
    padding: 20px 0;
    position: relative;
}

/* ===== Hamburger Button ===== */
.hamburger {
    background: none;
    border: none;
    cursor: pointer;
    padding: 10px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 50px;
    height: 50px;
    margin: 0 auto 20px;
    transition: all var(--transition-speed) ease;
    background-color: var(--primary-color);
    box-shadow: 0 3px 6px var(--shadow-medium);
}

.hamburger:hover {
    background-color: var(--primary-hover);
    transform: scale(1.05);
    box-shadow: 0 5px 12px var(--shadow-medium);
}

.hamburger-line {
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 2px 0;
    transition: all var(--transition-speed) ease;
    border-radius: 2px;
}

/* Hamburger Animation */
.hamburger.active .hamburger-line:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
}

.hamburger.active .hamburger-line:nth-child(2) {
    opacity: 0;
}

.hamburger.active .hamburger-line:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
}

/* ===== Navigation Menu ===== */
.nav-menu {
    list-style: none;
    display: none;
    flex-direction: column;
    position: absolute;
    top: 70px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    box-shadow: 0 12px 28px var(--shadow-medium);
    padding: 20px;
    gap: 15px;
    margin: 0;
    min-width: 280px;
    z-index: 1000;
    border: 1px solid #e0e0e0;
}

.nav-menu.active {
    display: flex;
}

.nav-menu li {
    display: flex;
    align-items: center;
    width: 100%;
}

.nav-menu li a {
    background-color: var(--primary-color);
    color: white;
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all var(--transition-speed) ease;
    box-shadow: 0 3px 6px var(--shadow-medium);
    text-align: center;
    text-decoration: none;
    display: block;
    border: 2px solid transparent;
    width: 100%;
}

.nav-menu li a:hover {
    background-color: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 5px 12px var(--shadow-medium);
}

/* ===== Dark Mode Toggle Aligned with Nav Buttons ===== */
.theme-toggle {
    display: flex;
    align-items: center;
    cursor: pointer;
    gap: 10px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--primary-color);
}

.theme-toggle input {
    display: none;
}

.theme-toggle .slider {
    width: 50px;
    height: 26px;
    background-color: var(--primary-color);
    border-radius: 26px;
    position: relative;
    box-shadow: 0 3px 6px var(--shadow-medium);
    transition: all var(--transition-speed) ease;
}

.theme-toggle .slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background-color: white;
    border-radius: 50%;
    transition: transform var(--transition-speed) ease;
}

.theme-toggle input:checked + .slider {
    background-color: var(--primary-hover);
}

.theme-toggle input:checked + .slider::before {
    transform: translateX(24px);
}

/* ===== Profile Image ===== */
.pic-card {
    display: flex;
    justify-content: center;
    margin-bottom: 30px;
}

.pic-card img {
    width: 180px;
    height: 180px;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid white;
    box-shadow: 0 8px 24px var(--shadow-heavy);
    transition: transform var(--transition-speed) ease;
}

.pic-card img:hover {
    transform: scale(1.05);
}

/* ===== Section Cards ===== */
section {
    background-color: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: 0 6px 18px var(--shadow-light);
    transition: all var(--transition-speed) ease;
    opacity: 0;
    transform: translateY(30px);
}

section:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 28px var(--shadow-medium);
}

section.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Collapsible Section Styles ===== */
.collapsible-section .section-header {
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    margin: -10px 0 15px 0;
    transition: all var(--transition-speed) ease;
}

.collapsible-section .section-header:hover {
    color: var(--secondary-color);
}

.collapsible-section .toggle-icon {
    font-size: 1.2rem;
    transition: transform 0.3s ease;
    color: var(--primary-color);
}

.collapsible-section.collapsed .toggle-icon {
    transform: rotate(-90deg);
}

.collapsible-section .section-content {
    max-height: 5000px;
    overflow: hidden;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.2s ease 0.05s;
    opacity: 1;
}

.collapsible-section.collapsed .section-content {
    max-height: 0;
    opacity: 0;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease;
}

/* ===== Links ===== */
a {
    color: var(--secondary-color);
    font-weight: 500;
    text-decoration: none;
    transition: color var(--transition-speed) ease;
}

a:hover {
    color: var(--primary-color);
    text-decoration: underline;
}

/* ===== Lists ===== */
ul {
    padding-left: 20px;
}

li {
    margin-bottom: 8px;
}

/* ===== Skills Grid ===== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    margin-top: 20px;
}

.skill-category {
    background: rgba(0, 64, 128, 0.05);
    padding: 20px;
    border-radius: var(--border-radius);
    border-left: 4px solid var(--primary-color);
}

.skill-category h3 {
    margin-top: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.skill-category ul {
    margin: 0;
    padding-left: 16px;
}

/* ===== Achievements Grid ===== */
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-top: 20px;
}

.achievement-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: rgba(0, 64, 128, 0.05);
    border-radius: 8px;
    font-weight: 500;
}

.achievement-item i {
    color: var(--primary-color);
    font-size: 1.2rem;
    width: 24px;
    text-align: center;
}

/* ===== Timeline Styles ===== */
.timeline-item {
    position: relative;
    padding-left: 35px;
    margin-bottom: 35px;
}

.timeline-item:before {
    content: '';
    position: absolute;
    left: 12px;
    top: 8px;
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 0 0 3px var(--primary-color);
}

.timeline-item:after {
    content: '';
    position: absolute;
    left: 17px;
    top: 25px;
    width: 2px;
    height: calc(100% - 15px);
    background: linear-gradient(to bottom, var(--primary-color), #e0e0e0);
}

.timeline-item:last-child:after {
    display: none;
}

.timeline-item h3 {
    margin-top: 0;
    margin-bottom: 5px;
}

.timeline-item ul {
    margin-top: 10px;
}

/* ===== Projects Section ===== */
.project-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
}

.project-card {
    background: var(--card-bg);
    border-radius: var(--border-radius);
    padding: 25px;
    box-shadow: 0 6px 14px var(--shadow-light);
    transition: all var(--transition-speed) ease;
    display: flex;
    flex-direction: column;
    border: 1px solid #f0f0f0;
}

.project-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 28px var(--shadow-medium);
}

.project-card h3 {
    font-size: 1.4rem;
    color: var(--primary-color);
    margin-bottom: 12px;
}

.project-card p {
    font-size: 1rem;
    color: #555;
    margin-bottom: 20px;
}

.project-details {
    margin-bottom: 25px;
}

.project-details h4 {
    color: var(--primary-color);
    margin-bottom: 8px;
    font-size: 1.1rem;
}

.project-details p {
    margin-bottom: 12px;
    font-size: 0.95rem;
}

.project-card img {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transition: all var(--transition-speed) ease;
}

.project-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
}

.project-tag {
    background: linear-gradient(135deg, #e8f0fe, #f0f7ff);
    color: var(--primary-color);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(0, 64, 128, 0.2);
}

/* ===== Contact Section Enhancements ===== */
.contact-info {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 20px;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 1.1rem;
    padding: 15px;
    background: rgba(0, 64, 128, 0.05);
    border-radius: 8px;
    transition: all var(--transition-speed) ease;
}

.contact-item:hover {
    background: rgba(0, 64, 128, 0.1);
    transform: translateX(5px);
}

.contact-item i {
    width: 24px;
    text-align: center;
    color: var(--primary-color);
    font-size: 1.2rem;
}

/* ===== Footer ===== */
footer {
    text-align: center;
    color: #777;
    font-size: 0.95rem;
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid #e0e0e0;
}

/* ===== Dark Mode Styling ===== */
.dark-mode {
    --text-color: #e0e0e0;
    --bg-gradient-start: #1a1a1a;
    --bg-gradient-end: #2d2d2d;
    --card-bg: #1e1e1e;
    --shadow-light: rgba(255, 255, 255, 0.05);
    --shadow-medium: rgba(255, 255, 255, 0.1);
    --shadow-heavy: rgba(255, 255, 255, 0.15);
}

.dark-mode h1,
.dark-mode h2 {
    color: #bbdefb;
}

.dark-mode h2 i {
    color: #82b1ff;
}

.dark-mode h3,
.dark-mode h4 {
    color: #82b1ff;
}

.dark-mode p,
.dark-mode li {
    color: #cccccc;
}

.dark-mode .contact-links i {
    color: #82b1ff;
}

.dark-mode .hamburger {
    background-color: #2c3e50;
}

.dark-mode .hamburger:hover {
    background-color: #3b4a6b;
}

.dark-mode .nav-menu {
    background-color: var(--card-bg);
    border-color: #333;
}

.dark-mode .nav-menu li a {
    background-color: #2c3e50;
    color: #ffffff;
}

.dark-mode .nav-menu li a:hover {
    background-color: #3b4a6b;
}

.dark-mode .theme-toggle {
    color: #82b1ff;
}

.dark-mode section,
.dark-mode .project-card {
    background-color: var(--card-bg);
    border-color: #333;
}

.dark-mode .project-card p {
    color: #b0b0b0;
}

.dark-mode .skill-category,
.dark-mode .achievement-item,
.dark-mode .contact-item {
    background: rgba(130, 177, 255, 0.1);
}

.dark-mode .contact-item:hover {
    background: rgba(130, 177, 255, 0.15);
}

.dark-mode .project-tag {
    background: rgba(130, 177, 255, 0.2);
    color: #a3c9ff;
    border-color: rgba(130, 177, 255, 0.3);
}

.dark-mode a {
    color: #90caf9;
}

.dark-mode a:hover {
    color: #bbdefb;
}

.dark-mode footer {
    color: #aaa;
    border-color: #333;
}

.dark-mode .timeline-item:before {
    background: #82b1ff;
    box-shadow: 0 0 0 3px #82b1ff;
}

.dark-mode .timeline-item:after {
    background: linear-gradient(to bottom, #82b1ff, #444);
}

.dark-mode .collapsible-section .section-header:hover {
    color: #90caf9;
}

.dark-mode .collapsible-section .toggle-icon {
    color: #82b1ff;
}

/* ===== Animation Classes ===== */
.fade-in {
    opacity: 0;
    transform: translateY(30px);
    transition: all 0.8s ease-out;
}

.fade-in.visible {
    opacity: 1;
    transform: translateY(0);
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    body {
        padding: 20px 15px;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.4rem;
    }

    .nav-menu {
        min-width: 260px;
        padding: 15px;
    }

    .nav-menu li a {
        padding: 12px 16px;
    }

    .pic-card img {
        width: 150px;
        height: 150px;
    }

    section {
        padding: 20px;
    }

    .skills-grid,
    .achievements-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }

    .contact-links {
        flex-direction: column;
        gap: 10px;
    }

    .timeline-item {
        padding-left: 25px;
    }

    .timeline-item:before {
        left: 8px;
    }

    .timeline-item:after {
        left: 13px;
    }

    .project-tags {
        justify-content: center;
    }
}

@media (max-width: 480px) {
    body {
        padding: 15px 10px;
    }

    h1 {
        font-size: 1.8rem;
    }

    nav ul li a {
        padding: 10px 14px;
        font-size: 0.9rem;
    }

    section {
        padding: 15px;
    }

    .pic-card img {
        width: 120px;
        height: 120px;
    }
}

/* ===== Print Styles ===== */
@media print {
    body {
        background: white;
        color: black;
        max-width: none;
        padding: 0;
    }

    nav,
    .theme-toggle,
    .lightbox {
        display: none;
    }

    section {
        box-shadow: none;
        border: 1px solid #ccc;
        page-break-inside: avoid;
    }

    .project-card img {
        max-width: 200px;
    }

    a {
        color: black;
        text-decoration: none;
    }

    a[href^="mailto:"]:after {
        content: " (" attr(href) ")";
    }

    a[href^="tel:"]:after {
        content: " (" attr(href) ")";
    }
}

/* ===== Accessibility Enhancements ===== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Focus styles for keyboard navigation */
a:focus,
button:focus,
input:focus,
.zoomable:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --text-color: #000000;
    }

    .dark-mode {
        --primary-color: #4080ff;
        --text-color: #ffffff;
    }
}
