:root {
    /* 라이트 테마 변수 */
    --body-bg-gradient-start: #CCE3FF;
    --body-bg-gradient-mid: #D9F1FF;
    --body-bg-gradient-end: #EBF8FF;
    --main-frame-bg: rgba(255, 255, 255, 0.4);
    --main-frame-border: rgba(255, 255, 255, 0.5);
    --main-frame-shadow: rgba(0, 0, 0, 0.2);
    --title-bar-bg: rgba(255, 255, 255, 0.2);
    --title-bar-border: rgba(255, 255, 255, 0.3);
    --text-color: #2c2c2c;
    --glass-bg: rgba(255, 255, 255, 0.2);
    --glass-border: rgba(255, 255, 255, 0.3);
    --glass-shadow: rgba(0, 0, 0, 0.08);
    --header-img-border: rgba(255, 255, 255, 0.7);
    --header-img-shadow: rgba(0, 0, 0, 0.1);
    --section-border-bottom: rgba(0, 0, 0, 0.08);
    --project-item-border-bottom: rgba(0, 0, 0, 0.08);
    --button-glass-bg: rgba(255, 255, 255, 0.3);
    --button-glass-border: rgba(255, 255, 255, 0.4);
    --button-glass-shadow: rgba(0, 0, 0, 0.05);
    --button-glass-hover-bg: rgba(255, 255, 255, 0.4);
    --button-glass-hover-border: rgba(255, 255, 255, 0.5);
    --button-glass-hover-shadow: rgba(0, 0, 0, 0.1);
    --footer-text-color: rgba(255, 255, 255, 0.8);
    --footer-glass-bg: rgba(255, 255, 255, 0.3);
    --footer-glass-border: rgba(255, 255, 255, 0.4);
    --footer-glass-shadow: rgba(0, 0, 0, 0.05);
    --popup-overlay-bg: rgba(0, 0, 0, 0.4);
    --popup-container-bg-start: #CCE3FF;
    --popup-container-bg-end: #EBF8FF;
    --popup-container-border: rgba(255, 255, 255, 0.8);
    --popup-container-shadow: rgba(0, 0, 0, 0.2);
    --link-color: #007aff;
    --traffic-light-hover-color: #000;
}

body.dark-theme {
    /* 다크 테마 변수 */
    --body-bg-gradient-start: #1a1a2e;
    --body-bg-gradient-mid: #16213e;
    --body-bg-gradient-end: #0f3460;
    --main-frame-bg: rgba(0, 0, 0, 0.6);
    --main-frame-border: rgba(255, 255, 255, 0.1);
    --main-frame-shadow: rgba(0, 0, 0, 0.5);
    --title-bar-bg: rgba(0, 0, 0, 0.3);
    --title-bar-border: rgba(255, 255, 255, 0.05);
    --text-color: #e0e0e0; /* 밝은 회색 텍스트 */
    --glass-bg: rgba(0, 0, 0, 0.4);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: rgba(0, 0, 0, 0.3);
    --header-img-border: rgba(255, 255, 255, 0.3);
    --header-img-shadow: rgba(0, 0, 0, 0.4);
    --section-border-bottom: rgba(255, 255, 255, 0.1);
    --project-item-border-bottom: rgba(255, 255, 255, 0.08);
    --button-glass-bg: rgba(0, 0, 0, 0.5);
    --button-glass-border: rgba(255, 255, 255, 0.2);
    --button-glass-shadow: rgba(0, 0, 0, 0.3);
    --button-glass-hover-bg: rgba(0, 0, 0, 0.6);
    --button-glass-hover-border: rgba(255, 255, 255, 0.3);
    --button-glass-hover-shadow: rgba(0, 0, 0, 0.4);
    --footer-text-color: rgba(255, 255, 255, 0.6);
    --footer-glass-bg: rgba(0, 0, 0, 0.5);
    --footer-glass-border: rgba(255, 255, 255, 0.2);
    --footer-glass-shadow: rgba(0, 0, 0, 0.2);
    --popup-overlay-bg: rgba(0, 0, 0, 0.7);
    --popup-container-bg-start: #303030; /* 팝업 배경도 다크하게 */
    --popup-container-bg-end: #404040;
    --popup-container-border: rgba(255, 255, 255, 0.3);
    --popup-container-shadow: rgba(0, 0, 0, 0.5);
    --link-color: #8cafff; /* 링크 색상 조정 */
    --traffic-light-hover-color: #fff;
}


