:root {
    /* Matcha Dark Mode Color Palette */
    --md-sys-color-primary: #A8D08D; /* Pastel Matcha Green */
    --md-sys-color-on-primary: #18330D;
    --md-sys-color-primary-container: #2A451E;
    --md-sys-color-on-primary-container: #C3EAB7;
    
    --md-sys-color-secondary: #9ECBAF; /* Pastel Mint */
    --md-sys-color-on-secondary: #103322;
    --md-sys-color-secondary-container: #244C36;
    --md-sys-color-on-secondary-container: #B9E7CB;
    
    --md-sys-color-background: #151A13; /* Sangat Gelap */
    --md-sys-color-on-background: #DFE4D8;
    --md-sys-color-surface: #1E251B; /* Agak terang dari background */
    --md-sys-color-on-surface: #DFE4D8;
    
    --md-sys-color-outline: #6D7F67;
    
    /* Typography */
    --md-sys-typescale-display-large: 600 57px/64px 'Outfit', sans-serif;
    --md-sys-typescale-title-large: 500 22px/28px 'Outfit', sans-serif;
    --md-sys-typescale-body-large: 400 16px/24px 'Outfit', sans-serif;
    
    /* Border Radius */
    --md-sys-shape-corner-medium: 16px;
    --md-sys-shape-corner-large: 24px;
    --md-sys-shape-corner-full: 9999px;
}

/* Hilangkan scrollbar */
::-webkit-scrollbar {
    display: none;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    scrollbar-width: none; /* Firefox */
}

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
    margin: 0;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
}

.main-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px; /* Jarak aman di mobile agar tidak menabrak pinggir layar */
    margin: 0;
    border-radius: 0;
    position: relative;
    padding-bottom: 120px; /* Space for bottom nav */
}

/* Navbar / Tab System (Mobile Default) */
.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80px;
    background-color: var(--md-sys-color-surface);
    display: flex;
    justify-content: space-around;
    align-items: center;
    padding: 0 8px;
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    text-decoration: none;
    color: var(--md-sys-color-outline);
    flex: 1;
    max-width: 96px;
    padding: 12px 0 16px 0;
}

.nav-item .material-symbols-rounded {
    font-size: 24px;
    padding: 4px 20px;
    border-radius: 16px;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.nav-label {
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.2, 0, 0, 1);
}

.nav-item.active .material-symbols-rounded {
    background-color: var(--md-sys-color-secondary-container);
    color: var(--md-sys-color-on-secondary-container);
}

.nav-item.active .nav-label {
    color: var(--md-sys-color-on-background);
    font-weight: 700;
}



/* Sections for Tabs */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Hero Card (Profil) */
.hero-card {
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 24px;
    display: flex;
    flex-direction: column;
    margin-bottom: 24px;
    position: relative;
}

.hero-image-wrapper {
    width: 100%;
    height: 250px; /* Ukuran diperkecil dari 380px */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.hero-img {
    height: 100%;
    object-fit: contain;
    /* Efek floating tipis agar tidak kaku */
    animation: floatAvatar 4s ease-in-out infinite;
}

@keyframes floatAvatar {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

.profile-bottom {
    display: flex;
    flex-direction: column;
    gap: 16px;
    align-items: flex-start;
    width: 100%;
}

.profile-user-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.profile-headshot {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    background-color: var(--md-sys-color-background);
}

.profile-names {
    display: flex;
    flex-direction: column;
}

.profile-names .username {
    font: var(--md-sys-typescale-display-large);
    font-size: 28px;
    color: var(--md-sys-color-on-background);
    line-height: 1.2;
}

.profile-names .handle {
    font-size: 16px;
    color: var(--md-sys-color-outline);
}

.profile-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.stat-chip {
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
}

.stat-chip strong {
    font-weight: 700;
    margin-right: 4px;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    padding: 12px 24px;
    border-radius: 12px;
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.2s ease;
    margin-top: 8px;
    width: 100%;
    justify-content: center;
}

.btn-primary:hover {
    background-color: var(--md-sys-color-secondary);
    color: var(--md-sys-color-on-secondary);
    transform: translateY(-2px);
}

/* General Sections */
.section {
    margin-bottom: 24px;
}

.section-title {
    font: var(--md-sys-typescale-title-large);
    margin-bottom: 16px;
    margin-left: 8px;
    color: var(--md-sys-color-on-background);
}

/* Social Grid & Card (Reference editorstuff) */
.social-grid {
    display: flex;
    flex-direction: column; /* 1 grid ke bawah */
    gap: 16px;
    width: 100%;
}

.social-card-small {
    display: flex;
    align-items: center;
    gap: 16px;
    background-color: var(--md-sys-color-surface);
    padding: 16px 24px; /* Lebih besar */
    border-radius: var(--md-sys-shape-corner-large);
    text-decoration: none;
    color: var(--md-sys-color-on-background);
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.social-card-small:hover {
    background-color: #2D3728; /* Lebih terang dikit dari surface */
    transform: translateY(-2px);
}

.social-card-small .material-symbols-rounded {
    font-size: 28px; /* Ikon lebih besar */
    color: var(--md-sys-color-primary); 
}

.social-card-small .social-title {
    font-size: 18px; /* Teks lebih besar */
    font-weight: 600;
}

footer {
    text-align: center;
    padding: 32px 0;
    color: var(--md-sys-color-outline);
    font-size: 14px;
}

/* Nav Bar Wrappers (Mobile Default) */
#public-nav-tabs {
    display: flex;
    width: 100%;
    justify-content: space-around;
    align-items: center;
}

#admin-nav-tabs {
    display: none;
    width: 100%;
    justify-content: space-around;
    align-items: center;
}

/* Responsive Desktop Layout (Meniru editorstuff) */
@media (min-width: 768px) {
    .app-container {
        flex-direction: row;
    }

    body {
        background-color: #0f130e; /* Warna paling gelap untuk background luar */
    }

    .main-content {
        border-radius: 32px;
        background-color: var(--md-sys-color-background);
        margin: 16px 24px 16px 0; /* Vertikal 16px, Kanan 24px, Kiri 0 (karena navbar) */
        padding: 40px 64px; /* Jarak vertikal 40px, horizontal 64px ke dalam */
        padding-bottom: 40px; /* Reset padding-bottom mobile */
        border: 1px solid rgba(255, 255, 255, 0.08);
        overflow-y: auto;
        flex: 1;
    }

    .nav-bar {
        position: static;
        width: 96px; /* Diperlebar agar tidak sesak */
        height: 100vh;
        flex-direction: column;
        justify-content: flex-start;
        padding-top: 48px;
        gap: 16px;
        background-color: transparent;
        border: none;
        box-shadow: none;
    }

    #public-nav-tabs {
        flex-direction: column;
        justify-content: flex-start;
        gap: 24px;
    }

    #admin-nav-tabs {
        flex-direction: column;
        justify-content: flex-start;
        gap: 24px;
    }

    .nav-item {
        width: 100%;
        max-width: 80px;
        padding: 4px 0;
        height: auto;
        flex: none;
    }

    /* Agar isi content tidak terlalu lebar di desktop */
    .tab-content {
        max-width: 900px; /* Lebar optimal untuk web */
        margin: 0 auto;
    }

    /* Link jadi grid 2x2 (kiri kanan, bawah 2) di Desktop */
    .social-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 16px;
    }
}

