:root {
    /* Identitas Sosial.link */
    --primary: #ff2e88;
    --primary-hover: #e01c70;
    --font: 'Inter', sans-serif;
    
    /* Light Mode Variables */
    --bg-color: #f3f4f6;
    --bg-gradient: radial-gradient(circle at top right, rgba(255, 46, 136, 0.05), transparent 40%), radial-gradient(circle at bottom left, rgba(46, 136, 255, 0.05), transparent 40%);
    --text-color: #111827;
    --text-muted: #6b7280;
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(255, 255, 255, 0.5);
    --card-bg: #ffffff;
    --border-color: #e5e7eb;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-color: #0f172a; /* Warna dasar sedikit navy bukan hitam murni */
        /* Mesh background lembut untuk mode gelap */
        --bg-gradient: radial-gradient(circle at top right, rgba(255, 46, 136, 0.15), transparent 50%), radial-gradient(circle at bottom left, rgba(124, 58, 237, 0.15), transparent 50%);
        --text-color: #f8fafc;
        --text-muted: #94a3b8;
        --glass-bg: rgba(30, 41, 59, 0.7);
        --glass-border: rgba(255, 255, 255, 0.1);
        --card-bg: #1e293b;
        --border-color: #334155;
    }
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--font); }

body { 
    background-color: var(--bg-color); 
    background-image: var(--bg-gradient);
    background-attachment: fixed; /* Agar background tetap saat scroll */
    color: var(--text-color); 
    overflow-x: hidden; 
    min-height: 100vh; 
    transition: background 0.3s, color 0.3s; 
}

