@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@300;400;600;800&display=swap');

:root {
    --primary-color: #6c5ce7; 
    --secondary-color: #a29bfe; 
    --bg-gradient: linear-gradient(135deg, #f4f4f9 0%, #e0eafc 100%);
    --nav-bg: rgba(255, 255, 255, 0.7);
    --text-color: #2d3436; 
    --frame-bg: rgba(255, 255, 255, 0.9); 
    --font-family: 'Kanit', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-family); background: var(--bg-gradient);
    color: var(--text-color); line-height: 1.6;
    display: flex; flex-direction: column; min-height: 100vh;
}

.container { width: 100%; max-width: 1200px; margin: 0 auto; padding: 0 20px; }

/* HEADER */
.main-header {
    position: fixed; top: 0; left: 0; width: 100%;
    background: var(--nav-bg); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    z-index: 1000; padding: 15px 0; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
}
.nav-container { display: flex; justify-content: space-between; align-items: center; }
.logo { font-size: 1.5rem; font-weight: 800; color: var(--primary-color); text-decoration: none; }
.main-nav { flex: 1; display: flex; justify-content: center; }
.nav-links { list-style: none; display: flex; gap: 30px; }
.nav-links a { text-decoration: none; color: var(--text-color); font-weight: 600; transition: color 0.3s; }
.nav-links a:hover { color: var(--primary-color); }
.nav-actions { display: flex; align-items: center; }
.btn-admin {
    background: var(--primary-color); color: #fff !important;
    padding: 8px 20px; border-radius: 20px; font-size: 0.9rem; font-weight: 600;
    text-decoration: none; transition: all 0.3s; box-shadow: 0 4px 10px rgba(108, 92, 231, 0.2);
}
.btn-admin:hover { background: var(--secondary-color); transform: translateY(-2px); box-shadow: 0 6px 15px rgba(108, 92, 231, 0.4); }

/* MAIN & HERO */
main { flex: 1; display: flex; justify-content: center; align-items: center; padding-top: 80px; }
.hero-container { text-align: center; width: 100%; display: flex; flex-direction: column; align-items: center; padding: 40px 20px; }

.portrait-frame-wrapper {
    width: 100%; max-width: 320px; margin-bottom: 30px; position: relative;
    border-radius: 20px; box-shadow: 0 20px 40px rgba(108, 92, 231, 0.2);
    background: var(--frame-bg); overflow: hidden; border: 4px solid #fff;
}
.aspect-ratio-9-16 { position: relative; width: 100%; padding-top: 177.77%; }
.portrait-content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; color: var(--secondary-color); font-weight: bold; }
.portrait-content img { width: 100%; height: 100%; object-fit: cover; }

