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

:root {
    --bg-color: #0d1117;
    --secondary-bg: #161b22;
    --border-color: #30363d;
    --text-primary: #c9d1d9;
    --text-secondary: #8b949e;
    --accent-color: #58a6ff;
    --accent-hover: #79c0ff;
    --prompt-color: #7ee787;
}

/* Light Theme */
html[data-theme="light"] {
    --bg-color: #ffffff;
    --secondary-bg: #f6f8fa;
    --border-color: #d0d7de;
    --text-primary: #1f2328;
    --text-secondary: #656d76;
    --accent-color: #0969da;
    --accent-hover: #0550ae;
    --prompt-color: #1a7f37;
}

body {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    background-color: var(--bg-color);
    color: var(--text-primary);
    line-height: 1.6;
    font-size: 14px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

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

/* Header Section */
.header {
    margin-bottom: 40px;
    padding-bottom: 30px;
    border-bottom: 1px solid var(--border-color);
}

.profile-section {
    display: flex;
    gap: 30px;
    align-items: center;
}

.profile-image {
    position: relative;
    width: 150px;
    height: 150px;
    flex-shrink: 0;
}

.profile-image img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: cover;
    border: 2px solid var(--border-color);
}

.profile-placeholder {
    display: none;
    width: 100%;
    height: 100%;
    background-color: var(--secondary-bg);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    font-size: 12px;
    text-align: center;
    line-height: 1.3;
}

.profile-info {
    flex: 1;
}

.name {
    font-size: 32px;
    margin-bottom: 5px;
    color: var(--text-primary);
    font-weight: 600;
}

.title {
    font-size: 16px;
    color: var(--text-secondary);
    margin-bottom: 5px;
}

