/* Variables for theming */
:root {
    --bg-primary: #ffffff;
    --bg-secondary: #f8f9fa;
    --text-primary: #2d3436;
    --text-secondary: #636e72;
    --accent: #0984e3;
    --border: #dfe6e9;
    --shadow: rgba(0, 0, 0, 0.1);
}

[data-theme="dark"] {
    --bg-primary: #2d3436;
    --bg-secondary: #222;
    --text-primary: #f8f9fa;
    --text-secondary: #dfe6e9;
    --accent: #74b9ff;
    --border: #636e72;
    --shadow: rgba(0, 0, 0, 0.3);
}

/* Base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    transition: background-color 0.3s, color 0.3s;
}

body {
    font-family: 'Open Sans', sans-serif;
    line-height: 1.6;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    padding-top: 20px;  /* Added for sticky header spacing */
}

/* Theme toggle button */
.theme-toggle {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 10px;
    font-size: 1.2rem;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    cursor: pointer;
    transition: transform 0.3s;
    box-shadow: 0 2px 5px var(--shadow);
    z-index: 1001;  /* Updated to be above sticky headers */
}

.theme-toggle:hover {
    transform: scale(1.1);
}

/* Header styles */
header {
    text-align: center;
    padding: 60px 0;
    background-color: var(--bg-secondary);
    border-radius: 15px;
    margin-bottom: 40px;
}

h1 {
    font-family: 'Poppins', sans-serif;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 15px;
    font-size: 2.5rem;
}

/* Section styles */
section {
    margin: 40px 0;
    padding: 30px;
    padding-top: 80px; /* Increased to accommodate sticky header */
    border-radius: 15px;
    background-color: var(--bg-secondary);
    box-shadow: 0 4px 6px var(--shadow);
    position: relative;
    isolation: isolate;
}

/* Ensure content stays below sticky header */
.section > *:not(.section-title) {
    position: relative;
    z-index: 1;
    margin-top: 20px; /* Add spacing after the title */
}

h2 {
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.8rem;
}

/* Section title styles */
.section-title {
    position: sticky;
    top: 0;
    z-index: 1000;
    background-color: var(--bg-secondary); /* Changed to be fully opaque */
    padding: 1.5rem;
    margin: -80px -30px 30px -30px; /* Adjusted top margin to match new padding */
    width: calc(100% + 60px);
    box-shadow: 0 2px 8px var(--shadow);
    border-bottom: 1px solid var(--border);
}

.section-title h2 {
    margin: 0;
    padding: 0;
}

/* Experience section styles */
.section-experience {
    position: relative;
    overflow: visible;
}

