/* กำหนดตัวแปรสี */
:root {
    --bg-color: #000; /* สีพื้นหลังโหมดมืด */
    --text-color: #fff; /* สีตัวหนังสือโหมดมืด */
    --icon-color: #fff; /* สีไอคอนโหมดมืด */
    
    /* ตัวแปรสำหรับปุ่มในโหมดมืด */
    --button-bg-dark: #111;
    --button-text-dark: #ffffff;
    --button-border-dark: linear-gradient(
        45deg,
        #ff0000,
        #ff7300,
        #fffb00,
        #48ff00,
        #00ffd5,
        #002bff,
        #7a00ff,
        #ff00c8,
        #ff0000
    );
    --button-bg-hover-dark: #e0e0e0;
    
    /* ตัวแปรสำหรับปุ่มในโหมดสว่าง */
    --button-bg-light: #ffffff;
    --button-text-light: #000000;
    --button-border-light: linear-gradient(
        45deg,
        #ff0000,
        #ff7300,
        #fffb00,
        #48ff00,
        #00ffd5,
        #002bff,
        #7a00ff,
        #ff00c8,
        #ff0000
    );
    --button-bg-hover-light: #f0f0f0;
}

/* สไตล์สำหรับโหมดธีมต่าง ๆ */
body {
    margin: 0;
    padding: 0;
    font-family: 'Arial', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    text-align: center;
    overflow: hidden;
}

.container {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.profile-image {
    width: 150px;
    height: 150px;
    margin-bottom: 20px;
}

.profile-image img {
    width: 100%;
    height: 100%;
    border-radius: 50%; /* ทำให้รูปเป็นวงกลม */
    object-fit: cover; /* ปรับให้รูปพอดีกับขนาด */
}

.title {
    font-size: 3rem;
    margin: 0;
}

.username {
    font-size: 1.2rem;
    color: #9e9e9e;
    margin: 10px 0;
}

.social-icons {
    margin-top: 20px;
}

.social-icons a {
    margin: 0 10px;
    text-decoration: none;
    color: var(--icon-color);
    font-size: 2rem;
    transition: transform 0.3s ease-in-out, color 0.3s ease-in-out;
}

.social-icons a:hover {
    transform: scale(1.2);
}

.footer-text {
    margin-top: 20px;
    font-size: 1rem;
    color: #9e9e9e;
    opacity: 0;
    transition: opacity 1s ease-in-out;
}

.footer-text.visible {
    opacity: 1;
}

.spacer {
    margin-top: 10px;
}

.typing-text {
    font-size: 1.5rem;
    color: #9e9e9e;
    margin-top: 20px;
}

/* Toggle Switch */
.theme-switcher {
    position: absolute;
    top: 20px;
    right: 20px;
}

.theme-switcher input {
    display: none;
}

.theme-switcher label {
    display: inline-block;
    width: 60px;
    height: 34px;
    background-color: #ccc;
    border-radius: 34px;
    position: relative;
    cursor: pointer;
}

.theme-switcher label:before {
    content: "";
    position: absolute;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background-color: white;
    top: 4px;
    left: 4px;
    transition: 0.3s;
}

.theme-switcher input:checked + label {
    background-color: #666;
}

.theme-switcher input:checked + label:before {
    transform: translateX(26px);
}

/* Light Mode Theme */
body.light-mode {
    --bg-color: #fff; /* สีพื้นหลังโหมดสว่าง */
    --text-color: #000; /* สีตัวหนังสือโหมดสว่าง */
    --icon-color: #000; /* สีไอคอนโหมดสว่าง */
    
    /* ตัวแปรสำหรับปุ่มในโหมดสว่าง */
    --button-bg-dark: #333333;
    --button-text-dark: #f0f0f0;
    --button-border-dark: linear-gradient(
        45deg,
        #ff0000,
        #ff7300,
        #fffb00,
        #48ff00,
        #00ffd5,
        #002bff,
        #7a00ff,
        #ff00c8,
        #ff0000
    );
    --button-bg-hover-dark: #e0e0e0;
    
    --button-bg-light: #ffffff;
    --button-text-light: #000000;
    --button-border-light: linear-gradient(
        45deg,
        #ff0000,
        #ff7300,
        #fffb00,
        #48ff00,
        #00ffd5,
        #002bff,
        #7a00ff,
        #ff00c8,
        #ff0000
    );
    --button-bg-hover-light: #f0f0f0;
}

/* สไตล์สำหรับปุ่ม .button-85 */
.button-85 {
    padding: 0.6em 2em;
    border: none;
    outline: none;
    color: var(--button-text-dark); /* สีตัวหนังสือตามธีม */
    background: var(--button-bg-dark); /* สีพื้นหลังตามธีม */
    cursor: pointer;
    position: fixed; /* ตำแหน่งแบบคงที่ */
    top: 20px; /* ระยะห่างจากด้านบน */
    left: 20px; /* ระยะห่างจากด้านซ้าย */
    z-index: 1000; /* ให้ปุ่มอยู่เหนือองค์ประกอบอื่น */
    border-radius: 10px;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    transition: background-color 0.3s, color 0.3s, transform 0.3s;
    animation: glowing-button-85 20s linear infinite; /* การเคลื่อนไหวของขอบสีสายรุ้ง */
}

/* ปรับสีปุ่มในโหมดสว่าง */
body.light-mode .button-85 {
    color: var(--button-text-light); /* สีตัวหนังสือในโหมดสว่าง */
    background: var(--button-bg-light); /* สีพื้นหลังในโหมดสว่าง */
}

/* การเคลื่อนไหวและขอบสีสายรุ้ง */
.button-85:before {
    content: "";
    background: var(--button-border-dark); /* ขอบสีสายรุ้งตามธีม */
    position: absolute;
    top: -2px;
    left: -2px;
    background-size: 400%;
    z-index: -1;
    filter: blur(5px);
    -webkit-filter: blur(5px);
    width: calc(100% + 4px);
    height: calc(100% + 4px);
    animation: glowing-button-85 20s linear infinite;
    transition: opacity 0.3s ease-in-out;
    border-radius: 10px;
}

@keyframes glowing-button-85 {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

.button-85:after {
    z-index: -1;
    content: "";
    position: absolute;
    width: 100%;
    height: 100%;
    background: var(--button-bg-dark); /* สีพื้นหลังในโหมดมืด */
    left: 0;
    top: 0;
    border-radius: 10px;
}

body.light-mode .button-85:after {
    background: var(--button-bg-light); /* สีพื้นหลังในโหมดสว่าง */
}

/* การโฮเวอร์ปุ่ม */
.button-85:hover {
    background-color: var(--button-bg-hover-dark); /* สีพื้นหลังเมื่อโฮเวอร์ในโหมดมืด */
    transform: scale(1.05);
}

/* ปรับสีโฮเวอร์ในโหมดสว่าง */
body.light-mode .button-85:hover {
    background-color: var(--button-bg-hover-light); /* สีพื้นหลังเมื่อโฮเวอร์ในโหมดสว่าง */
}