.location {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.contact {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    font-size: 13px;
    color: var(--text-secondary);
}

.contact span {
    display: flex;
    align-items: center;
    justify-content: center;
}

.contact i {
    color: var(--prompt-color);
    width: 24px;
    text-align: center;
    display: inline-block;
}

.contact a {
    color: var(--accent-color);
    text-decoration: none;
}

.contact a:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* Spinning icon animation */
.fa-spin-slow {
    --fa-animation-duration: 7s;
}

/* Section Styles */
.section {
    margin-bottom: 40px;
}

.section-title {
    font-size: 20px;
    color: var(--text-primary);
    margin-bottom: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompt {
    color: var(--prompt-color);
    font-weight: bold;
}

.section-content {
    padding-left: 30px;
}

/* Download CV Button */
.download-cv-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 20px;
    padding: 10px 20px;
    background-color: var(--prompt-color);
    color: var(--bg-color);
    text-decoration: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    border: 2px solid var(--prompt-color);
}

.download-cv-btn:hover {
    background-color: transparent;
    color: var(--prompt-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(126, 231, 135, 0.3);
}

.download-cv-btn i {
    font-size: 14px;
}

/* Experience & Education Items */
.experience-item,
.education-item,
.project-item {
    margin-bottom: 25px;
    padding: 20px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.item-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 8px;
    flex-wrap: wrap;
    gap: 10px;
}

.item-header h3 {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 600;
}

.date {
    color: var(--text-secondary);
    font-size: 13px;
}

.company {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 10px;
}

.details {
    list-style: none;
    padding-left: 0;
}

.details li {
    padding-left: 20px;
    position: relative;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.details li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--prompt-color);
}

.details-text {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Projects */
.project-link {
    color: var(--accent-color);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
}

.project-link:hover {
    color: var(--accent-hover);
}

.project-description {
    color: var(--text-secondary);
    font-size: 13px;
    margin-bottom: 12px;
}

.tech-stack {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    background-color: var(--bg-color);
    color: var(--accent-color);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
    border: 1px solid var(--border-color);
}

/* Skills Section */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.skill-category {
    background-color: var(--secondary-bg);
    padding: 15px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.skill-category h4 {
    color: var(--accent-color);
    font-size: 14px;
    margin-bottom: 12px;
    font-weight: 600;
}

.skill-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.skill {
    color: var(--text-secondary);
    font-size: 13px;
    padding-left: 15px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.skill::before {
    content: "•";
    position: absolute;
    left: 0;
    color: var(--prompt-color);
}

/* Star rating system */
.skill[data-rating]::after {
    content: "★★★★★";
    font-size: 20px;
    letter-spacing: 2px;
    background: linear-gradient(90deg, #efbf04 calc(var(--rating) * 20%), var(--text-secondary) calc(var(--rating) * 20%));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-left: 8px;
}

.skill[data-rating="1"] { --rating: 1; }
.skill[data-rating="2"] { --rating: 2; }
.skill[data-rating="3"] { --rating: 3; }
.skill[data-rating="4"] { --rating: 4; }
.skill[data-rating="5"] { --rating: 5; }

/* Languages Section */
.languages {
    display: grid;
    gap: 20px;
}

/* Simple language item (for native language) */
.language-item-simple {
    display: flex;
    justify-content: space-between;
    padding: 12px 20px;
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
}

.language-name {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
}

.language-level {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Detailed language breakdown */
.language-detailed {
    background-color: var(--secondary-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
}

.language-title {
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 15px;
}

.language-table {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}

.language-pair {
    display: grid;
    grid-template-rows: auto auto;
    gap: 10px;
}

.language-skill-header {
    color: var(--accent-color);
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border-color);
}

.language-skill-value {
    color: var(--text-secondary);
    font-size: 12px;
    padding: 8px 5px;
    background-color: var(--bg-color);
    border: 1px solid var(--border-color);
    border-radius: 4px;
    text-align: center;
}

/* Footer */
.footer {
    margin-top: 60px;
    padding-top: 30px;
    border-top: 1px solid var(--border-color);
    text-align: center;
    opacity: 0.3;
    color: gray;
    font-size: 13px;
}

.footer p {
    user-select: none;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    letter-spacing: 0.5px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    outline: none;
    -webkit-touch-callout: none;
}

/* Theme Switcher Button */
.theme-switcher {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--secondary-bg);
    border: 2px solid var(--border-color);
    color: var(--prompt-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
}

.theme-switcher:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background-color: var(--prompt-color);
    color: var(--bg-color);
}

.theme-switcher:active {
    transform: translateY(-1px);
}

/* Back to Top Button */
.back-to-top {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--secondary-bg);
    border: 2px solid var(--border-color);
    color: var(--prompt-color);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(100px);
}

.back-to-top.visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.back-to-top:hover {
    transform: translateY(-3px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    background-color: var(--prompt-color);
    color: var(--bg-color);
}

.back-to-top:active {
    transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 1080px) {
    /* Add extra bottom margin to footer to account for theme switcher button */
    .footer {
        margin-bottom: 70px;
    }
}

@media (max-width: 768px) {
    .profile-section {
        flex-direction: column;
        text-align: center;
        align-items: center;
    }

    .profile-image {
        width: 120px;
        height: 120px;
    }

    .name {
        font-size: 26px;
    }

    .contact {
        justify-content: center;
    }

    .section-content {
        padding-left: 15px;
    }

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

    .skills-grid {
        grid-template-columns: 1fr;
    }

    /* Make language table stack on mobile - show header + value pairs */
    .language-table {
        grid-template-columns: 1fr;
        gap: 6px;
    }

    .language-pair {
        display: grid;
        grid-template-columns: 1fr;
        gap: 0;
    }

    .language-skill-header {
        text-align: left;
        padding: 4px 10px;
        background-color: var(--bg-color);
        border: 1px solid var(--border-color);
        border-radius: 4px;
        border-bottom: none;
        border-bottom-left-radius: 0;
        border-bottom-right-radius: 0;
        padding-bottom: 4px;
    }

    .language-skill-value {
        text-align: left;
        border-top: none;
        border-top-left-radius: 0;
        border-top-right-radius: 0;
        margin-bottom: 6px;
    }

    /* Add extra bottom margin to footer to account for theme switcher button */
    .footer {
        margin-bottom: 70px;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 20px 15px;
    }

    .name {
        font-size: 22px;
    }

    .section-title {
        font-size: 18px;
    }

    /* Add extra bottom margin to footer to account for theme switcher button */
    .footer {
        margin-bottom: 70px;
    }
}