/* DYNAMIC FIELDS */
.dynamic-data-field { background-color: rgba(162, 155, 254, 0.2); border-radius: 4px; color: transparent; display: inline-block; }
.hero-name { font-size: 2.8rem; color: var(--primary-color); margin-bottom: 10px; font-weight: 800; }
.hero-title { font-size: 1.2rem; color: #636e72; }

/* INTERACTIVE COVER & TRIANGLE */
.interactive-cover { cursor: pointer; transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s ease; }
.interactive-cover:hover { transform: translateY(-15px) scale(1.02); box-shadow: 0 40px 80px rgba(108, 92, 231, 0.45); }
.triangle-hint-stack { position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); width: 70px; height: 60px; display: flex; justify-content: center; align-items: flex-end; transition: all 0.4s ease; z-index: 5; pointer-events: none; }
.interactive-cover:hover .triangle-hint-stack { transform: translateX(-50%) translateY(-8px) scale(1.05); }
.triangle-layer { position: absolute; border-style: solid; border-width: 0 35px 50px 35px; transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); filter: drop-shadow(0 6px 10px rgba(0,0,0,0.15)); }
.layer-1 { border-color: transparent transparent var(--primary-color) transparent; opacity: 0.9; background: rgba(255, 255, 255, 0.05); }
.layer-2 { border-width: 0 28px 40px 28px; border-color: transparent transparent var(--secondary-color) transparent; transform: translateY(6px); opacity: 0.7; }
.layer-3 { border-width: 0 22px 32px 22px; border-color: transparent transparent #fff transparent; transform: translateY(12px); opacity: 0.95; filter: drop-shadow(0 4px 10px rgba(255,255,255,0.6)); }
@keyframes trianglePulse { 0%, 100% { transform: translate(-50%, 0) scale(1); opacity: 0.95; } 50% { transform: translate(-50%, -10px) scale(1.02); opacity: 1; } }
.interactive-cover:not(:hover) .triangle-hint-stack { animation: trianglePulse 2.5s infinite ease-in-out; }

/* POP-UP MENU */
.menu-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(45, 52, 54, 0.6); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 2000; display: flex; justify-content: center; align-items: center; opacity: 0; visibility: hidden; transition: all 0.4s ease; }
.menu-overlay.active { opacity: 1; visibility: visible; }
.glass-panel { background: rgba(255, 255, 255, 0.85); padding: 40px; border-radius: 20px; box-shadow: 0 20px 50px rgba(0,0,0,0.2); border: 1px solid rgba(255,255,255,0.5); width: 90%; max-width: 400px; transform: translateY(50px) scale(0.9); transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); position: relative; }
.menu-overlay.active .glass-panel { transform: translateY(0) scale(1); }
.close-btn { position: absolute; top: 15px; right: 20px; background: none; border: none; font-size: 2rem; color: var(--text-color); cursor: pointer; transition: color 0.3s; }
.close-btn:hover { color: #d63031; }
.menu-title { color: var(--primary-color); margin-bottom: 25px; font-size: 1.8rem; text-align: center; }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.menu-item-btn { background: var(--bg-gradient); border: 1px solid rgba(108, 92, 231, 0.2); padding: 20px 10px; border-radius: 15px; font-family: var(--font-family); font-size: 1rem; font-weight: 600; color: var(--text-color); cursor: pointer; transition: all 0.3s ease; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.menu-item-btn .icon { font-size: 2rem; }
.menu-item-btn:hover { background: var(--primary-color); color: white; transform: translateY(-5px); box-shadow: 0 10px 20px rgba(108, 92, 231, 0.3); }

/* SECTION MODAL & CARD UI */
.section-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); backdrop-filter: blur(10px); z-index: 3000; display: none; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; }
.section-overlay.active { display: flex; opacity: 1; }
.section-container { width: 100%; max-width: 450px; height: 85vh; position: relative; padding: 0; }
#close-section-btn { position: absolute; top: -40px; right: 0; color: #fff; font-size: 2.5rem; background: none; border: none; cursor: pointer; }