body {
    font-family: 'Pretendard', sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(-45deg, var(--body-bg-gradient-start), var(--body-bg-gradient-mid), var(--body-bg-gradient-end));
    background-size: 400% 400%;
    animation: gradient-animation 15s ease infinite;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: var(--text-color);
    text-align: center;
    transition: background-color 0.5s ease, color 0.5s ease; /* 테마 전환 시 부드러운 효과 */
}

@keyframes gradient-animation {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

.main-window-frame {
    background: var(--main-frame-bg);
    backdrop-filter: blur(20px);
    border: 1px solid var(--main-frame-border);
    border-radius: 20px;
    box-shadow: 0 12px 40px var(--main-frame-shadow);
    width: 90%;
    max-width: 600px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: 20px auto;
    transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.window-title-bar-main {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--title-bar-border);
    background: var(--title-bar-bg);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

.window-title-bar-popup {
    padding: 10px 15px;
    display: flex;
    align-items: center;
    gap: 8px;
    border-bottom: 1px solid var(--title-bar-border);
    background: var(--title-bar-bg);
    border-top-left-radius: 15px;
    border-top-right-radius: 15px;
    transition: background-color 0.5s ease, border-color 0.5s ease;
}

.traffic-light-button {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: default;
    transition: background-color 0.1s ease-in-out;
    font-size: 7px;
    line-height: 1;
    color: transparent;
}

.traffic-light-button:hover {
    color: var(--traffic-light-hover-color);
}

.close-button,
.close-popup-button {
    background-color: #ff5f56;
}

.minimize-button {
    background-color: #ffbd2e;
}

.maximize-button {
    background-color: #27c93f;
}

.close-button:hover::before,
.close-popup-button:hover::before {
    content: 'x';
    font-weight: bold;
}

.minimize-button:hover::before {
    content: '-';
    font-weight: bold;
}

.maximize-button:hover::before {
    content: '+';
    font-weight: bold;
}

/* 테마 전환 버튼 */
.theme-toggle-button {
    margin-left: auto; /* 우측 정렬 */
    cursor: pointer;
    font-size: 1.2rem; /* 아이콘 크기 */
    padding: 2px 5px;
    border-radius: 5px;
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    transition: background-color 0.3s ease, border-color 0.3s ease;
}

.theme-toggle-button:hover {
    background: rgba(255, 255, 255, 0.4);
    border-color: rgba(255, 255, 255, 0.5);
}

body.dark-theme .theme-toggle-button {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-theme .theme-toggle-button:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(255, 255, 255, 0.2);
}


.container {
    width: auto;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-sizing: border-box;
}

.glass-effect {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 15px;
    box-shadow: 0 6px 20px var(--glass-shadow);
    padding: 25px 30px;
    text-align: left;
    transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding-top: 30px;
    padding-bottom: 25px;
}

.header img {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 12px;
    border: 3px solid var(--header-img-border);
    box-shadow: 0 4px 10px var(--header-img-shadow);
    transition: border-color 0.5s ease, box-shadow 0.5s ease;
}

.header h1 {
    font-size: 2.2rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--text-color);
    transition: color 0.5s ease;
}

.header .glass-button {
    margin-top: 12px;
}

.section h2 {
    font-size: 1.6rem;
    font-weight: 600;
    margin-top: 0;
    margin-bottom: 18px;
    color: var(--text-color);
    border-bottom: 2px solid var(--section-border-bottom);
    padding-bottom: 10px;
    text-align: left;
    transition: color 0.5s ease, border-color 0.5s ease;
}

.section p {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 18px;
    color: var(--text-color);
    text-align: left;
    transition: color 0.5s ease;
}

.section.projects .project-item {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--text-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed var(--project-item-border-bottom);
    transition: color 0.5s ease, border-color 0.5s ease;
}

.section.projects .project-item:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

.see-more-button {
    font-size: 0.85rem;
    padding: 7px 12px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
}

.glass-button {
    display: inline-block;
    padding: 9px 18px;
    background: var(--button-glass-bg);
    border: 1px solid var(--button-glass-border);
    border-radius: 15px;
    color: var(--text-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease-in-out, background-color 0.5s ease, border-color 0.5s ease, color 0.5s ease;
    box-shadow: 0 4px 10px var(--button-glass-shadow);
}

.glass-button:hover {
    background: var(--button-glass-hover-bg);
    border-color: var(--button-glass-hover-border);
    box-shadow: 0 6px 15px var(--button-glass-hover-shadow);
    transform: translateY(-2px);
}

.footer {
    width: 100%;
    text-align: center;
    padding: 18px;
    color: var(--footer-text-color);
    font-size: 0.9rem;
    margin-top: 25px;
    box-sizing: border-box;
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
    transition: color 0.5s ease;
}

.footer.glass-effect {
    background: var(--footer-glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--footer-glass-border);
    border-radius: 0 0 20px 20px;
    box-shadow: 0 -4px 15px var(--footer-glass-shadow);
    padding-bottom: 25px;
    padding-top: 20px;
    transition: background-color 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--popup-overlay-bg);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: background-color 0.5s ease;
}

.popup-container {
    background: linear-gradient(135deg, var(--popup-container-bg-start), var(--popup-container-bg-end));
    backdrop-filter: blur(20px);
    border: 1px solid var(--popup-container-border);
    border-radius: 15px;
    box-shadow: 0 10px 30px var(--popup-container-shadow);
    width: 90%;
    max-width: 450px;
    overflow: hidden;
    transition: background 0.5s ease, border-color 0.5s ease, box-shadow 0.5s ease;
}

.popup-content {
    background: transparent;
    backdrop-filter: none;
    border: none;
    box-shadow: none;
    padding: 25px;
    border-radius: 0 0 15px 15px;
}

.popup-body h4 {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 8px;
    color: var(--text-color);
    transition: color 0.5s ease;
}

.popup-body p {
    font-size: 0.95rem;
    line-height: 1.5;
    margin-bottom: 12px;
    color: var(--text-color);
    transition: color 0.5s ease;
}

.popup-body ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popup-body ul li {
    margin-bottom: 6px;
    font-size: 0.95rem;
}

.popup-body ul li a {
    color: var(--link-color);
    text-decoration: none;
    font-weight: 500;
    transition: text-decoration 0.2s ease-in-out, color 0.5s ease;
}

.popup-body ul li a:hover {
    text-decoration: underline;
}

@media (max-width: 768px) {
    .main-window-frame {
        width: 95%;
        margin: 10px auto;
    }

    .window-title-bar-main,
    .window-title-bar-popup {
        padding: 8px 10px;
    }

    .traffic-light-button {
        width: 8px;
        height: 8px;
        font-size: 6px;
    }

    .container {
        padding: 20px;
        gap: 15px;
    }

    .glass-effect {
        padding: 20px 18px;
    }

    .header img {
        width: 80px;
        height: 80px;
    }

    .header h1 {
        font-size: 1.8rem;
    }

    .section h2 {
        font-size: 1.4rem;
        margin-bottom: 15px;
    }

    .section p {
        font-size: 0.9rem;
        margin-bottom: 15px;
    }

    .section.projects .project-item {
        font-size: 0.85rem;
        margin-bottom: 8px;
        padding: 6px 0;
    }

    .see-more-button {
        font-size: 0.8rem;
        padding: 6px 10px;
    }

    .glass-button {
        padding: 8px 15px;
    }

    .footer {
        padding: 15px;
        font-size: 0.85rem;
        margin-top: 20px;
    }

    .footer.glass-effect {
        padding-bottom: 20px;
    }

    .popup-container {
        max-width: 95%;
    }

    .popup-content {
        padding: 20px;
    }

    .popup-body h4 {
        font-size: 1rem;
    }

    .popup-body p,
    .popup-body ul li {
        font-size: 0.9rem;
    }
}