/* --- General Setup & Animated Background --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Noto Sans Khmer', sans-serif;
    color: #ffffff;
    background: linear-gradient(-45deg, #0f0c29, #302b63, #24243e, #1a2a6c);
    background-size: 400% 400%;
    animation: gradientBG 20s ease infinite;
    min-height: 100vh;
    padding: 2rem 1rem;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-direction: column;
}

@keyframes gradientBG {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* --- Main Container --- */
.linktree-container {
    width: 100%;
    max-width: 680px;
    text-align: center;
}

/* --- Entrance Animation --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(15px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-50px) scale(0.9); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* --- Profile Section --- */
.profile-section {
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
    margin-bottom: 1.5rem;
}

.profile-picture {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
    margin-bottom: 1rem;
    transition: transform 0.3s ease;
}

.profile-picture:hover {
    transform: scale(1.1) rotate(5deg);
}

.profile-title {
    font-family: 'Moul', sans-serif;
    font-size: clamp(1.5rem, 5vw, 2.2rem);
    color: #fff;
    text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.5);
}

.profile-subtitle {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 0.5rem;
}

/* --- Datetime Widget --- */
#datetime-section {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 1rem;
    margin-top: 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.2s forwards;
}

.datetime-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1rem;
    font-weight: bold;
    color: #fff;
}

.datetime-item i {
    color: #00e5ff;
}

/* --- Video Section & Download Button --- */
.video-wrapper {
    margin-top: 2rem;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 0.4s forwards;
}