/* ==========================================
   ADMIN TAB & MODAL STYLES (MATERIAL 3)
   ========================================== */
.admin-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 16px;
}
.link-card {
    display: flex;
    align-items: center;
    background-color: var(--md-sys-color-surface);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 16px;
    gap: 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--md-sys-color-outline);
}
.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.order-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background-color: var(--md-sys-color-background);
    padding: 8px 6px;
    border-radius: 12px;
}
.order-controls button {
    background: none;
    border: none;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    padding: 0;
    transition: color 0.2s;
}
.order-controls button:hover {
    color: var(--md-sys-color-primary);
}
.order-number {
    font-size: 14px;
    font-weight: bold;
    color: var(--md-sys-color-on-surface);
}

.link-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    overflow: hidden;
}
.link-icon-wrapper {
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-on-primary-container);
    width: 48px;
    height: 48px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}
.link-details {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.link-title {
    font-size: 16px;
    font-weight: bold;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.link-url {
    font-size: 13px;
    color: var(--md-sys-color-outline);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.action-btns {
    display: flex;
    gap: 8px;
}
.action-btns button {
    background-color: var(--md-sys-color-background);
    border: none;
    color: var(--md-sys-color-on-surface);
    cursor: pointer;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.action-btns button:hover {
    filter: brightness(1.2);
    transform: scale(1.05);
}
.btn-hide { color: var(--md-sys-color-outline) !important; }
.btn-show { color: var(--md-sys-color-primary) !important; background-color: var(--md-sys-color-primary-container) !important; }
.btn-delete { color: #ff5252 !important; background-color: rgba(255, 82, 82, 0.1) !important; }
.btn-delete:hover { background-color: #ff5252 !important; color: white !important; }

/* Modal Styles (Material 3 Dialog) */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    padding: 24px;
}
.modal-content {
    background-color: var(--md-sys-color-surface);
    padding: 24px;
    border-radius: 28px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    transform: scale(0.9);
    opacity: 0;
    animation: m3DialogIn 0.2s cubic-bezier(0.2, 0, 0, 1) forwards;
    border: 1px solid var(--md-sys-color-outline);
}
@keyframes m3DialogIn {
    to { transform: scale(1); opacity: 1; }
}

.icon-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
    margin-top: 12px;
}
.icon-item {
    font-size: 28px;
    text-align: center;
    padding: 12px;
    background-color: var(--md-sys-color-background);
    border-radius: 16px;
    cursor: pointer;
    border: 2px solid transparent;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s ease;
    color: var(--md-sys-color-on-surface);
}
.icon-item:hover {
    background-color: var(--md-sys-color-primary-container);
    transform: scale(1.1);
}
.icon-item.selected {
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    background-color: var(--md-sys-color-primary);
}

.form-group {
    margin-bottom: 16px;
    text-align: left;
}
.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--md-sys-color-on-surface);
    font-weight: bold;
    font-size: 14px;
}
.form-group input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--md-sys-color-outline);
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-surface);
    font-size: 16px;
    transition: all 0.3s ease;
}
.form-group input:focus {
    outline: none;
    border-color: var(--md-sys-color-primary);
}