/* Utilities */
.view { display: none; opacity: 0; transition: opacity 0.3s ease; min-height: 100vh; }
.view.active { display: block; opacity: 1; }
.glass { background: var(--glass-bg); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border: 1px solid var(--glass-border); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--primary); color: #fff; border: none; padding: 12px 24px; border-radius: 99px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: transform 0.2s, background 0.2s, box-shadow 0.2s; box-shadow: 0 4px 14px rgba(255, 46, 136, 0.3); }
.btn:hover { background: var(--primary-hover); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255, 46, 136, 0.4); }
.btn:active { transform: translateY(0); }
.btn-large { padding: 16px 32px; font-size: 1.1rem; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 2px solid var(--border-color); color: var(--text-color); box-shadow: none; }
.btn-outline:hover { background: var(--border-color); box-shadow: none; }
.btn-danger { background: #ef4444; box-shadow: none; padding: 8px; border-radius: 8px; }
.btn-danger:hover { background: #dc2626; }

/* Ripple Effect */
.ripple { position: relative; overflow: hidden; }
.ripple::after { content: ""; display: block; position: absolute; width: 100%; height: 100%; top: 0; left: 0; pointer-events: none; background-image: radial-gradient(circle, #fff 10%, transparent 10.01%); background-repeat: no-repeat; background-position: 50%; transform: scale(10, 10); opacity: 0; transition: transform .5s, opacity 1s; }
.ripple:active::after { transform: scale(0, 0); opacity: .3; transition: 0s; }

/* Form Elements */
input, textarea { width: 100%; padding: 12px 16px; border: 1px solid var(--border-color); border-radius: 12px; background: var(--card-bg); color: var(--text-color); font-size: 1rem; outline: none; transition: border-color 0.2s; }
input:focus, textarea:focus { border-color: var(--primary); }
textarea { resize: vertical; min-height: 80px; }

/* Loading Screen */
#global-loader { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; opacity: 0; pointer-events: none; transition: opacity 0.3s; }
#global-loader.active { opacity: 1; pointer-events: auto; }
.spinner { width: 40px; height: 40px; border: 4px solid var(--glass-border); border-top-color: var(--primary); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Navbar */
.navbar { position: fixed; top: 0; left: 0; right: 0; display: flex; justify-content: space-between; align-items: center; padding: 16px 5%; z-index: 100; border-bottom: 1px solid var(--border-color); }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 1.25rem; letter-spacing: -0.5px; }

/* Landing Hero */
.hero { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 0 5%; }
.hero-content { text-align: center; max-width: 600px; animation: slideUp 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.hero h1 { font-size: clamp(3rem, 8vw, 4.5rem); font-weight: 800; line-height: 1.1; margin-bottom: 24px; letter-spacing: -2px; }
.hero p { font-size: 1.2rem; color: var(--text-muted); margin-bottom: 32px; }
@keyframes slideUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }

/* Dashboard Layout */
.dashboard-layout { display: flex; gap: 32px; max-width: 1200px; margin: 0 auto; padding: 100px 5% 40px; min-height: 100vh; }
.dashboard-editor { flex: 1; max-width: 700px; display: flex; flex-direction: column; gap: 24px; }
.dashboard-preview { width: 340px; display: none; }
@media (min-width: 1024px) { .dashboard-preview { display: block; position: sticky; top: 100px; height: calc(100vh - 120px); } }

/* Profile Card & Avatar Upload */
.profile-card { padding: 24px; border-radius: 24px; display: flex; flex-direction: column; gap: 16px; }
.profile-header { display: flex; gap: 16px; align-items: center; }
.avatar-wrapper { position: relative; width: 80px; height: 80px; border-radius: 50%; cursor: pointer; display: inline-block; flex-shrink: 0; }
.avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 2px solid var(--border-color); display: block; }
.avatar-overlay { position: absolute; inset: 0; background: rgba(0,0,0,0.4); border-radius: 50%; display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity 0.2s ease; }
.avatar-wrapper:hover .avatar-overlay { opacity: 1; }
.profile-info { flex: 1; }

/* Input Baru untuk Nama Tampilan */
.input-display-name { 
    font-size: 1.3rem; 
    font-weight: 800; 
    margin-bottom: 8px; 
    background: transparent; 
    border: 1px solid transparent; 
    padding: 4px 8px; 
    border-radius: 8px; 
    transition: all 0.2s; 
    width: 100%;
}
.input-display-name:focus, .input-display-name:hover { 
    border-color: var(--border-color); 
    background: var(--card-bg); 
}

.input-group { display: flex; align-items: center; background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; padding-left: 12px; }
.input-group span { color: var(--text-muted); font-size: 0.9rem; }
.input-group input { border: none; border-radius: 0; background: transparent; padding: 10px 12px; }
.profile-actions { display: flex; gap: 12px; margin-top: 8px; }

/* Link Manager Items */
.sortable-list { display: flex; flex-direction: column; gap: 16px; margin-top: 16px; }
.link-item { background: var(--card-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 16px; display: flex; gap: 12px; align-items: center; transition: box-shadow 0.2s, transform 0.2s; }
.link-item.dragging { opacity: 0.5; background: var(--bg-color); border: 2px dashed var(--primary); }
.drag-handle { cursor: grab; color: var(--text-muted); padding: 8px; }
.drag-handle:active { cursor: grabbing; }
.link-content { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.link-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toggle { position: relative; width: 44px; height: 24px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--text-muted); transition: .4s; border-radius: 24px; }
.toggle-slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
.toggle input:checked + .toggle-slider { background-color: var(--primary); }
.toggle input:checked + .toggle-slider:before { transform: translateX(20px); }

/* Phone Mockup Preview */
.phone-mockup { width: 100%; height: 100%; border: 12px solid #0f172a; border-radius: 40px; overflow: hidden; box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25); position: relative; }
.phone-mockup::before { content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 120px; height: 24px; background: #0f172a; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; z-index: 2; }
.phone-mockup iframe { width: 100%; height: 100%; pointer-events: none; background: transparent; border: none; }

/* Public Profile View */
.public-container { max-width: 680px; margin: 0 auto; padding: 60px 5%; min-height: 100vh; display: flex; flex-direction: column; align-items: center; text-align: center; }
#public-content { width: 100%; animation: slideUp 0.5s ease; }
.pub-avatar { width: 100px; height: 100px; border-radius: 50%; margin-bottom: 16px; box-shadow: 0 4px 14px rgba(0,0,0,0.1); object-fit: cover; }
.pub-name { font-size: 1.5rem; font-weight: 800; margin-bottom: 8px; }
.pub-bio { font-size: 1rem; color: var(--text-muted); margin-bottom: 32px; line-height: 1.5; }

/* Public Link with Icons Layout */
.pub-link { 
    display: flex; 
    align-items: center; 
    justify-content: center; 
    position: relative;
    width: 100%; 
    padding: 16px 24px; 
    margin-bottom: 16px; 
    background: var(--card-bg); 
    border: 1px solid var(--border-color); 
    border-radius: 99px; 
    text-decoration: none; 
    color: var(--text-color); 
    font-weight: 600; 
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s; 
    box-shadow: 0 2px 8px rgba(0,0,0,0.05); 
}
.pub-link:hover { transform: scale(1.02); box-shadow: 0 8px 16px rgba(255, 46, 136, 0.15); border-color: var(--primary); }
.pub-link-icon { position: absolute; left: 24px; color: inherit; }

.watermark { margin-top: auto; padding-top: 40px; padding-bottom: 20px; font-size: 0.9rem; color: var(--text-muted); }

/* Skeleton Loaders */
.skeleton { background: linear-gradient(90deg, var(--border-color) 25%, var(--card-bg) 50%, var(--border-color) 75%); background-size: 200% 100%; animation: loading 1.5s infinite; border-radius: 8px; }
.skel-avatar { width: 100px; height: 100px; border-radius: 50%; margin: 0 auto 16px; }
.skel-text { height: 24px; width: 80%; margin: 0 auto 16px; }
.skel-btn { height: 60px; width: 100%; border-radius: 99px; margin-bottom: 16px; }
@keyframes loading { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Toast */
#toast-container { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 10000; }
.toast { background: #0f172a; color: #fff; padding: 12px 24px; border-radius: 99px; font-size: 0.9rem; box-shadow: 0 4px 12px rgba(0,0,0,0.15); animation: toastIn 0.3s cubic-bezier(0.16, 1, 0.3, 1) forwards; border: 1px solid rgba(255,255,255,0.1); }
@keyframes toastIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes toastOut { to { transform: translateY(20px); opacity: 0; } }

/* 404 Not Found */
.not-found { text-align: center; max-width: 400px; margin: 100px auto; padding: 40px; border-radius: 24px; }
.not-found h2 { font-size: 4rem; color: var(--primary); margin-bottom: 16px; }
.not-found p { margin-bottom: 24px; color: var(--text-muted); }