.experience-item {
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 2px 4px var(--shadow);
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Add hover effect for desktop only */
@media (min-width: 769px) {
    .experience-item:hover {
        transform: scale(1.02);
        box-shadow: 0 8px 16px var(--shadow);
    }
}

.experience-item.expanded {
    opacity: 1;
    transform: none;
    margin-bottom: 2rem;
}

.experience-item.expanded:hover {
    transform: scale(1.03) translateY(-5px);
    box-shadow: 0 8px 16px var(--shadow);
    cursor: pointer; /* Optional: adds a pointer cursor on hover */
}

/* Remove any conflicting transform properties from other selectors */
.experience-item.visible {
    opacity: 1;
    /* Remove any transform properties here if they exist */
}

.education-item {
    padding: 1.5rem;
    background: var(--bg-primary);
    border-radius: 12px;
    box-shadow: 0 2px 4px var(--shadow);
}

.degree {
    color: var(--accent);
    font-size: 1.1rem;
    margin: 0.5rem 0;
}

.education-period {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* Skills styles */
.skills-wrapper {
    display: grid;
    gap: 2rem;
}

.skills-category h3 {
    margin-bottom: 1rem;
    color: var(--accent);
}

.skills-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.skill-tag {
    background: var(--bg-primary);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    box-shadow: 0 2px 4px var(--shadow);
}

/* Footer styles */
footer {
    text-align: center;
    padding: 30px;
    margin-top: 60px;
    border-top: 1px solid var(--border);
}

.social-links {
    display: flex;
    justify-content: center;
    gap: 2rem;
}

.social-link {
    color: var(--text-secondary);
    font-size: 2rem;
    transition: color 0.3s, transform 0.3s;
}

.social-link:hover {
    color: var(--accent);
    transform: translateY(-3px);
}

.footer-cta {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* Bio section */
.section-bio {
    margin: 20px 0 40px;
    padding: 30px;
    border-radius: 15px;
    background-color: var(--bg-secondary);
    box-shadow: 0 4px 6px var(--shadow);
}

.bio-content {
    margin: 0 auto;
    text-align: center;
    line-height: 1.8;
    color: var(--text-secondary);
    font-size: 1.1rem;
}

/* Section transitions */
.section-hidden {
    opacity: 0;
    transform: none;
    transition: opacity 0.5s;
}

.section-visible {
    opacity: 1;
    transform: none;
}

/* Ensure proper spacing between items */
.experience-item:not(:last-child),
.education-item:not(:last-child) {
    margin-bottom: 2rem;
}

/* Role description styles */
.role-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    line-height: 1.8;
    margin: 1.5rem 0;
    padding: 0 1rem;
    border-left: 3px solid var(--accent);
    font-style: italic;
}

/* Achievement list styles */
.achievements {
    list-style: none;
    padding: 0;
    margin: 0;
}

.achievements li {
    position: relative;
    padding: 1rem 1.5rem;
    margin: 1rem 0;
    background: var(--bg-primary);
    border-radius: 8px;
    box-shadow: 0 2px 4px var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.achievements li:hover {
    transform: translateX(5px);
    box-shadow: 2px 4px 8px var(--shadow);
}

.achievements li::before {
    content: "→";
    position: absolute;
    left: 0.5rem;
    color: var(--accent);
    font-weight: bold;
}

/* Experience header refinements */
.experience-header {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.company-name {
    color: var(--accent);
    font-size: 1.2rem;
    margin: 0.5rem 0;
}

/* Mobile styles */
@media (max-width: 768px) {
    /* Keep your existing mobile styles */
    body {
        padding: 15px;
    }

    header {
        padding: 40px 20px;
    }

    h1 {
        font-size: 2rem;
    }

    .experience-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .work-period {
        margin-top: 5px;
    }

    .skills-grid {
        gap: 0.5rem;
    }
    
    .skill-tag {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }

    /* Experience specific mobile adjustments */
    .experience-item {
        margin: 1rem 0;
        padding: 1rem;
        transform: none !important; /* Disable any transform on mobile */
    }

    .experience-item.expanded {
        opacity: 1;
        transform: none !important;
        max-height: none;  /* Remove fixed height restriction */
        margin-bottom: 1.5rem;
        overflow: visible;
        height: auto;
    }

    .achievements li {
        padding: 0.8rem 1rem 0.8rem 2rem;
        margin: 0.8rem 0;
        font-size: 0.95rem;
        line-height: 1.6;
    }

    section {
        padding: 20px;
        padding-top: 60px;
        -webkit-overflow-scrolling: touch;
    }

    .role-description {
        font-size: 0.95rem;
        padding: 0 0.5rem;
        margin: 1rem 0;
    }

    .section-title {
        position: -webkit-sticky;
        position: sticky;
        padding: 1rem;
    }

    .view-more-btn {
        width: 100%;
        padding: 0.8rem;
    }
}

/* Print styles */
@media print {
    body {
        padding: 0;
        background: white;
    }

    .theme-toggle {
        display: none;
    }

    section {
        break-inside: avoid;
        page-break-inside: avoid;
        background: white;
        box-shadow: none;
    }

    .experience-item {
        box-shadow: none;
        border: 1px solid #eee;
    }

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

/* Add these styles */
.achievements li.hidden {
    display: none;
}

.view-more-btn {
    background: var(--bg-secondary);
    color: var(--accent);
    border: 1px solid var(--accent);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    margin: 1rem auto;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: block;
    width: 95%;
}

.view-more-btn:hover {
    background: var(--accent);
    color: var(--bg-secondary);
}

/* Adjust width for desktop */
@media (min-width: 769px) {
    .view-more-btn {
        width: 90%;
    }
}

/* Keep the full width for mobile */
@media (max-width: 768px) {
    .view-more-btn {
        width: 100%;
        padding: 0.8rem;
    }
}

/* Add these to your existing skills styles */
.toggle-skills {
    cursor: pointer;
    background: var(--bg-primary);
    border: 1px dashed var(--accent);
    color: var(--accent);
}

.toggle-skills:hover {
    background: var(--accent);
    color: var(--bg-primary);
}

/* Ensure this style exists and is properly scoped */
.skills-grid .skill-tag.hidden {
    display: none;
}