.video-section {
    position: relative; 
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.video-section video {
    width: 100%;
    display: block;
}

.download-section {
    position: absolute;
    top: 15px;
    right: 15px;
    z-index: 10;
}

.download-btn {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(45deg, #00c6ff, #0072ff);
    backdrop-filter: blur(5px);
    color: #fff;
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    text-decoration: none;
    font-weight: bold;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 198, 255, 0.4);
}

.download-btn:hover, .download-btn:focus {
    transform: scale(1.05);
    background: linear-gradient(45deg, #00b5e9, #0065e2);
    box-shadow: 0 6px 20px rgba(0, 198, 255, 0.5);
}

.download-btn i {
    margin-right: 0.5rem;
}

@media (max-width: 480px) {
    .download-btn span { display: none; }
    .download-btn { padding: 0.6rem; width: 40px; height: 40px; justify-content: center; }
    .download-btn i { margin-right: 0; font-size: 1rem; }
}


/* --- Links Section --- */
.links-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
}

.link-item {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    padding: 1.1rem;
    border-radius: 12px;
    text-decoration: none;
    font-weight: 700;
    font-size: 1.1rem;
    color: #fff;
    transition: all 0.2s ease-out;
    opacity: 0;
    animation: fadeIn 0.5s ease-out forwards;
    border: none;
    position: relative;
    overflow: hidden;
}

.link-item i {
    transition: transform 0.3s ease;
    width: 24px; 
    text-align: center;
}

.link-item:hover, .link-item:focus {
    transform: translateY(-5px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.3);
}

.link-item:hover i {
    transform: scale(1.2) rotate(-5deg);
}

.link-item:active {
    transform: translateY(0) scale(0.98);
}

/* Staggered animation for links */
.link-item:nth-child(1) { animation-delay: 0.6s; }
.link-item:nth-child(2) { animation-delay: 0.7s; }
.link-item:nth-child(3) { animation-delay: 0.8s; }
.link-item:nth-child(4) { animation-delay: 0.9s; }
.link-item:nth-child(5) { animation-delay: 1.0s; }
.link-item:nth-child(6) { animation-delay: 1.1s; }
.link-item:nth-child(7) { animation-delay: 1.2s; }
.link-item:nth-child(8) { animation-delay: 1.3s; }
.link-item:nth-child(9) { animation-delay: 1.4s; }
.link-item:nth-child(10) { animation-delay: 1.5s; }


/* Link Colors */
.link-item.website { background: linear-gradient(45deg, #6c757d, #343a40); box-shadow: 0 4px 15px rgba(108, 117, 125, 0.4); }
.link-item.facebook { background: linear-gradient(45deg, #1877F2, #1256ac); box-shadow: 0 4px 15px rgba(24, 119, 242, 0.4); }
.link-item.messenger { background: linear-gradient(45deg, #00B2FF, #006AFF); box-shadow: 0 4px 15px rgba(0, 178, 255, 0.4); }
.link-item.telegram { background: linear-gradient(45deg, #26A5E4, #1c82b5); box-shadow: 0 4px 15px rgba(38, 165, 228, 0.4); }
.link-item.youtube { background: linear-gradient(45deg, #FF0000, #c40000); box-shadow: 0 4px 15px rgba(255, 0, 0, 0.4); }
.link-item.file { background: linear-gradient(45deg, #0d6efd, #0a58ca); box-shadow: 0 4px 15px rgba(13, 110, 253, 0.4); }
.link-item.location { background: linear-gradient(45deg, #198754, #146c43); box-shadow: 0 4px 15px rgba(25, 135, 84, 0.4); }
.link-item.feedback { background: linear-gradient(45deg, #6f42c1, #59359a); box-shadow: 0 4px 15px rgba(111, 66, 193, 0.4); }

/* --- Ticker & Footer --- */
.ticker-wrap, .footer-section {
    margin-top: 2rem;
}
.ticker-wrap { animation: fadeIn 0.5s ease-out 1.6s forwards; }
.footer-section { animation: fadeIn 0.5s ease-out 1.7s forwards; }

.ticker-wrap { width: 100%; overflow: hidden; background-color: rgba(0, 0, 0, 0.3); border-radius: 8px; padding: 0.8rem 0; border: 1px solid rgba(255, 255, 255, 0.1); }
.ticker-text { 
    display: inline-block; 
    padding-left: 100%; 
    white-space: nowrap; 
    animation: ticker-scroll 150s linear infinite; 
    font-size: 0.9rem; 
    color: rgba(255, 255, 255, 0.85); 
}
@keyframes ticker-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* --- Share Section & Modal --- */
.share-section {
    opacity: 0;
    animation: fadeIn 0.5s ease-out 1.5s forwards;
    margin-top: 2rem;
    position: relative;
}

#openShareModalBtn {
    font-family: 'Noto Sans Khmer', sans-serif;
    background: #17a2b8;
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.8rem 1.5rem;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(23, 162, 184, 0.4);
}

#openShareModalBtn:hover, #openShareModalBtn:focus {
    background: #138496;
    transform: scale(1.05);
}

#openShareModalBtn i {
    margin-right: 0.5rem;
}

.modal { display: none; position: fixed; z-index: 1000; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgba(0,0,0,0.6); justify-content: center; align-items: center; }
.modal-content { background-color: #2c2c3e; padding: 2rem; border: 1px solid rgba(255, 255, 255, 0.2); width: 90%; max-width: 500px; border-radius: 15px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); position: relative; animation: modalFadeIn 0.5s ease-out; }
.close-button { color: #aaa; position: absolute; top: 1rem; right: 1rem; font-size: 28px; font-weight: bold; cursor: pointer; transition: color 0.3s; }
.close-button:hover, .close-button:focus { color: #fff; }
.share-title { font-weight: bold; font-size: 1.5rem; margin-bottom: 1.5rem; text-align: center; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 1rem; position: relative; }
.share-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.5rem; padding: 1rem; border-radius: 10px; border: none; color: #fff; text-decoration: none; transition: all 0.3s ease; cursor: pointer; background: rgba(255, 255, 255, 0.1); }
.share-link:hover { transform: translateY(-5px); background: rgba(255, 255, 255, 0.2); }
.share-link i { font-size: 2rem; }
.share-link span { font-size: 0.9rem; font-weight: bold; }
.share-link.facebook { color: #1877F2; } .share-link.telegram { color: #26A5E4; } .share-link.whatsapp { color: #25D366; } .share-link.messenger { color: #00B2FF; } .share-link.twitter { color: #1DA1F2; } .share-link.copy-link { color: #f8f9fa; }
.tooltip { position: absolute; bottom: -50px; left: 50%; transform: translateX(-50%); background-color: #28a745; color: #fff; padding: 0.5rem 1rem; border-radius: 5px; opacity: 0; visibility: hidden; transition: opacity 0.3s, visibility 0.3s; white-space: nowrap; z-index: 1010; }
.tooltip.show { opacity: 1; visibility: visible; }

/* --- Footer Section --- */
.footer-section { padding-top: 1.5rem; width: 100%; border-top: 1px solid rgba(255, 255, 255, 0.2); color: rgba(255, 255, 255, 0.8); }
.contact-numbers { margin-bottom: 1.5rem; line-height: 1.8; font-size: 0.9rem; }
.contact-numbers strong { color: #fff; }
.contact-numbers a { color: #ffffff; text-decoration: none; transition: opacity 0.3s; }
.contact-numbers a:hover, .contact-numbers a:focus { opacity: 0.8; text-decoration: underline; }
.footer-section .credit { text-align: center; }
.footer-section .credit p { margin: 0.5rem 0; }
.footer-section .credit a { font-weight: bold; text-decoration: none; position: relative; padding: 5px 0; background: linear-gradient(45deg, #FFD700, #FFA500); -webkit-background-clip: text; background-clip: text; color: transparent; }
.footer-section .credit a::after { content: ''; position: absolute; width: 100%; transform: scaleX(0); height: 2px; bottom: 0; left: 0; background: linear-gradient(45deg, #FFD700, #FFA500); transform-origin: bottom right; transition: transform 0.3s ease-out; }
.footer-section .credit a:hover::after, .footer-section .credit a:focus::after { transform: scaleX(1); transform-origin: bottom left; }

/* --- Back to Top Button --- */
#backToTopBtn { display: none; position: fixed; bottom: 20px; right: 20px; z-index: 99; border: none; outline: none; background-color: rgba(0, 229, 255, 0.8); color: white; cursor: pointer; padding: 10px; border-radius: 50%; width: 45px; height: 45px; font-size: 18px; transition: all 0.3s; box-shadow: 0 4px 15px rgba(0, 229, 255, 0.4); }
#backToTopBtn:hover, #backToTopBtn:focus { background-color: rgba(0, 229, 255, 1); transform: scale(1.1); }