.portfolio-swiper { width: 100%; height: 100%; padding-bottom: 40px; }
.item-card { background: #ffffff; border-radius: 25px; overflow: hidden; height: 100%; display: flex; flex-direction: column; box-shadow: 0 15px 35px rgba(0,0,0,0.2); }
.card-img-box { width: 100%; height: 45%; overflow: hidden; background: #f0f0f0; cursor: zoom-in; }
.card-img-box img { width: 100%; height: 100%; object-fit: cover; }
.card-info { padding: 25px; display: flex; flex-direction: column; gap: 15px; overflow-y: auto; flex: 1; text-align: left; }

.tag-container { display: flex; flex-wrap: wrap; gap: 10px; }
.pill-tag { padding: 6px 15px; border-radius: 20px; font-size: 0.85rem; font-weight: 600; color: #fff; }
.pill-tag:nth-child(odd) { background: #d96a89; }
.pill-tag:nth-child(even) { background: #f05c26; }

.card-info h3 { color: #2d3436; font-size: 1.8rem; font-weight: 800; line-height: 1.2; }
.card-info p { font-size: 0.95rem; color: #636e72; line-height: 1.6; }

.skills-header { font-size: 0.9rem; font-weight: 800; color: #555; margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.skills-list { display: flex; flex-direction: column; gap: 10px; margin-top: 5px; }
.skill-item { background: #e8faef; border: 1px solid #bceadd; color: #2d9d78; padding: 10px 15px; border-radius: 25px; font-size: 0.9rem; font-weight: 600; display: flex; align-items: center; gap: 10px; }

.swiper-pagination-bullet { background: #fff !important; opacity: 0.5; }
.swiper-pagination-bullet-active { opacity: 1; background: var(--primary-color) !important; }
.swiper-button-next, .swiper-button-prev { color: #fff !important; transform: scale(0.6); top: 50%; }
.swiper-button-next { right: -20px; }
.swiper-button-prev { left: -20px; }

/* LIGHTBOX */
.lightbox-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0, 0, 0, 0.95); z-index: 9999; display: none; justify-content: center; align-items: center; opacity: 0; transition: opacity 0.3s ease; padding: 20px; }
.lightbox-overlay.active { display: flex; opacity: 1; }
.lightbox-overlay img { max-width: 100%; max-height: 90vh; object-fit: contain; border-radius: 10px; box-shadow: 0 5px 25px rgba(0,0,0,0.5); transform: scale(0.95); transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
.lightbox-overlay.active img { transform: scale(1); }
.close-lightbox-btn { position: absolute; top: 20px; right: 30px; color: white; font-size: 3rem; background: none; border: none; cursor: pointer; z-index: 10000; transition: color 0.3s; }
.close-lightbox-btn:hover { color: var(--primary-color); }

/* FOOTER */
.main-footer { background-color: #ffffff; padding: 30px 0; text-align: center; box-shadow: 0 -4px 10px rgba(0,0,0,0.02); }
.footer-content p { color: var(--text-color); font-size: 0.9rem; font-weight: 500; }
.footer-credit { margin-top: 5px; color: var(--secondary-color); font-size: 0.8rem !important; }

/* RESPONSIVE */
@media (max-width: 768px) { .nav-links { display: none; } .hero-name { font-size: 2.2rem; } .nav-actions { margin-left: auto; } }

/* ADMIN DASHBOARD */
.admin-body { background: var(--bg-gradient); padding: 0; margin: 0; }
.admin-layout { display: flex; height: 100vh; padding: 20px; gap: 20px; max-width: 1400px; margin: 0 auto; }
.admin-sidebar { width: 250px; display: flex; flex-direction: column; padding: 30px 20px; }
.admin-sidebar h2 { color: var(--primary-color); margin-bottom: 30px; font-size: 1.5rem; }
.admin-nav { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.tab-btn { background: transparent; border: none; text-align: left; padding: 12px 15px; border-radius: 10px; font-family: var(--font-family); font-size: 1rem; font-weight: 600; color: var(--text-color); cursor: pointer; transition: all 0.3s; }
.tab-btn:hover { background: rgba(108, 92, 231, 0.1); }
.tab-btn.active { background: var(--primary-color); color: white; box-shadow: 0 4px 10px rgba(108, 92, 231, 0.3); }
.btn-back-home { text-decoration: none; color: var(--text-color); font-weight: 600; text-align: center; padding: 10px; border-radius: 10px; background: rgba(0,0,0,0.05); transition: all 0.3s; }
.btn-back-home:hover { background: rgba(0,0,0,0.1); }
.admin-content { flex: 1; padding: 40px; overflow-y: auto; }
.tab-pane { display: none; animation: fadeIn 0.4s ease; }
.tab-pane.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.tab-pane h3 { font-size: 2rem; color: var(--primary-color); margin-bottom: 20px; border-bottom: 2px solid rgba(108, 92, 231, 0.1); padding-bottom: 10px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--text-color); }
.form-group input[type="text"], .form-group textarea { width: 100%; padding: 12px 15px; border: 1px solid rgba(0,0,0,0.1); border-radius: 10px; font-family: var(--font-family); background: rgba(255,255,255,0.8); transition: all 0.3s; }
.form-group input:focus, .form-group textarea:focus { outline: none; border-color: var(--primary-color); box-shadow: 0 0 0 3px rgba(108, 92, 231, 0.2); }
.file-drop-area { position: relative; display: flex; align-items: center; justify-content: center; width: 100%; max-width: 400px; height: 150px; border: 2px dashed var(--primary-color); border-radius: 15px; background: rgba(108, 92, 231, 0.05); transition: all 0.3s; cursor: pointer; }
.file-drop-area:hover { background: rgba(108, 92, 231, 0.1); }
.file-msg { font-weight: 600; color: var(--primary-color); text-align: center; padding: 0 20px; pointer-events: none; }
.file-input { position: absolute; left: 0; top: 0; height: 100%; width: 100%; cursor: pointer; opacity: 0; }
.btn-save { background: var(--primary-color); color: #fff; border: none; padding: 12px 25px; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.3s; font-family: var(--font-family); }
.btn-save:hover { background: var(--secondary-color); transform: translateY(-2px); box-shadow: 0 4px 10px rgba(108, 92, 231, 0.3); }
.btn-save:disabled { background: #ccc; cursor: not-allowed; transform: none; box-shadow: none; }
@media (max-width: 768px) { .admin-layout { flex-direction: column; height: auto; } .admin-sidebar { width: 100%; } }